]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/rmcdecouverte.py
Start new release.
[youtubedl] / youtube_dl / extractor / rmcdecouverte.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from .brightcove import BrightcoveLegacyIE
6 from ..compat import (
7 compat_parse_qs,
8 compat_urlparse,
9 )
10
11
12 class RMCDecouverteIE(InfoExtractor):
13 _VALID_URL = r'https?://rmcdecouverte\.bfmtv\.com/mediaplayer-replay.*?\bid=(?P<id>\d+)'
14
15 _TEST = {
16 'url': 'http://rmcdecouverte.bfmtv.com/mediaplayer-replay/?id=13502&title=AQUAMEN:LES%20ROIS%20DES%20AQUARIUMS%20:UN%20DELICIEUX%20PROJET',
17 'info_dict': {
18 'id': '5419055995001',
19 'ext': 'mp4',
20 'title': 'UN DELICIEUX PROJET',
21 'description': 'md5:63610df7c8b1fc1698acd4d0d90ba8b5',
22 'uploader_id': '1969646226001',
23 'upload_date': '20170502',
24 'timestamp': 1493745308,
25 },
26 'params': {
27 'skip_download': True,
28 },
29 'skip': 'only available for a week',
30 }
31 BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/1969646226001/default_default/index.html?videoId=%s'
32
33 def _real_extract(self, url):
34 video_id = self._match_id(url)
35 webpage = self._download_webpage(url, video_id)
36 brightcove_legacy_url = BrightcoveLegacyIE._extract_brightcove_url(webpage)
37 if brightcove_legacy_url:
38 brightcove_id = compat_parse_qs(compat_urlparse.urlparse(
39 brightcove_legacy_url).query)['@videoPlayer'][0]
40 else:
41 brightcove_id = self._search_regex(
42 r'data-video-id=["\'](\d+)', webpage, 'brightcove id')
43 return self.url_result(
44 self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id, 'BrightcoveNew',
45 brightcove_id)