]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/bellmedia.py
[cleanup] Fix infodict returned fields (#8906)
[yt-dlp.git] / yt_dlp / extractor / bellmedia.py
CommitLineData
9617b557
RA
1from .common import InfoExtractor
2
3
c035dba1
RA
4class BellMediaIE(InfoExtractor):
5 _VALID_URL = r'''(?x)https?://(?:www\.)?
6 (?P<domain>
7 (?:
8 ctv|
9 tsn|
9c65c4a6 10 bnn(?:bloomberg)?|
c035dba1
RA
11 thecomedynetwork|
12 discovery|
13 discoveryvelocity|
14 sciencechannel|
15 investigationdiscovery|
16 animalplanet|
17 bravo|
18 mtv|
52d5ecab 19 space|
726e8eef
RA
20 etalk|
21 marilyn
c035dba1 22 )\.ca|
9a7e5cb8
RA
23 (?:much|cp24)\.com
24 )/.*?(?:\b(?:vid(?:eoid)?|clipId)=|-vid|~|%7E|/(?:episode)?)(?P<id>[0-9]{6,})'''
9617b557 25 _TESTS = [{
9c65c4a6 26 'url': 'https://www.bnnbloomberg.ca/video/david-cockfield-s-top-picks~1403070',
95032f30 27 'md5': '3e5b8e38370741d5089da79161646635',
9617b557 28 'info_dict': {
9c65c4a6
RA
29 'id': '1403070',
30 'ext': 'flv',
31 'title': 'David Cockfield\'s Top Picks',
32 'description': 'md5:810f7f8c6a83ad5b48677c3f8e5bb2c3',
33 'upload_date': '20180525',
34 'timestamp': 1527288600,
f4f9f6d0 35 'season_id': '73997',
95032f30 36 'season': '2018',
37 'thumbnail': 'http://images2.9c9media.com/image_asset/2018_5_25_baf30cbd-b28d-4a18-9903-4bb8713b00f5_PNG_956x536.jpg',
38 'tags': [],
39 'categories': ['ETFs'],
40 'season_number': 8,
41 'duration': 272.038,
42 'series': 'Market Call Tonight',
9617b557 43 },
42e05be8
RA
44 }, {
45 'url': 'http://www.thecomedynetwork.ca/video/player?vid=923582',
46 'only_matching': True,
47 }, {
48 'url': 'http://www.tsn.ca/video/expectations-high-for-milos-raonic-at-us-open~939549',
49 'only_matching': True,
50 }, {
51 'url': 'http://www.bnn.ca/video/berman-s-call-part-two-viewer-questions~939654',
52 'only_matching': True,
53 }, {
54 'url': 'http://www.ctv.ca/YourMorning/Video/S1E6-Monday-August-29-2016-vid938009',
55 'only_matching': True,
c035dba1
RA
56 }, {
57 'url': 'http://www.much.com/shows/atmidnight/episode948007/tuesday-september-13-2016',
58 'only_matching': True,
59 }, {
60 'url': 'http://www.much.com/shows/the-almost-impossible-gameshow/928979/episode-6',
61 'only_matching': True,
89c6691f
RA
62 }, {
63 'url': 'http://www.ctv.ca/DCs-Legends-of-Tomorrow/Video/S2E11-Turncoat-vid1051430',
64 'only_matching': True,
52d5ecab
RA
65 }, {
66 'url': 'http://www.etalk.ca/video?videoid=663455',
67 'only_matching': True,
9a7e5cb8
RA
68 }, {
69 'url': 'https://www.cp24.com/video?clipId=1982548',
70 'only_matching': True,
9617b557 71 }]
c035dba1
RA
72 _DOMAINS = {
73 'thecomedynetwork': 'comedy',
74 'discoveryvelocity': 'discvel',
75 'sciencechannel': 'discsci',
76 'investigationdiscovery': 'invdisc',
77 'animalplanet': 'aniplan',
52d5ecab 78 'etalk': 'ctv',
9c65c4a6 79 'bnnbloomberg': 'bnn',
726e8eef 80 'marilyn': 'ctv_marilyn',
c035dba1 81 }
9617b557
RA
82
83 def _real_extract(self, url):
5ad28e7f 84 domain, video_id = self._match_valid_url(url).groups()
c035dba1 85 domain = domain.split('.')[0]
9617b557
RA
86 return {
87 '_type': 'url_transparent',
88 'id': video_id,
c035dba1 89 'url': '9c9media:%s_web:%s' % (self._DOMAINS.get(domain, domain), video_id),
9617b557
RA
90 'ie_key': 'NineCNineMedia',
91 }