[quickscope] Add extractor
authorSergey M․ <dstftw@gmail.com>
Fri, 7 Aug 2015 23:37:38 +0000 (05:37 +0600)
committerSergey M․ <dstftw@gmail.com>
Fri, 7 Aug 2015 23:37:38 +0000 (05:37 +0600)
youtube_dl/extractor/__init__.py
youtube_dl/extractor/periscope.py

index bd86a5be2df422d38db6a473fb14b4397f7f8052..e38e77a278236a61654410837e2b64798f4b261d 100644 (file)
@@ -432,7 +432,10 @@ from .orf import (
 from .parliamentliveuk import ParliamentLiveUKIE
 from .patreon import PatreonIE
 from .pbs import PBSIE
-from .periscope import PeriscopeIE
+from .periscope import (
+    PeriscopeIE,
+    QuickscopeIE,
+)
 from .philharmoniedeparis import PhilharmonieDeParisIE
 from .phoenix import PhoenixIE
 from .photobucket import PhotobucketIE
index de53b752d124ad64d173bcbf02e31e86517dc3a8..578b53a2452fe3df58144efc4f064508b1df06dc 100644 (file)
@@ -76,3 +76,24 @@ class PeriscopeIE(InfoExtractor):
             'thumbnails': thumbnails,
             'formats': formats,
         }
+
+
+class QuickscopeIE(InfoExtractor):
+    IE_DESC = 'Quisck Scope'
+    _VALID_URL = r'https?://watchonperiscope\.com/broadcast/(?P<id>\d+)'
+    _TEST = {
+        'url': 'https://watchonperiscope.com/broadcast/56180087',
+        'only_matching': True,
+    }
+
+    def _real_extract(self, url):
+        broadcast_id = self._match_id(url)
+        request = compat_urllib_request.Request(
+            'https://watchonperiscope.com/api/accessChannel', compat_urllib_parse.urlencode({
+                'broadcast_id': broadcast_id,
+                'entry_ticket': '',
+                'from_push': 'false',
+                'uses_sessions': 'true',
+            }).encode('utf-8'))
+        return self.url_result(
+            self._download_json(request, broadcast_id)['share_url'], 'Periscope')