aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2018-01-26 23:56:31 +0700
committerSergey M․ <dstftw@gmail.com>2018-01-26 23:56:31 +0700
commita0ee342b50f8fac4663a1d4d3822f5879caf398a (patch)
tree4b2d4d04eaca61c94d7939e9f7b13b651070f618 /youtube_dl/extractor
parent864a4576b70bfe9abc3c4f72b0b5e8173b686875 (diff)
[dplay] Bypass geo restriction
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/dplay.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/youtube_dl/extractor/dplay.py b/youtube_dl/extractor/dplay.py
index 2840636e5..a08dace43 100644
--- a/youtube_dl/extractor/dplay.py
+++ b/youtube_dl/extractor/dplay.py
@@ -26,7 +26,7 @@ from ..utils import (
class DPlayIE(InfoExtractor):
- _VALID_URL = r'https?://(?P<domain>www\.(?P<host>dplay\.(?:dk|se|no)))/(?:videoer/)?(?P<id>[^/]+/[^/?#]+)'
+ _VALID_URL = r'https?://(?P<domain>www\.(?P<host>dplay\.(?P<country>dk|se|no)))/(?:videoer/)?(?P<id>[^/]+/[^/?#]+)'
_TESTS = [{
# non geo restricted, via secure api, unsigned download hls URL
@@ -88,6 +88,10 @@ class DPlayIE(InfoExtractor):
'format': 'bestvideo',
'skip_download': True,
},
+ }, {
+ # geo restricted, bypassable via X-Forwarded-For
+ 'url': 'https://www.dplay.dk/videoer/singleliv/season-5-episode-3',
+ 'only_matching': True,
}]
def _real_extract(self, url):
@@ -95,6 +99,8 @@ class DPlayIE(InfoExtractor):
display_id = mobj.group('id')
domain = mobj.group('domain')
+ self._initialize_geo_bypass([mobj.group('country').upper()])
+
webpage = self._download_webpage(url, display_id)
video_id = self._search_regex(