]> gitweb @ CieloNegro.org - youtube-dl.git/blobdiff - youtube_dl/extractor/periscope.py
[twitter] Support Periscope embeds (closes #10737)
[youtube-dl.git] / youtube_dl / extractor / periscope.py
index eb1aeba46848cee3ea652c01b284ff44fe25292e..e8b2f11c6b2e0bd7842ef4c026e2dbb3cd76bcbf 100644 (file)
@@ -1,6 +1,8 @@
 # coding: utf-8
 from __future__ import unicode_literals
 
+import re
+
 from .common import InfoExtractor
 from ..utils import (
     parse_iso8601,
@@ -41,6 +43,13 @@ class PeriscopeIE(PeriscopeBaseIE):
         'only_matching': True,
     }]
 
+    @staticmethod
+    def _extract_url(webpage):
+        mobj = re.search(
+            r'<iframe[^>]+src=([\'"])(?P<url>(?:https?:)?//(?:www\.)?periscope\.tv/(?:(?!\1).)+)\1', webpage)
+        if mobj:
+            return mobj.group('url')
+
     def _real_extract(self, url):
         token = self._match_id(url)