]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[ustream] Add UstreamIE._extract_url()
authorYen Chi Hsuan <yan12125@gmail.com>
Fri, 20 Jan 2017 13:59:24 +0000 (21:59 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Fri, 20 Jan 2017 14:27:13 +0000 (22:27 +0800)
Ref: #11547

youtube_dl/extractor/generic.py
youtube_dl/extractor/ustream.py

index 154545df7aa3fdd738d7aab585265810ddd2d245..a7c1048457ce0396e34de077a9e0fb851feaf9a2 100644 (file)
@@ -79,6 +79,7 @@ from .dbtv import DBTVIE
 from .piksel import PikselIE
 from .videa import VideaIE
 from .twentymin import TwentyMinutenIE
+from .ustream import UstreamIE
 
 
 class GenericIE(InfoExtractor):
@@ -2112,10 +2113,9 @@ class GenericIE(InfoExtractor):
             return self.url_result(mobj.group('url'), 'TED')
 
         # Look for embedded Ustream videos
-        mobj = re.search(
-            r'<iframe[^>]+?src=(["\'])(?P<url>http://www\.ustream\.tv/embed/.+?)\1', webpage)
-        if mobj is not None:
-            return self.url_result(mobj.group('url'), 'Ustream')
+        ustream_url = UstreamIE._extract_url(webpage)
+        if ustream_url:
+            return self.url_result(ustream_url, UstreamIE.ie_key())
 
         # Look for embedded arte.tv player
         mobj = re.search(
index 0c06bf36bd5f76cabecc47e699ad56a45ba63a4a..5737d4d16c853193f5beb08b2eff7126c6be3d3c 100644 (file)
@@ -69,6 +69,13 @@ class UstreamIE(InfoExtractor):
         },
     }]
 
+    @staticmethod
+    def _extract_url(webpage):
+        mobj = re.search(
+            r'<iframe[^>]+?src=(["\'])(?P<url>http://www\.ustream\.tv/embed/.+?)\1', webpage)
+        if mobj is not None:
+            return mobj.group('url')
+
     def _get_stream_info(self, url, video_id, app_id_ver, extra_note=None):
         def num_to_hex(n):
             return hex(n)[2:]