2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_urllib_parse_urlparse
16 class UltimediaIE(InfoExtractor
):
17 _VALID_URL
= r
'https?://(?:www\.)?ultimedia\.com/default/index/video[^/]+/id/(?P<id>[\d+a-z]+)'
20 'url': 'https://www.ultimedia.com/default/index/videogeneric/id/s8uk0r',
21 'md5': '276a0e49de58c7e85d32b057837952a2',
25 'title': 'Loi sur la fin de vie: le texte prévoit un renforcement des directives anticipées',
26 'description': 'md5:3e5c8fd65791487333dda5db8aed32af',
27 'thumbnail': 're:^https?://.*\.jpg',
28 'upload_date': '20150317',
32 'url': 'https://www.ultimedia.com/default/index/videomusic/id/xvpfp8',
33 'md5': '2ea3513813cf230605c7e2ffe7eca61c',
37 'title': "Two - C'est la vie (Clip)",
39 'thumbnail': 're:^https?://.*\.jpg',
40 'upload_date': '20150224',
44 def _real_extract(self
, url
):
45 video_id
= self
._match
_id
(url
)
46 webpage
= self
._download
_webpage
(url
, video_id
)
48 deliver_url
= self
._proto
_relative
_url
(self
._search
_regex
(
49 r
'<iframe[^>]+src="((?:https?:)?//(?:www\.)?ultimedia\.com/deliver/[^"]+)"',
50 webpage
, 'deliver URL'), compat_urllib_parse_urlparse(url
).scheme
+ ':')
52 deliver_page
= self
._download
_webpage
(
53 deliver_url
, video_id
, 'Downloading iframe page')
55 if '>This video is currently not available' in deliver_page
:
57 'Video %s is currently not available' % video_id
, expected
=True)
59 player
= self
._parse
_json
(
61 r
"jwplayer\('player(?:_temp)?'\)\.setup\(({.+?})\)\.on",
62 deliver_page
, 'player'),
65 quality
= qualities(['flash', 'html5'])
67 for mode
in player
['modes']:
68 video_url
= mode
.get('config', {}).get('file')
71 if re
.match(r
'https?://www\.youtube\.com/.+?', video_url
):
72 return self
.url_result(video_url
, 'Youtube')
75 'format_id': mode
.get('type'),
76 'quality': quality(mode
.get('type')),
78 self
._sort
_formats
(formats
)
80 thumbnail
= player
.get('image')
83 self
._html
_search
_regex
(
84 r
'(?s)<div\s+id="catArticle">.+?</div>(.+?)</h1>',
85 webpage
, 'title', default
=None) or
87 r
"var\s+nameVideo\s*=\s*'([^']+)'",
88 deliver_page
, 'title')))
90 description
= clean_html(self
._html
_search
_regex
(
91 r
'(?s)<span>Description</span>(.+?)</p>', webpage
,
92 'description', fatal
=False))
94 upload_date
= unified_strdate(self
._search
_regex
(
95 r
'Ajouté le\s*<span>([^<]+)', webpage
,
96 'upload date', fatal
=False))
101 'description': description
,
102 'thumbnail': thumbnail
,
103 'upload_date': upload_date
,