aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/youporn.py
diff options
context:
space:
mode:
authorrzhxeo <rzhxeo@users.noreply.github.com>2013-08-28 16:04:48 +0200
committerrzhxeo <rzhxeo@users.noreply.github.com>2013-08-28 16:04:48 +0200
commit878e83c5a4c84c7abbf3484366e76fbe906c8947 (patch)
treee09dcff4b36d6e3356ae33d3eeb2fdcbf7b1f030 /youtube_dl/extractor/youporn.py
parent0012690aae977d76e9162e2334989498366a8e94 (diff)
downloadyoutube-dl-878e83c5a4c84c7abbf3484366e76fbe906c8947.tar.xz
YoupornIE: Clean up extraction of hd video
Diffstat (limited to 'youtube_dl/extractor/youporn.py')
-rw-r--r--youtube_dl/extractor/youporn.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/youtube_dl/extractor/youporn.py b/youtube_dl/extractor/youporn.py
index 19360e273..c85fd4b5a 100644
--- a/youtube_dl/extractor/youporn.py
+++ b/youtube_dl/extractor/youporn.py
@@ -5,7 +5,6 @@ import sys
from .common import InfoExtractor
from ..utils import (
- compat_str,
compat_urllib_parse_urlparse,
compat_urllib_request,
@@ -79,14 +78,11 @@ class YouPornIE(InfoExtractor):
LINK_RE = r'(?s)<a href="(?P<url>[^"]+)">'
links = re.findall(LINK_RE, download_list_html)
- # Get link of hd video
- 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 = 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
+ # Get link of hd video if available
+ mobj = re.search(r'var encryptedQuality720URL = \'(?P<encrypted_video_url>[a-zA-Z0-9+/]+={0,2})\';', webpage)
+ if mobj != None:
+ encrypted_video_url = mobj.group(u'encrypted_video_url')
+ video_url = aes_decrypt_text(encrypted_video_url, video_title, 32).decode('utf-8')
links = [video_url] + links
if not links: