]>
Commit | Line | Data |
---|---|---|
6656a824 RA |
1 | from .common import InfoExtractor |
2 | from .brightcove import BrightcoveLegacyIE | |
3 | from ..compat import ( | |
4 | compat_parse_qs, | |
5 | compat_urlparse, | |
6 | ) | |
d9f1123c | 7 | from ..utils import smuggle_url |
6656a824 RA |
8 | |
9 | ||
10 | class RMCDecouverteIE(InfoExtractor): | |
d8ec40b3 | 11 | _VALID_URL = r'https?://rmcdecouverte\.bfmtv\.com/(?:[^?#]*_(?P<id>\d+)|mediaplayer-direct)/?(?:[#?]|$)' |
6656a824 | 12 | |
d9f1123c | 13 | _TESTS = [{ |
88f06afc | 14 | 'url': 'https://rmcdecouverte.bfmtv.com/vestiges-de-guerre_22240/les-bunkers-secrets-domaha-beach_25303/', |
15 | 'info_dict': { | |
16 | 'id': '6250879771001', | |
17 | 'ext': 'mp4', | |
18 | 'title': 'LES BUNKERS SECRETS D´OMAHA BEACH', | |
19 | 'uploader_id': '1969646226001', | |
20 | 'description': 'md5:aed573ca24abde62a148e0eba909657d', | |
21 | 'timestamp': 1619622984, | |
22 | 'upload_date': '20210428', | |
23 | }, | |
24 | 'params': { | |
88f06afc | 25 | 'skip_download': True, |
26 | }, | |
27 | }, { | |
3d8eb6be | 28 | 'url': 'https://rmcdecouverte.bfmtv.com/wheeler-dealers-occasions-a-saisir/program_2566/', |
6656a824 | 29 | 'info_dict': { |
3d8eb6be | 30 | 'id': '5983675500001', |
6656a824 | 31 | 'ext': 'mp4', |
3d8eb6be A |
32 | 'title': 'CORVETTE', |
33 | 'description': 'md5:c1e8295521e45ffebf635d6a7658f506', | |
6656a824 | 34 | 'uploader_id': '1969646226001', |
3d8eb6be A |
35 | 'upload_date': '20181226', |
36 | 'timestamp': 1545861635, | |
6656a824 RA |
37 | }, |
38 | 'params': { | |
6656a824 RA |
39 | 'skip_download': True, |
40 | }, | |
566fbbae | 41 | 'skip': 'only available for a week', |
d8ec40b3 | 42 | }, { |
43 | 'url': 'https://rmcdecouverte.bfmtv.com/avions-furtifs-la-technologie-de-lextreme_10598', | |
44 | 'only_matching': True, | |
d908aa63 | 45 | }, { |
d8ec40b3 | 46 | # The website accepts any URL as long as it has _\d+ at the end |
47 | 'url': 'https://rmcdecouverte.bfmtv.com/any/thing/can/go/here/_10598', | |
48 | 'only_matching': True, | |
d9f1123c S |
49 | }, { |
50 | # live, geo restricted, bypassable | |
51 | 'url': 'https://rmcdecouverte.bfmtv.com/mediaplayer-direct/', | |
52 | 'only_matching': True, | |
53 | }] | |
6656a824 RA |
54 | BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/1969646226001/default_default/index.html?videoId=%s' |
55 | ||
56 | def _real_extract(self, url): | |
5ad28e7f | 57 | mobj = self._match_valid_url(url) |
d8ec40b3 | 58 | display_id = mobj.group('id') or 'direct' |
d9f1123c | 59 | webpage = self._download_webpage(url, display_id) |
6656a824 | 60 | brightcove_legacy_url = BrightcoveLegacyIE._extract_brightcove_url(webpage) |
74c09c85 | 61 | if brightcove_legacy_url: |
566fbbae S |
62 | brightcove_id = compat_parse_qs(compat_urlparse.urlparse( |
63 | brightcove_legacy_url).query)['@videoPlayer'][0] | |
74c09c85 | 64 | else: |
566fbbae S |
65 | brightcove_id = self._search_regex( |
66 | r'data-video-id=["\'](\d+)', webpage, 'brightcove id') | |
67 | return self.url_result( | |
d9f1123c S |
68 | smuggle_url( |
69 | self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id, | |
70 | {'geo_countries': ['FR']}), | |
71 | 'BrightcoveNew', brightcove_id) |