2 from __future__ import unicode_literals
4 from .common import InfoExtractor
13 class UltimediaIE(InfoExtractor):
14 _VALID_URL = r'https?://(?:www\.)?ultimedia\.com/default/index/video[^/]+/id/(?P<id>[\d+a-z]+)'
17 'url': 'https://www.ultimedia.com/default/index/videogeneric/id/s8uk0r',
18 'md5': '276a0e49de58c7e85d32b057837952a2',
22 'title': 'Loi sur la fin de vie: le texte prévoit un renforcement des directives anticipées',
23 'description': 'md5:3e5c8fd65791487333dda5db8aed32af',
24 'thumbnail': 're:^https?://.*\.jpg',
25 'upload_date': '20150317',
29 'url': 'https://www.ultimedia.com/default/index/videomusic/id/xvpfp8',
30 'md5': '2ea3513813cf230605c7e2ffe7eca61c',
34 'title': "Two - C'est la vie (Clip)",
36 'thumbnail': 're:^https?://.*\.jpg',
37 'upload_date': '20150224',
41 def _real_extract(self, url):
42 video_id = self._match_id(url)
44 webpage = self._download_webpage(url, video_id)
46 deliver_url = self._search_regex(
47 r'<iframe[^>]+src="(https?://(?:www\.)?ultimedia\.com/deliver/[^"]+)"',
48 webpage, 'deliver URL')
50 deliver_page = self._download_webpage(
51 deliver_url, video_id, 'Downloading iframe page')
53 if '>This video is currently not available' in deliver_page:
55 'Video %s is currently not available' % video_id, expected=True)
57 player = self._parse_json(
59 r"jwplayer\('player(?:_temp)?'\)\.setup\(({.+?})\)\.on", deliver_page, 'player'),
62 quality = qualities(['flash', 'html5'])
65 'url': mode['config']['file'],
66 'format_id': mode.get('type'),
67 'quality': quality(mode.get('type')),
68 } for mode in player['modes']]
69 self._sort_formats(formats)
71 thumbnail = player.get('image')
74 self._html_search_regex(
75 r'(?s)<div\s+id="catArticle">.+?</div>(.+?)</h1>',
76 webpage, 'title', default=None)
77 or self._search_regex(
78 r"var\s+nameVideo\s*=\s*'([^']+)'",
79 deliver_page, 'title')))
81 description = clean_html(self._html_search_regex(
82 r'(?s)<span>Description</span>(.+?)</p>', webpage,
83 'description', fatal=False))
85 upload_date = unified_strdate(self._search_regex(
86 r'Ajouté le\s*<span>([^<]+)', webpage,
87 'upload date', fatal=False))
92 'description': description,
93 'thumbnail': thumbnail,
94 'upload_date': upload_date,