X-Git-Url: https://git.rapsys.eu/youtubedl/blobdiff_plain/6d835d4d6903cf5e18ad01844736929e06d16004..620b803afb94df95e3761acf1e764a9eb3a4b00c:/youtube_dl/extractor/youporn.py?ds=sidebyside diff --git a/youtube_dl/extractor/youporn.py b/youtube_dl/extractor/youporn.py index 7bfda45..107c9ac 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,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'var currentVideo = new Video\((.*)\)[,;]', + webpage, 'JSON parameters') try: params = json.loads(json_params) except: - raise ExtractorError(u'Invalid JSON') + raise ExtractorError('Invalid JSON') self.report_extraction(video_id) try: @@ -64,7 +67,7 @@ class YouPornIE(InfoExtractor): # Get all of the links from the page DOWNLOAD_LIST_RE = r'(?s)' download_list_html = self._search_regex(DOWNLOAD_LIST_RE, - webpage, 'download list').strip() + webpage, 'download list').strip() LINK_RE = r'' links = re.findall(LINK_RE, download_list_html) @@ -73,7 +76,7 @@ class YouPornIE(InfoExtractor): for encrypted_link in encrypted_links: link = aes_decrypt_text(encrypted_link, video_title, 32).decode('utf-8') links.append(link) - + formats = [] for link in links: # A link looks like this: @@ -103,8 +106,8 @@ class YouPornIE(InfoExtractor): self._sort_formats(formats) if not formats: - raise ExtractorError(u'ERROR: no known formats available for video') - + raise ExtractorError('ERROR: no known formats available for video') + return { 'id': video_id, 'uploader': video_uploader,