[generic] Add support for channel9 embeds (closes #14469)
authorSergey M․ <dstftw@gmail.com>
Wed, 11 Oct 2017 14:59:30 +0000 (21:59 +0700)
committerSergey M․ <dstftw@gmail.com>
Wed, 11 Oct 2017 14:59:30 +0000 (21:59 +0700)
youtube_dl/extractor/channel9.py
youtube_dl/extractor/generic.py

index e928942465fbae45a0854172b90987ee65b355a0..81108e70424f5a98bc97dcdb2ee9b11c6869ed08 100644 (file)
@@ -81,6 +81,12 @@ class Channel9IE(InfoExtractor):
 
     _RSS_URL = 'http://channel9.msdn.com/%s/RSS'
 
+    @staticmethod
+    def _extract_urls(webpage):
+        return re.findall(
+            r'<iframe[^>]+src=["\'](https?://channel9\.msdn\.com/(?:[^/]+/)+)player\b',
+            webpage)
+
     def _extract_list(self, video_id, rss_url=None):
         if not rss_url:
             rss_url = self._RSS_URL % video_id
index 68b6338396dc84277792273db277154fe3cc4995..6dab4c7f43d3a35a148029483dffffc070bd3454 100644 (file)
@@ -101,6 +101,7 @@ from .mediaset import MediasetIE
 from .joj import JojIE
 from .megaphone import MegaphoneIE
 from .vzaar import VzaarIE
+from .channel9 import Channel9IE
 
 
 class GenericIE(InfoExtractor):
@@ -2871,6 +2872,11 @@ class GenericIE(InfoExtractor):
             return self.playlist_from_matches(
                 vzaar_urls, video_id, video_title, ie=VzaarIE.ie_key())
 
+        channel9_urls = Channel9IE._extract_urls(webpage)
+        if channel9_urls:
+            return self.playlist_from_matches(
+                channel9_urls, video_id, video_title, ie=Channel9IE.ie_key())
+
         def merge_dicts(dict1, dict2):
             merged = {}
             for k, v in dict1.items():