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

index 40d869c534759453ada54dce010b0705538b25c0..f683760e4b9ca6e20644b3c98b246a3d9a2a6c72 100644 (file)
@@ -42,6 +42,7 @@ from .udn import UDNEmbedIE
 from .senateisvp import SenateISVPIE
 from .bliptv import BlipTVIE
 from .svt import SVTIE
+from .pornhub import PornHubIE
 
 
 class GenericIE(InfoExtractor):
@@ -1321,6 +1322,10 @@ class GenericIE(InfoExtractor):
         if sportbox_urls:
             return _playlist_from_matches(sportbox_urls, ie='SportBoxEmbed')
 
+        pornhub_url = PornHubIE._extract_url(webpage)
+        if pornhub_url:
+            return self.url_result(pornhub_url, 'PornHub')
+
         # Look for embedded Tvigle player
         mobj = re.search(
             r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//cloud\.tvigle\.ru/video/.+?)\1', webpage)
index 3c99b4def0b4c3d609b6aad398d38f7e6def9daa..8565d7551df4c6453e400abb09316433d0b97fcd 100644 (file)
@@ -32,6 +32,13 @@ class PornHubIE(InfoExtractor):
         }
     }
 
+    @classmethod
+    def _extract_url(cls, webpage):
+        mobj = re.search(
+            r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?pornhub\.com/embed/\d+)\1', webpage)
+        if mobj:
+            return mobj.group('url')
+
     def _extract_count(self, pattern, webpage, name):
         return str_to_int(self._search_regex(
             pattern, webpage, '%s count' % name, fatal=False))