aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/discoverynetworks.py
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2018-06-13 16:46:59 +0100
committerRemita Amine <remitamine@gmail.com>2018-06-13 16:46:59 +0100
commitaa56061627f9871b4793414b71a26976befd3a9c (patch)
tree50a7ab06383fe0e1c33c7684cc4e142eeafd7e2c /youtube_dl/extractor/discoverynetworks.py
parent18d66f04107b584c2d6ee6c175c44c7f2d81ecba (diff)
[discoverynetworks] Add support for disco-api videos(closes #16724)
Diffstat (limited to 'youtube_dl/extractor/discoverynetworks.py')
-rw-r--r--youtube_dl/extractor/discoverynetworks.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/youtube_dl/extractor/discoverynetworks.py b/youtube_dl/extractor/discoverynetworks.py
index b6653784c..fba1ef221 100644
--- a/youtube_dl/extractor/discoverynetworks.py
+++ b/youtube_dl/extractor/discoverynetworks.py
@@ -3,8 +3,8 @@ from __future__ import unicode_literals
import re
-from .common import InfoExtractor
from .brightcove import BrightcoveLegacyIE
+from .dplay import DPlayIE
from ..compat import (
compat_parse_qs,
compat_urlparse,
@@ -12,8 +12,13 @@ from ..compat import (
from ..utils import smuggle_url
-class DiscoveryNetworksDeIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?(?:discovery|tlc|animalplanet|dmax)\.de/(?:.*#(?P<id>\d+)|(?:[^/]+/)*videos/(?P<title>[^/?#]+))'
+class DiscoveryNetworksDeIE(DPlayIE):
+ _VALID_URL = r'''(?x)https?://(?:www\.)?(?P<site>discovery|tlc|animalplanet|dmax)\.de/
+ (?:
+ .*\#(?P<id>\d+)|
+ (?:[^/]+/)*videos/(?P<display_id>[^/?#]+)|
+ programme/(?P<programme>[^/]+)/video/(?P<alternate_id>[^/]+)
+ )'''
_TESTS = [{
'url': 'http://www.tlc.de/sendungen/breaking-amish/videos/#3235167922001',
@@ -40,6 +45,14 @@ class DiscoveryNetworksDeIE(InfoExtractor):
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
+ alternate_id = mobj.group('alternate_id')
+ if alternate_id:
+ self._initialize_geo_bypass({
+ 'countries': ['DE'],
+ })
+ return self._get_disco_api_info(
+ url, '%s/%s' % (mobj.group('programme'), alternate_id),
+ 'sonic-eu1-prod.disco-api.com', mobj.group('site') + 'de')
brightcove_id = mobj.group('id')
if not brightcove_id:
title = mobj.group('title')