2 from __future__ import unicode_literals
4 from .common import InfoExtractor
12 class UltimediaIE(InfoExtractor):
13 _VALID_URL = r'https?://(?:www\.)?ultimedia\.com/default/index/video[^/]+/id/(?P<id>[\d+a-z]+)'
16 'url': 'https://www.ultimedia.com/default/index/videogeneric/id/s8uk0r',
17 'md5': '276a0e49de58c7e85d32b057837952a2',
21 'title': 'Loi sur la fin de vie: le texte prévoit un renforcement des directives anticipées',
22 'description': 'md5:3e5c8fd65791487333dda5db8aed32af',
23 'thumbnail': 're:^https?://.*\.jpg',
24 'upload_date': '20150317',
28 'url': 'https://www.ultimedia.com/default/index/videomusic/id/xvpfp8',
29 'md5': '2ea3513813cf230605c7e2ffe7eca61c',
33 'title': "Two - C'est la vie (Clip)",
35 'thumbnail': 're:^https?://.*\.jpg',
36 'upload_date': '20150224',
40 def _real_extract(self, url):
41 video_id = self._match_id(url)
43 webpage = self._download_webpage(url, video_id)
45 deliver_url = self._search_regex(
46 r'<iframe[^>]+src="(https?://(?:www\.)?ultimedia\.com/deliver/[^"]+)"',
47 webpage, 'deliver URL')
49 deliver_page = self._download_webpage(
50 deliver_url, video_id, 'Downloading iframe page')
52 player = self._parse_json(
54 r"jwplayer\('player(?:_temp)?'\)\.setup\(({.+?})\)\.on", deliver_page, 'player'),
57 quality = qualities(['flash', 'html5'])
60 'url': mode['config']['file'],
61 'format_id': mode.get('type'),
62 'quality': quality(mode.get('type')),
63 } for mode in player['modes']]
64 self._sort_formats(formats)
66 thumbnail = player.get('image')
69 self._html_search_regex(
70 r'(?s)<div\s+id="catArticle">.+?</div>(.+?)</h1>',
71 webpage, 'title', default=None)
72 or self._search_regex(
73 r"var\s+nameVideo\s*=\s*'([^']+)'",
74 deliver_page, 'title')))
76 description = clean_html(self._html_search_regex(
77 r'(?s)<span>Description</span>(.+?)</p>', webpage,
78 'description', fatal=False))
80 upload_date = unified_strdate(self._search_regex(
81 r'Ajouté le\s*<span>([^<]+)', webpage,
82 'upload date', fatal=False))
87 'description': description,
88 'thumbnail': thumbnail,
89 'upload_date': upload_date,