diff options
author | remitamine <remitamine@gmail.com> | 2015-12-03 20:05:11 +0100 |
---|---|---|
committer | remitamine <remitamine@gmail.com> | 2015-12-03 20:05:11 +0100 |
commit | 640bb54e73779f4a941eae1f17e4be049ca575db (patch) | |
tree | ba0c50db3ad5bb0932a56cda66d4f386b145bb22 /youtube_dl/extractor/dumpert.py | |
parent | 497f5fd93fe1efd0df8dc58d518c328ed1409457 (diff) | |
parent | e0977d7686e5df524b1a024484e7a4bb9cfa261d (diff) |
Merge branch 'master' of https://github.com/rg3/youtube-dl into bilibili
Diffstat (limited to 'youtube_dl/extractor/dumpert.py')
-rw-r--r-- | youtube_dl/extractor/dumpert.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/youtube_dl/extractor/dumpert.py b/youtube_dl/extractor/dumpert.py index 1f00386fe..e5aadcd25 100644 --- a/youtube_dl/extractor/dumpert.py +++ b/youtube_dl/extractor/dumpert.py @@ -2,14 +2,17 @@ from __future__ import unicode_literals import base64 +import re from .common import InfoExtractor -from ..compat import compat_urllib_request -from ..utils import qualities +from ..utils import ( + qualities, + sanitized_Request, +) class DumpertIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?dumpert\.nl/(?:mediabase|embed)/(?P<id>[0-9]+/[0-9a-zA-Z]+)' + _VALID_URL = r'(?P<protocol>https?)://(?:www\.)?dumpert\.nl/(?:mediabase|embed)/(?P<id>[0-9]+/[0-9a-zA-Z]+)' _TESTS = [{ 'url': 'http://www.dumpert.nl/mediabase/6646981/951bc60f/', 'md5': '1b9318d7d5054e7dcb9dc7654f21d643', @@ -26,10 +29,12 @@ class DumpertIE(InfoExtractor): }] def _real_extract(self, url): - video_id = self._match_id(url) + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('id') + protocol = mobj.group('protocol') - url = 'https://www.dumpert.nl/mediabase/' + video_id - req = compat_urllib_request.Request(url) + url = '%s://www.dumpert.nl/mediabase/%s' % (protocol, video_id) + req = sanitized_Request(url) req.add_header('Cookie', 'nsfw=1; cpc=10') webpage = self._download_webpage(req, video_id) |