X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fshared.py;h=9f3e944e73532a92c5213ce95e7633fe6bc4c212;hb=b5597738d4de35fd6f2be7bf1cb6a32c754d873f;hp=8607482be8b318fa2772fcb3cd882c9359f50cf9;hpb=916c1452178c68bc7133b84f1538d19d5a7db17e;p=youtube-dl diff --git a/youtube_dl/extractor/shared.py b/youtube_dl/extractor/shared.py index 8607482be..9f3e944e7 100644 --- a/youtube_dl/extractor/shared.py +++ b/youtube_dl/extractor/shared.py @@ -4,10 +4,12 @@ import re import base64 from .common import InfoExtractor +from ..compat import ( + compat_urllib_parse, + compat_urllib_request, +) from ..utils import ( ExtractorError, - compat_urllib_request, - compat_urllib_parse, int_or_none, ) @@ -17,35 +19,39 @@ class SharedIE(InfoExtractor): _TEST = { 'url': 'http://shared.sx/0060718775', - 'md5': '53e1c58fc3e777ae1dfe9e57ba2f9c72', + 'md5': '106fefed92a8a2adb8c98e6a0652f49b', 'info_dict': { 'id': '0060718775', 'ext': 'mp4', - 'title': 'Big Buck Bunny Trailer', + 'title': 'Bmp4', }, } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) - video_id = mobj.group('id') - - page = self._download_webpage(url, video_id) - - if re.search(r'>File does not exist<', page) is not None: - raise ExtractorError('Video %s does not exist' % video_id, expected=True) + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) - download_form = dict(re.findall(r'File does not exist<' in webpage: + raise ExtractorError( + 'Video %s does not exist' % video_id, expected=True) - request = compat_urllib_request.Request(url, compat_urllib_parse.urlencode(download_form)) + download_form = dict(re.findall( + r'