2 from __future__ import unicode_literals
4 from .common import InfoExtractor
11 class SixPlayIE(InfoExtractor):
12 _VALID_URL = r'(?:6play:|https?://(?:www\.)?6play\.fr/.+?-c_)(?P<id>[0-9]+)'
14 'url': 'http://www.6play.fr/jamel-et-ses-amis-au-marrakech-du-rire-p_1316/jamel-et-ses-amis-au-marrakech-du-rire-2015-c_11495320',
15 'md5': '42310bffe4ba3982db112b9cd3467328',
19 'title': 'Jamel et ses amis au Marrakech du rire 2015',
20 'description': 'md5:ba2149d5c321d5201b78070ee839d872',
24 def _real_extract(self, url):
25 video_id = self._match_id(url)
26 clip_data = self._download_json(
27 'https://player.m6web.fr/v2/video/config/6play-auth/FR/%s.json' % video_id,
29 video_data = clip_data['videoInfo']
31 preference = qualities(['lq', 'sd', 'hq', 'hd'])
33 for source in clip_data['sources']:
34 source_type, source_url = source.get('type'), source.get('src')
35 if not source_url or source_type == 'hls/primetime':
37 if source_type == 'application/vnd.apple.mpegURL':
38 formats.extend(self._extract_m3u8_formats(
39 source_url, video_id, 'mp4', 'm3u8_native',
40 m3u8_id='hls', fatal=False))
41 formats.extend(self._extract_f4m_formats(
42 source_url.replace('.m3u8', '.f4m'),
43 video_id, f4m_id='hds', fatal=False))
44 elif source_type == 'video/mp4':
45 quality = source.get('quality')
49 'preference': preference(quality),
51 self._sort_formats(formats)
55 'title': video_data['title'].strip(),
56 'description': video_data.get('description'),
57 'duration': int_or_none(video_data.get('duration')),
58 'series': video_data.get('titlePgm'),