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)
46 webpage = self._download_webpage(url, video_id)
48 deliver_url = self._search_regex(
49 r'<iframe[^>]+src="(https?://(?:www\.)?ultimedia\.com/deliver/[^"]+)"',
50 webpage, 'deliver URL')
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", deliver_page, 'player'),
64 quality = qualities(['flash', 'html5'])
66 for mode in player['modes']:
67 video_url = mode.get('config', {}).get('file')
70 if re.match(r'https?://www\.youtube\.com/.+?', video_url):
71 return self.url_result(video_url, 'Youtube')
74 'format_id': mode.get('type'),
75 'quality': quality(mode.get('type')),
77 self._sort_formats(formats)
79 thumbnail = player.get('image')
82 self._html_search_regex(
83 r'(?s)<div\s+id="catArticle">.+?</div>(.+?)</h1>',
84 webpage, 'title', default=None)
85 or self._search_regex(
86 r"var\s+nameVideo\s*=\s*'([^']+)'",
87 deliver_page, 'title')))
89 description = clean_html(self._html_search_regex(
90 r'(?s)<span>Description</span>(.+?)</p>', webpage,
91 'description', fatal=False))
93 upload_date = unified_strdate(self._search_regex(
94 r'Ajouté le\s*<span>([^<]+)', webpage,
95 'upload date', fatal=False))
100 'description': description,
101 'thumbnail': thumbnail,
102 'upload_date': upload_date,