]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[pornhub] Add support for embeds
authorSergey M․ <dstftw@gmail.com>
Fri, 12 Jun 2015 21:24:36 +0000 (03:24 +0600)
committerSergey M․ <dstftw@gmail.com>
Fri, 12 Jun 2015 21:24:36 +0000 (03:24 +0600)
youtube_dl/extractor/pornhub.py

index daa284ea28be63f9677471f16a0b8102f32b560e..3c99b4def0b4c3d609b6aad398d38f7e6def9daa 100644 (file)
@@ -19,7 +19,7 @@ from ..aes import (
 
 
 class PornHubIE(InfoExtractor):
-    _VALID_URL = r'https?://(?:www\.)?pornhub\.com/view_video\.php\?viewkey=(?P<id>[0-9a-f]+)'
+    _VALID_URL = r'https?://(?:www\.)?pornhub\.com/(?:view_video\.php\?viewkey=|embed/)(?P<id>[0-9a-f]+)'
     _TEST = {
         'url': 'http://www.pornhub.com/view_video.php?viewkey=648719015',
         'md5': '882f488fa1f0026f023f33576004a2ed',
@@ -39,7 +39,8 @@ class PornHubIE(InfoExtractor):
     def _real_extract(self, url):
         video_id = self._match_id(url)
 
-        req = compat_urllib_request.Request(url)
+        req = compat_urllib_request.Request(
+            'http://www.pornhub.com/view_video.php?viewkey=%s' % video_id)
         req.add_header('Cookie', 'age_verified=1')
         webpage = self._download_webpage(req, video_id)