[periscope] Add another fallback source
authorSergey M․ <dstftw@gmail.com>
Fri, 1 Jul 2016 18:35:57 +0000 (01:35 +0700)
committerSergey M․ <dstftw@gmail.com>
Fri, 1 Jul 2016 18:35:57 +0000 (01:35 +0700)
youtube_dl/extractor/periscope.py

index 34e0d3d30f73c38d13e30886393210a05ee8a389..75f5884a928cff177bdabfb3db430ed282d0a7a8 100644 (file)
@@ -120,9 +120,12 @@ class PeriscopeUserIE(InfoExtractor):
         title = user.get('display_name') or user.get('username')
         description = user.get('description')
 
+        broadcast_ids = (data_store.get('UserBroadcastHistory', {}).get('broadcastIds') or
+                         data_store.get('BroadcastCache', {}).get('broadcastIds', []))
+
         entries = [
             self.url_result(
-                'https://www.periscope.tv/%s/%s' % (user_id, broadcast))
-            for broadcast in data_store.get('UserBroadcastHistory', {}).get('broadcastIds', [])]
+                'https://www.periscope.tv/%s/%s' % (user_id, broadcast_id))
+            for broadcast_id in broadcast_ids]
 
         return self.playlist_result(entries, user_id, title, description)