]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/bellmedia.py
debian/control: Remove X-Python3-Version indication.
[youtubedl] / youtube_dl / extractor / bellmedia.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import re
5
6 from .common import InfoExtractor
7
8
9 class BellMediaIE(InfoExtractor):
10 _VALID_URL = r'''(?x)https?://(?:www\.)?
11 (?P<domain>
12 (?:
13 ctv|
14 tsn|
15 bnn(?:bloomberg)?|
16 thecomedynetwork|
17 discovery|
18 discoveryvelocity|
19 sciencechannel|
20 investigationdiscovery|
21 animalplanet|
22 bravo|
23 mtv|
24 space|
25 etalk
26 )\.ca|
27 much\.com
28 )/.*?(?:\bvid(?:eoid)?=|-vid|~|%7E|/(?:episode)?)(?P<id>[0-9]{6,})'''
29 _TESTS = [{
30 'url': 'https://www.bnnbloomberg.ca/video/david-cockfield-s-top-picks~1403070',
31 'md5': '36d3ef559cfe8af8efe15922cd3ce950',
32 'info_dict': {
33 'id': '1403070',
34 'ext': 'flv',
35 'title': 'David Cockfield\'s Top Picks',
36 'description': 'md5:810f7f8c6a83ad5b48677c3f8e5bb2c3',
37 'upload_date': '20180525',
38 'timestamp': 1527288600,
39 },
40 }, {
41 'url': 'http://www.thecomedynetwork.ca/video/player?vid=923582',
42 'only_matching': True,
43 }, {
44 'url': 'http://www.tsn.ca/video/expectations-high-for-milos-raonic-at-us-open~939549',
45 'only_matching': True,
46 }, {
47 'url': 'http://www.bnn.ca/video/berman-s-call-part-two-viewer-questions~939654',
48 'only_matching': True,
49 }, {
50 'url': 'http://www.ctv.ca/YourMorning/Video/S1E6-Monday-August-29-2016-vid938009',
51 'only_matching': True,
52 }, {
53 'url': 'http://www.much.com/shows/atmidnight/episode948007/tuesday-september-13-2016',
54 'only_matching': True,
55 }, {
56 'url': 'http://www.much.com/shows/the-almost-impossible-gameshow/928979/episode-6',
57 'only_matching': True,
58 }, {
59 'url': 'http://www.ctv.ca/DCs-Legends-of-Tomorrow/Video/S2E11-Turncoat-vid1051430',
60 'only_matching': True,
61 }, {
62 'url': 'http://www.etalk.ca/video?videoid=663455',
63 'only_matching': True,
64 }]
65 _DOMAINS = {
66 'thecomedynetwork': 'comedy',
67 'discoveryvelocity': 'discvel',
68 'sciencechannel': 'discsci',
69 'investigationdiscovery': 'invdisc',
70 'animalplanet': 'aniplan',
71 'etalk': 'ctv',
72 'bnnbloomberg': 'bnn',
73 }
74
75 def _real_extract(self, url):
76 domain, video_id = re.match(self._VALID_URL, url).groups()
77 domain = domain.split('.')[0]
78 return {
79 '_type': 'url_transparent',
80 'id': video_id,
81 'url': '9c9media:%s_web:%s' % (self._DOMAINS.get(domain, domain), video_id),
82 'ie_key': 'NineCNineMedia',
83 }