projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fe45b0e
)
[ctv] add support for (tsn,bnn,thecomedynetwork).ca websites(#10016)
author
Remita Amine
<remitamine@gmail.com>
Mon, 29 Aug 2016 17:20:58 +0000
(18:20 +0100)
committer
Remita Amine
<remitamine@gmail.com>
Mon, 29 Aug 2016 17:24:16 +0000
(18:24 +0100)
youtube_dl/extractor/ctv.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/ctv.py
b/youtube_dl/extractor/ctv.py
index 5807fbac980d64ce62caae86f778b1583fa2fdaf..a1fe86316036c3c12587860cf650705c136b8bf4 100644
(file)
--- a/
youtube_dl/extractor/ctv.py
+++ b/
youtube_dl/extractor/ctv.py
@@
-1,11
+1,13
@@
# coding: utf-8
from __future__ import unicode_literals
# coding: utf-8
from __future__ import unicode_literals
+import re
+
from .common import InfoExtractor
class CTVIE(InfoExtractor):
from .common import InfoExtractor
class CTVIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?
ctv\.ca/video/player\?vid=
(?P<id>[0-9.]+)'
+ _VALID_URL = r'https?://(?:www\.)?
(?P<domain>ctv|tsn|bnn|thecomedynetwork)\.ca/.*?(?:\bvid=|-vid|~|%7E)
(?P<id>[0-9.]+)'
_TESTS = [{
'url': 'http://www.ctv.ca/video/player?vid=706966',
'md5': 'ff2ebbeae0aa2dcc32a830c3fd69b7b0',
_TESTS = [{
'url': 'http://www.ctv.ca/video/player?vid=706966',
'md5': 'ff2ebbeae0aa2dcc32a830c3fd69b7b0',
@@
-18,13
+20,27
@@
class CTVIE(InfoExtractor):
'timestamp': 1442624700,
},
'expected_warnings': ['HTTP Error 404'],
'timestamp': 1442624700,
},
'expected_warnings': ['HTTP Error 404'],
+ }, {
+ 'url': 'http://www.thecomedynetwork.ca/video/player?vid=923582',
+ 'only_matching': True,
+ }, {
+ 'url': 'http://www.tsn.ca/video/expectations-high-for-milos-raonic-at-us-open~939549',
+ 'only_matching': True,
+ }, {
+ 'url': 'http://www.bnn.ca/video/berman-s-call-part-two-viewer-questions~939654',
+ 'only_matching': True,
+ }, {
+ 'url': 'http://www.ctv.ca/YourMorning/Video/S1E6-Monday-August-29-2016-vid938009',
+ 'only_matching': True,
}]
def _real_extract(self, url):
}]
def _real_extract(self, url):
- video_id = self._match_id(url)
+ domain, video_id = re.match(self._VALID_URL, url).groups()
+ if domain == 'thecomedynetwork':
+ domain = 'comedy'
return {
'_type': 'url_transparent',
'id': video_id,
return {
'_type': 'url_transparent',
'id': video_id,
- 'url': '9c9media:
ctv_web:%s' % video_id
,
+ 'url': '9c9media:
%s_web:%s' % (domain, video_id)
,
'ie_key': 'NineCNineMedia',
}
'ie_key': 'NineCNineMedia',
}