]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[brightcove:legacy] fall back to brightcove:new(#13912)
authorRemita Amine <remitamine@gmail.com>
Mon, 15 Oct 2018 16:54:38 +0000 (17:54 +0100)
committerRemita Amine <remitamine@gmail.com>
Mon, 15 Oct 2018 16:54:38 +0000 (17:54 +0100)
youtube_dl/extractor/brightcove.py

index 14f9a14edf417d996fa1cbe3c80bcd06f2ee9ef0..5dbd71e1263bc31edc0e7d50a0eb3b9d22249dd1 100644 (file)
@@ -356,7 +356,9 @@ class BrightcoveLegacyIE(InfoExtractor):
 
     def _extract_video_info(self, video_info):
         video_id = compat_str(video_info['id'])
+
         publisher_id = video_info.get('publisherId')
+
         info = {
             'id': video_id,
             'title': video_info['displayName'].strip(),
@@ -444,8 +446,16 @@ class BrightcoveLegacyIE(InfoExtractor):
                 else:
                     return ad_info
 
-        if 'url' not in info and not info.get('formats'):
-            raise ExtractorError('Unable to extract video url for %s' % video_id)
+        if not info.get('url') and not info.get('formats'):
+            uploader_id = info.get('uploader_id')
+            if uploader_id:
+                info.update({
+                    '_type': 'url',
+                    'url': 'http://players.brightcove.net/%s/default_default/index.html?videoId=%s' % (uploader_id, video_id),
+                    'ie_key': BrightcoveNewIE.ie_key(),
+                })
+            else:
+                raise ExtractorError('Unable to extract video url for %s' % video_id)
         return info