]>
Commit | Line | Data |
---|---|---|
9617b557 RA |
1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
42e05be8 RA |
4 | import re |
5 | ||
9617b557 RA |
6 | from .common import InfoExtractor |
7 | ||
8 | ||
c035dba1 RA |
9 | class BellMediaIE(InfoExtractor): |
10 | _VALID_URL = r'''(?x)https?://(?:www\.)? | |
11 | (?P<domain> | |
12 | (?: | |
13 | ctv| | |
14 | tsn| | |
15 | bnn| | |
16 | thecomedynetwork| | |
17 | discovery| | |
18 | discoveryvelocity| | |
19 | sciencechannel| | |
20 | investigationdiscovery| | |
21 | animalplanet| | |
22 | bravo| | |
23 | mtv| | |
52d5ecab RA |
24 | space| |
25 | etalk | |
c035dba1 RA |
26 | )\.ca| |
27 | much\.com | |
52d5ecab | 28 | )/.*?(?:\bvid(?:eoid)?=|-vid|~|%7E|/(?:episode)?)(?P<id>[0-9]{6,})''' |
9617b557 RA |
29 | _TESTS = [{ |
30 | 'url': 'http://www.ctv.ca/video/player?vid=706966', | |
31 | 'md5': 'ff2ebbeae0aa2dcc32a830c3fd69b7b0', | |
32 | 'info_dict': { | |
33 | 'id': '706966', | |
34 | 'ext': 'mp4', | |
35 | 'title': 'Larry Day and Richard Jutras on the TIFF red carpet of \'Stonewall\'', | |
36 | 'description': 'etalk catches up with Larry Day and Richard Jutras on the TIFF red carpet of "Stonewall”.', | |
37 | 'upload_date': '20150919', | |
38 | 'timestamp': 1442624700, | |
39 | }, | |
40 | 'expected_warnings': ['HTTP Error 404'], | |
42e05be8 RA |
41 | }, { |
42 | 'url': 'http://www.thecomedynetwork.ca/video/player?vid=923582', | |
43 | 'only_matching': True, | |
44 | }, { | |
45 | 'url': 'http://www.tsn.ca/video/expectations-high-for-milos-raonic-at-us-open~939549', | |
46 | 'only_matching': True, | |
47 | }, { | |
48 | 'url': 'http://www.bnn.ca/video/berman-s-call-part-two-viewer-questions~939654', | |
49 | 'only_matching': True, | |
50 | }, { | |
51 | 'url': 'http://www.ctv.ca/YourMorning/Video/S1E6-Monday-August-29-2016-vid938009', | |
52 | 'only_matching': True, | |
c035dba1 RA |
53 | }, { |
54 | 'url': 'http://www.much.com/shows/atmidnight/episode948007/tuesday-september-13-2016', | |
55 | 'only_matching': True, | |
56 | }, { | |
57 | 'url': 'http://www.much.com/shows/the-almost-impossible-gameshow/928979/episode-6', | |
58 | 'only_matching': True, | |
89c6691f RA |
59 | }, { |
60 | 'url': 'http://www.ctv.ca/DCs-Legends-of-Tomorrow/Video/S2E11-Turncoat-vid1051430', | |
61 | 'only_matching': True, | |
52d5ecab RA |
62 | }, { |
63 | 'url': 'http://www.etalk.ca/video?videoid=663455', | |
64 | 'only_matching': True, | |
9617b557 | 65 | }] |
c035dba1 RA |
66 | _DOMAINS = { |
67 | 'thecomedynetwork': 'comedy', | |
68 | 'discoveryvelocity': 'discvel', | |
69 | 'sciencechannel': 'discsci', | |
70 | 'investigationdiscovery': 'invdisc', | |
71 | 'animalplanet': 'aniplan', | |
52d5ecab | 72 | 'etalk': 'ctv', |
c035dba1 | 73 | } |
9617b557 RA |
74 | |
75 | def _real_extract(self, url): | |
42e05be8 | 76 | domain, video_id = re.match(self._VALID_URL, url).groups() |
c035dba1 | 77 | domain = domain.split('.')[0] |
9617b557 RA |
78 | return { |
79 | '_type': 'url_transparent', | |
80 | 'id': video_id, | |
c035dba1 | 81 | 'url': '9c9media:%s_web:%s' % (self._DOMAINS.get(domain, domain), video_id), |
9617b557 RA |
82 | 'ie_key': 'NineCNineMedia', |
83 | } |