X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=youtube_dl%2Fextractor%2Fyouporn.py;h=4ba7c36db78fb457b63e05fe161a75b00383c78c;hb=47c165c3a9f40dd9a175b11f29f9e2002fdda8a9;hp=7bfda45e76e0d4ca3b6bfd6c3a8ec9f38de453e1;hpb=0003a5c4163df6b5a7fd90ec256ea7497f639dda;p=youtube-dl.git diff --git a/youtube_dl/extractor/youporn.py b/youtube_dl/extractor/youporn.py index 7bfda45e7..4ba7c36db 100644 --- a/youtube_dl/extractor/youporn.py +++ b/youtube_dl/extractor/youporn.py @@ -6,10 +6,11 @@ import re import sys from .common import InfoExtractor -from ..utils import ( +from ..compat import ( compat_urllib_parse_urlparse, compat_urllib_request, - +) +from ..utils import ( ExtractorError, unescapeHTML, unified_strdate, @@ -45,11 +46,14 @@ class YouPornIE(InfoExtractor): age_limit = self._rta_search(webpage) # Get JSON parameters - json_params = self._search_regex(r'var currentVideo = new Video\((.*)\);', webpage, 'JSON parameters') + json_params = self._search_regex( + [r'videoJa?son\s*=\s*({.+})', + r'var\s+currentVideo\s*=\s*new\s+Video\((.+?)\)[,;]'], + webpage, 'JSON parameters') try: params = json.loads(json_params) - except: - raise ExtractorError(u'Invalid JSON') + except ValueError: + raise ExtractorError('Invalid JSON') self.report_extraction(video_id) try: @@ -64,7 +68,7 @@ class YouPornIE(InfoExtractor): # Get all of the links from the page DOWNLOAD_LIST_RE = r'(?s)