]>
Commit | Line | Data |
---|---|---|
94636378 RA |
1 | from .common import InfoExtractor |
2 | from ..utils import ( | |
5fe75f97 | 3 | float_or_none, |
29f7c58a | 4 | int_or_none, |
94636378 | 5 | smuggle_url, |
29f7c58a | 6 | strip_or_none, |
94636378 RA |
7 | ) |
8 | ||
9 | ||
10 | class TVAIE(InfoExtractor): | |
49357497 S |
11 | _VALID_URL = r'https?://videos?\.tva\.ca/details/_(?P<id>\d+)' |
12 | _TESTS = [{ | |
5fe75f97 | 13 | 'url': 'https://videos.tva.ca/details/_5596811470001', |
94636378 | 14 | 'info_dict': { |
5fe75f97 | 15 | 'id': '5596811470001', |
94636378 | 16 | 'ext': 'mp4', |
5fe75f97 RA |
17 | 'title': 'Un extrait de l\'épisode du dimanche 8 octobre 2017 !', |
18 | 'uploader_id': '5481942443001', | |
19 | 'upload_date': '20171003', | |
20 | 'timestamp': 1507064617, | |
94636378 RA |
21 | }, |
22 | 'params': { | |
23 | # m3u8 download | |
24 | 'skip_download': True, | |
29f7c58a | 25 | }, |
26 | 'skip': 'HTTP Error 404: Not Found', | |
49357497 S |
27 | }, { |
28 | 'url': 'https://video.tva.ca/details/_5596811470001', | |
29 | 'only_matching': True, | |
30 | }] | |
5fe75f97 | 31 | BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/5481942443001/default_default/index.html?videoId=%s' |
94636378 RA |
32 | |
33 | def _real_extract(self, url): | |
34 | video_id = self._match_id(url) | |
94636378 RA |
35 | |
36 | return { | |
37 | '_type': 'url_transparent', | |
38 | 'id': video_id, | |
5fe75f97 | 39 | 'url': smuggle_url(self.BRIGHTCOVE_URL_TEMPLATE % video_id, {'geo_countries': ['CA']}), |
5fe75f97 | 40 | 'ie_key': 'BrightcoveNew', |
94636378 | 41 | } |
29f7c58a | 42 | |
43 | ||
44 | class QubIE(InfoExtractor): | |
45 | _VALID_URL = r'https?://(?:www\.)?qub\.ca/(?:[^/]+/)*[0-9a-z-]+-(?P<id>\d+)' | |
46 | _TESTS = [{ | |
47 | 'url': 'https://www.qub.ca/tvaplus/tva/alerte-amber/saison-1/episode-01-1000036619', | |
48 | 'md5': '949490fd0e7aee11d0543777611fbd53', | |
49 | 'info_dict': { | |
50 | 'id': '6084352463001', | |
51 | 'ext': 'mp4', | |
52 | 'title': 'Épisode 01', | |
53 | 'uploader_id': '5481942443001', | |
54 | 'upload_date': '20190907', | |
55 | 'timestamp': 1567899756, | |
56 | 'description': 'md5:9c0d7fbb90939420c651fd977df90145', | |
57 | }, | |
58 | }, { | |
59 | 'url': 'https://www.qub.ca/tele/video/lcn-ca-vous-regarde-rev-30s-ap369664-1009357943', | |
60 | 'only_matching': True, | |
61 | }] | |
62 | # reference_id also works with old account_id(5481942443001) | |
63 | # BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/5813221784001/default_default/index.html?videoId=ref:%s' | |
64 | ||
65 | def _real_extract(self, url): | |
66 | entity_id = self._match_id(url) | |
67 | entity = self._download_json( | |
68 | 'https://www.qub.ca/proxy/pfu/content-delivery-service/v1/entities', | |
69 | entity_id, query={'id': entity_id}) | |
70 | video_id = entity['videoId'] | |
71 | episode = strip_or_none(entity.get('name')) | |
72 | ||
73 | return { | |
74 | '_type': 'url_transparent', | |
75 | 'id': video_id, | |
76 | 'title': episode, | |
77 | # 'url': self.BRIGHTCOVE_URL_TEMPLATE % entity['referenceId'], | |
78 | 'url': 'https://videos.tva.ca/details/_' + video_id, | |
79 | 'description': entity.get('longDescription'), | |
80 | 'duration': float_or_none(entity.get('durationMillis'), 1000), | |
81 | 'episode': episode, | |
82 | 'episode_number': int_or_none(entity.get('episodeNumber')), | |
83 | # 'ie_key': 'BrightcoveNew', | |
84 | 'ie_key': TVAIE.ie_key(), | |
85 | } |