[extractor/generic:3qsdn] Add support for embeds
authorSergey M․ <dstftw@gmail.com>
Sat, 14 May 2016 17:40:34 +0000 (23:40 +0600)
committerSergey M․ <dstftw@gmail.com>
Sat, 14 May 2016 17:40:34 +0000 (23:40 +0600)
youtube_dl/extractor/generic.py
youtube_dl/extractor/threeqsdn.py

index 0f1eb7fa64dbf64b32000fd05ea6b65bb8ea502a..b48ccfc97ba2ca1fae72704cf09d81c807166f08 100644 (file)
@@ -61,6 +61,7 @@ from .jwplatform import JWPlatformIE
 from .digiteka import DigitekaIE
 from .instagram import InstagramIE
 from .liveleak import LiveLeakIE
+from .threeqsdn import ThreeQSDNIE
 
 
 class GenericIE(InfoExtractor):
@@ -1983,6 +1984,11 @@ class GenericIE(InfoExtractor):
         if liveleak_url:
             return self.url_result(liveleak_url, 'LiveLeak')
 
+        # Look for 3Q SDN embeds
+        threeqsdn_url = ThreeQSDNIE._extract_url(webpage)
+        if threeqsdn_url:
+            return self.url_result(self._proto_relative_url(threeqsdn_url), ThreeQSDNIE.ie_key())
+
         def check_video(vurl):
             if YoutubeIE.suitable(vurl):
                 return True
index 27a3de5c45dc7db709a504009865efbf3a813fbf..c77a07989a97629a715a3b164b06c60151f71a3e 100644 (file)
@@ -56,6 +56,13 @@ class ThreeQSDNIE(InfoExtractor):
         'only_matching': True,
     }]
 
+    @staticmethod
+    def _extract_url(webpage):
+        mobj = re.search(
+            r'<iframe[^>]+\b(?:data-)?src=(["\'])(?P<url>%s.*?)\1' % ThreeQSDNIE._VALID_URL, webpage)
+        if mobj:
+            return mobj.group('url')
+
     def _real_extract(self, url):
         video_id = self._match_id(url)