2 from __future__ import unicode_literals
6 from .common import InfoExtractor
15 class UltimediaIE(InfoExtractor):
16 _VALID_URL = r'https?://(?:www\.)?ultimedia\.com/default/index/video[^/]+/id/(?P<id>[\d+a-z]+)'
19 'url': 'https://www.ultimedia.com/default/index/videogeneric/id/s8uk0r',
20 'md5': '276a0e49de58c7e85d32b057837952a2',
24 'title': 'Loi sur la fin de vie: le texte prévoit un renforcement des directives anticipées',
25 'description': 'md5:3e5c8fd65791487333dda5db8aed32af',
26 'thumbnail': 're:^https?://.*\.jpg',
27 'upload_date': '20150317',
31 'url': 'https://www.ultimedia.com/default/index/videomusic/id/xvpfp8',
32 'md5': '2ea3513813cf230605c7e2ffe7eca61c',
36 'title': "Two - C'est la vie (Clip)",
38 'thumbnail': 're:^https?://.*\.jpg',
39 'upload_date': '20150224',
43 def _real_extract(self, url):
44 video_id = self._match_id(url)
45 webpage = self._download_webpage(url, video_id)
47 deliver_url = self._search_regex(
48 r'<iframe[^>]+src="(https?://(?:www\.)?ultimedia\.com/deliver/[^"]+)"',
49 webpage, 'deliver URL')
51 deliver_page = self._download_webpage(
52 deliver_url, video_id, 'Downloading iframe page')
54 if '>This video is currently not available' in deliver_page:
56 'Video %s is currently not available' % video_id, expected=True)
58 player = self._parse_json(
60 r"jwplayer\('player(?:_temp)?'\)\.setup\(({.+?})\)\.on", deliver_page, 'player'),
63 quality = qualities(['flash', 'html5'])
65 for mode in player['modes']:
66 video_url = mode.get('config', {}).get('file')
69 if re.match(r'https?://www\.youtube\.com/.+?', video_url):
70 return self.url_result(video_url, 'Youtube')
73 'format_id': mode.get('type'),
74 'quality': quality(mode.get('type')),
76 self._sort_formats(formats)
78 thumbnail = player.get('image')
81 self._html_search_regex(
82 r'(?s)<div\s+id="catArticle">.+?</div>(.+?)</h1>',
83 webpage, 'title', default=None) or
85 r"var\s+nameVideo\s*=\s*'([^']+)'",
86 deliver_page, 'title')))
88 description = clean_html(self._html_search_regex(
89 r'(?s)<span>Description</span>(.+?)</p>', webpage,
90 'description', fatal=False))
92 upload_date = unified_strdate(self._search_regex(
93 r'Ajouté le\s*<span>([^<]+)', webpage,
94 'upload date', fatal=False))
99 'description': description,
100 'thumbnail': thumbnail,
101 'upload_date': upload_date,