X-Git-Url: https://git.rapsys.eu/youtubedl/blobdiff_plain/15b1d10671b48df598afd70e17ba21e9e64ac766..67afe88251ff8b1fcb43246c9a4bb1a0ea0185a2:/youtube_dl/extractor/youporn.py diff --git a/youtube_dl/extractor/youporn.py b/youtube_dl/extractor/youporn.py index 8123928..4ba7c36 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,10 +46,13 @@ 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: + except ValueError: raise ExtractorError('Invalid JSON') self.report_extraction(video_id)