[extractor/generic] Add support for svt embeds (Closes #5622)
authorSergey M․ <dstftw@gmail.com>
Fri, 8 May 2015 18:23:35 +0000 (00:23 +0600)
committerSergey M․ <dstftw@gmail.com>
Fri, 8 May 2015 18:23:35 +0000 (00:23 +0600)
youtube_dl/extractor/generic.py
youtube_dl/extractor/svt.py

index cd7c47d6d1801ef2468d789215f0f5f0b438565e..046bcb0f040531d55f86a2dbe72e541f8a24d039 100644 (file)
@@ -37,6 +37,7 @@ from .condenast import CondeNastIE
 from .udn import UDNEmbedIE
 from .senateisvp import SenateISVPIE
 from .bliptv import BlipTVIE
+from .svt import SVTIE
 
 
 class GenericIE(InfoExtractor):
@@ -1091,6 +1092,11 @@ class GenericIE(InfoExtractor):
         if bliptv_url:
             return self.url_result(bliptv_url, 'BlipTV')
 
+        # Look for SVT player
+        svt_url = SVTIE._extract_url(webpage)
+        if svt_url:
+            return self.url_result(svt_url, 'SVT')
+
         # Look for embedded condenast player
         matches = re.findall(
             r'<iframe\s+(?:[a-zA-Z-]+="[^"]+"\s+)*?src="(https?://player\.cnevids\.com/embed/[^"]+")',
index 732f0204815a9964c5ba96c9d4597df60f37b270..fc20f664b7f4e1e6267e5cbad7a191e723e204e3 100644 (file)
@@ -64,6 +64,13 @@ class SVTIE(SVTBaseIE):
         },
     }
 
+    @staticmethod
+    def _extract_url(webpage):
+        mobj = re.search(
+            r'(?:<iframe src|href)="(?P<url>%s[^"]*)"' % SVTIE._VALID_URL, webpage)
+        if mobj:
+            return mobj.group('url')
+
     def _real_extract(self, url):
         mobj = re.match(self._VALID_URL, url)
         widget_id = mobj.group('widget_id')