[clubic] Rely on _match_id and _parse_json

pull/2/head
Déstin Reed 8 years ago
parent 8f0cf20ab9
commit eaf9b22f94

@ -1,9 +1,6 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
clean_html, clean_html,
@ -30,16 +27,14 @@ class ClubicIE(InfoExtractor):
}] }]
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) video_id = self._match_id(url)
video_id = mobj.group('id')
player_url = 'http://player.m6web.fr/v1/player/clubic/%s.html' % video_id player_url = 'http://player.m6web.fr/v1/player/clubic/%s.html' % video_id
player_page = self._download_webpage(player_url, video_id) player_page = self._download_webpage(player_url, video_id)
config_json = self._search_regex( config = self._parse_json(self._search_regex(
r'(?m)M6\.Player\.config\s*=\s*(\{.+?\});$', player_page, r'(?m)M6\.Player\.config\s*=\s*(\{.+?\});$', player_page,
'configuration') 'configuration'), video_id)
config = json.loads(config_json)
video_info = config['videoInfo'] video_info = config['videoInfo']
sources = config['sources'] sources = config['sources']

Loading…
Cancel
Save