X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=youtube_dl%2Fextractor%2Fyouporn.py;h=6abe72f739b63d8b39d8cdfc5bfccf70dc545715;hb=3220c50f9af3a1df239656025aebfe00fec00e45;hp=ee61e2381c204c7bf73fd1ee434387e98375201b;hpb=784b6d3a9bc79fe55a8b132fd10555c1e9a61c31;p=youtube-dl.git diff --git a/youtube_dl/extractor/youporn.py b/youtube_dl/extractor/youporn.py index ee61e2381..6abe72f73 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'var\s+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)