2 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..utils import int_or_none
10 class UltimediaIE(InfoExtractor):
11 _VALID_URL = r'https?://(?:www\.)?ultimedia\.com/deliver/(?P<type>generic|musique)(?:/[^/]+)*/(?:src|article)/(?P<id>[\d+a-z]+)'
14 'url': 'https://www.ultimedia.com/deliver/generic/iframe/mdtk/01601930/zone/1/src/s8uk0r/autoplay/yes/ad/no/width/714/height/435',
15 'md5': '276a0e49de58c7e85d32b057837952a2',
19 'title': 'Loi sur la fin de vie: le texte prévoit un renforcement des directives anticipées',
20 'thumbnail': 're:^https?://.*\.jpg',
22 'upload_date': '20150317',
23 'timestamp': 1426604939,
24 'uploader_id': '3fszv',
28 'url': 'https://www.ultimedia.com/deliver/musique/iframe/mdtk/01601930/zone/1/article/xvpfp8/autoplay/yes/ad/no/width/714/height/435',
29 'md5': '2ea3513813cf230605c7e2ffe7eca61c',
33 'title': 'Two - C\'est La Vie (clip)',
34 'thumbnail': 're:^https?://.*\.jpg',
36 'upload_date': '20150224',
37 'timestamp': 1424760500,
38 'uploader_id': '3rfzk',
43 def _extract_url(webpage):
45 r'<(?:iframe|script)[^>]+src=["\'](?P<url>(?:https?:)?//(?:www\.)?ultimedia\.com/deliver/(?:generic|musique)(?:/[^/]+)*/(?:src|article)/[\d+a-z]+)',
48 return mobj.group('url')
50 def _real_extract(self, url):
51 video_type, video_id = re.match(self._VALID_URL, url).groups()
53 deliver_info = self._download_json(
54 'http://www.ultimedia.com/deliver/video?video=%s&topic=%s' % (video_id, video_type),
57 yt_id = deliver_info.get('yt_id')
59 return self.url_result(yt_id, 'Youtube')
61 jwconf = deliver_info['jwconf']
64 for source in jwconf['playlist'][0]['sources']:
66 'url': source['file'],
67 'format_id': source.get('label'),
70 self._sort_formats(formats)
72 title = deliver_info['title']
73 thumbnail = jwconf.get('image')
74 duration = int_or_none(deliver_info.get('duration'))
75 timestamp = int_or_none(deliver_info.get('release_time'))
76 uploader_id = deliver_info.get('owner_id')
81 'thumbnail': thumbnail,
83 'timestamp': timestamp,
84 'uploader_id': uploader_id,