diff options
author | rzhxeo <rzhxeo@users.noreply.github.com> | 2013-08-28 06:23:33 -0700 |
---|---|---|
committer | rzhxeo <rzhxeo@users.noreply.github.com> | 2013-08-28 06:23:33 -0700 |
commit | 550bfd4cbd1236fdb02abf99a81fc52a2680a8dc (patch) | |
tree | 75d630414b74239c34ef3d6abae61ad0a99e18f1 /youtube_dl/extractor/youporn.py | |
parent | 97b3656c2e37e45d556816b8f1f15c20d14f1acd (diff) | |
parent | 48ea9cea77e7ea24ee867027f03ca37dd1b935d8 (diff) | |
download | youtube-dl-550bfd4cbd1236fdb02abf99a81fc52a2680a8dc.tar.xz |
Merge pull request #1 from phihag/youporn-hd-pr
Allow changes to run under Python 3
Diffstat (limited to 'youtube_dl/extractor/youporn.py')
-rw-r--r-- | youtube_dl/extractor/youporn.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/youtube_dl/extractor/youporn.py b/youtube_dl/extractor/youporn.py index cc9c37027..19360e273 100644 --- a/youtube_dl/extractor/youporn.py +++ b/youtube_dl/extractor/youporn.py @@ -5,6 +5,7 @@ import sys from .common import InfoExtractor from ..utils import ( + compat_str, compat_urllib_parse_urlparse, compat_urllib_request, @@ -79,13 +80,16 @@ class YouPornIE(InfoExtractor): links = re.findall(LINK_RE, download_list_html) # Get link of hd video - encrypted_video_url = self._html_search_regex(r'var encryptedURL = \'(?P<encrypted_video_url>[a-zA-Z0-9+/]+={0,2})\';', + encrypted_video_url = self._html_search_regex( + r'var encrypted(?:Quality[0-9]+)?URL = \'(?P<encrypted_video_url>[a-zA-Z0-9+/]+={0,2})\';', webpage, u'encrypted_video_url') - video_url = unicode( aes_decrypt_text(encrypted_video_url, video_title, 32), 'utf-8') + video_url = aes_decrypt_text(encrypted_video_url, video_title, 32) + print(video_url) + assert isinstance(video_url, compat_str) if video_url.split('/')[6].split('_')[0] == u'720p': # only add if 720p to avoid duplicates links = [video_url] + links - if(len(links) == 0): + if not links: raise ExtractorError(u'ERROR: no known formats available for video') self.to_screen(u'Links found: %d' % len(links)) @@ -122,7 +126,7 @@ class YouPornIE(InfoExtractor): self._print_formats(formats) return - req_format = self._downloader.params.get('format', None) + req_format = self._downloader.params.get('format', 'best') self.to_screen(u'Format: %s' % req_format) if req_format is None or req_format == 'best': |