aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-05-08 22:03:03 +0600
committerSergey M․ <dstftw@gmail.com>2015-05-08 22:03:03 +0600
commit34e7dc81a94d39d48c5b4aac8cddcca46edba94d (patch)
tree4edd83f83e209752e324c76348d5a923dc504525 /youtube_dl/extractor
parent4e6e9d21bd62c4e2ab2576347e066891092a5783 (diff)
[vgtv] Add support for generic bt.no URLs (#5620)
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/vgtv.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/youtube_dl/extractor/vgtv.py b/youtube_dl/extractor/vgtv.py
index 69dc9a759..b0f0b3bc2 100644
--- a/youtube_dl/extractor/vgtv.py
+++ b/youtube_dl/extractor/vgtv.py
@@ -8,7 +8,8 @@ from ..utils import float_or_none
class VGTVIE(InfoExtractor):
- _VALID_URL = r'http://(?:www\.)?vgtv\.no/#!/[^/]+/(?P<id>[0-9]+)'
+ IE_DESC = 'VGTV and BTTV'
+ _VALID_URL = r'http://(?:www\.)?(?P<host>vgtv|bt)\.no/(?:(?:tv/)?#!/(?:video|live)/(?P<id>[0-9]+)|(?:[^/]+/)*(?P<path>[^/]+))'
_TESTS = [
{
# streamType: vod
@@ -64,12 +65,25 @@ class VGTVIE(InfoExtractor):
'skip_download': True,
},
},
+ {
+ 'url': 'http://www.bt.no/tv/#!/video/100250/norling-dette-er-forskjellen-paa-1-divisjon-og-eliteserien',
+ 'only_matching': True,
+ },
]
def _real_extract(self, url):
- video_id = self._match_id(url)
+ mobj = re.match(self._VALID_URL, url)
+ video_id = mobj.group('id')
+ host = mobj.group('host')
+
+ HOST_WEBSITES = {
+ 'vgtv': 'vgtv',
+ 'bt': 'bttv',
+ }
+
data = self._download_json(
- 'http://svp.vg.no/svp/api/v1/vgtv/assets/%s?appName=vgtv-website' % video_id,
+ 'http://svp.vg.no/svp/api/v1/%s/assets/%s?appName=%s-website'
+ % (host, video_id, HOST_WEBSITES[host]),
video_id, 'Downloading media JSON')
streams = data['streamUrls']