2 from __future__ import unicode_literals
7 from .common import InfoExtractor
14 class ClubicIE(InfoExtractor):
15 _VALID_URL = r'http://(?:www\.)?clubic\.com/video/(?:[^/]+/)*video.*-(?P<id>[0-9]+)\.html'
18 'url': 'http://www.clubic.com/video/clubic-week/video-clubic-week-2-0-le-fbi-se-lance-dans-la-photo-d-identite-448474.html',
19 'md5': '1592b694ba586036efac1776b0b43cd3',
23 'title': 'Clubic Week 2.0 : le FBI se lance dans la photo d\u0092identité',
24 'description': 're:Gueule de bois chez Nokia. Le constructeur a indiqué cette.*',
25 'thumbnail': 're:^http://img\.clubic\.com/.*\.jpg$',
28 'url': 'http://www.clubic.com/video/video-clubic-week-2-0-apple-iphone-6s-et-plus-mais-surtout-le-pencil-469792.html',
29 'only_matching': True,
32 def _real_extract(self, url):
33 mobj = re.match(self._VALID_URL, url)
34 video_id = mobj.group('id')
36 player_url = 'http://player.m6web.fr/v1/player/clubic/%s.html' % video_id
37 player_page = self._download_webpage(player_url, video_id)
39 config_json = self._search_regex(
40 r'(?m)M6\.Player\.config\s*=\s*(\{.+?\});$', player_page,
42 config = json.loads(config_json)
44 video_info = config['videoInfo']
45 sources = config['sources']
46 quality_order = qualities(['sd', 'hq'])
49 'format_id': src['streamQuality'],
51 'quality': quality_order(src['streamQuality']),
53 self._sort_formats(formats)
57 'title': video_info['title'],
59 'description': clean_html(video_info.get('description')),
60 'thumbnail': config.get('poster'),