aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/youporn.py
diff options
context:
space:
mode:
authorIsmael Mejia <iemejia@gmail.com>2013-09-06 23:23:23 +0200
committerIsmael Mejia <iemejia@gmail.com>2013-09-06 23:24:41 +0200
commit72836fcee453386f4f16325c5b8fa4c1ba1bb442 (patch)
tree58efd36f4a56269a07774969e2ac385aacf8eae6 /youtube_dl/extractor/youporn.py
parentd6e203b3dcef8f291b57021903e629d3e30e1f0b (diff)
parenta7130543fa0368175740f5fa173ef920671db866 (diff)
Merge branch 'master' into subtitles_rework
Diffstat (limited to 'youtube_dl/extractor/youporn.py')
-rw-r--r--youtube_dl/extractor/youporn.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/youtube_dl/extractor/youporn.py b/youtube_dl/extractor/youporn.py
index d1156bf42..c85fd4b5a 100644
--- a/youtube_dl/extractor/youporn.py
+++ b/youtube_dl/extractor/youporn.py
@@ -12,14 +12,16 @@ from ..utils import (
unescapeHTML,
unified_strdate,
)
-
+from ..aes import (
+ aes_decrypt_text
+)
class YouPornIE(InfoExtractor):
_VALID_URL = r'^(?:https?://)?(?:\w+\.)?youporn\.com/watch/(?P<videoid>[0-9]+)/(?P<title>[^/]+)'
_TEST = {
u'url': u'http://www.youporn.com/watch/505835/sex-ed-is-it-safe-to-masturbate-daily/',
u'file': u'505835.mp4',
- u'md5': u'c37ddbaaa39058c76a7e86c6813423c1',
+ u'md5': u'71ec5fcfddacf80f495efa8b6a8d9a89',
u'info_dict': {
u"upload_date": u"20101221",
u"description": u"Love & Sex Answers: http://bit.ly/DanAndJenn -- Is It Unhealthy To Masturbate Daily?",
@@ -75,7 +77,15 @@ class YouPornIE(InfoExtractor):
# Get all of the links from the page
LINK_RE = r'(?s)<a href="(?P<url>[^"]+)">'
links = re.findall(LINK_RE, download_list_html)
- if(len(links) == 0):
+
+ # 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:
raise ExtractorError(u'ERROR: no known formats available for video')
self.to_screen(u'Links found: %d' % len(links))
@@ -112,7 +122,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':