[brightcove] Add support for renditions with 'remote' set to True (fixes #3081)

The url needs to be modified to get the flv video.
This commit is contained in:
Jaime Marquínez Ferrándiz 2014-06-15 11:20:40 +02:00
parent a013eba65f
commit 5524b242a7

View file

@ -15,6 +15,7 @@ from ..utils import (
compat_urllib_request, compat_urllib_request,
compat_parse_qs, compat_parse_qs,
determine_ext,
ExtractorError, ExtractorError,
unsmuggle_url, unsmuggle_url,
unescapeHTML, unescapeHTML,
@ -70,7 +71,20 @@ class BrightcoveIE(InfoExtractor):
'description': 'md5:363109c02998fee92ec02211bd8000df', 'description': 'md5:363109c02998fee92ec02211bd8000df',
'uploader': 'National Ballet of Canada', 'uploader': 'National Ballet of Canada',
}, },
} },
{
# test flv videos served by akamaihd.net
# From http://www.redbull.com/en/bike/stories/1331655643987/replay-uci-dh-world-cup-2014-from-fort-william
'url': 'http://c.brightcove.com/services/viewer/htmlFederated?%40videoPlayer=ref%3ABC2996102916001&linkBaseURL=http%3A%2F%2Fwww.redbull.com%2Fen%2Fbike%2Fvideos%2F1331655630249%2Freplay-uci-fort-william-2014-dh&playerKey=AQ%7E%7E%2CAAAApYJ7UqE%7E%2Cxqr_zXk0I-zzNndy8NlHogrCb5QdyZRf&playerID=1398061561001#__youtubedl_smuggle=%7B%22Referer%22%3A+%22http%3A%2F%2Fwww.redbull.com%2Fen%2Fbike%2Fstories%2F1331655643987%2Freplay-uci-dh-world-cup-2014-from-fort-william%22%7D',
# The md5 checksum changes on each download
'info_dict': {
'id': '2996102916001',
'ext': 'flv',
'title': 'UCI MTB World Cup 2014: Fort William, UK - Downhill Finals',
'uploader': 'Red Bull TV',
'description': 'UCI MTB World Cup 2014: Fort William, UK - Downhill Finals',
},
},
] ]
@classmethod @classmethod
@ -220,11 +234,23 @@ class BrightcoveIE(InfoExtractor):
renditions = video_info.get('renditions') renditions = video_info.get('renditions')
if renditions: if renditions:
renditions = sorted(renditions, key=lambda r: r['size']) renditions = sorted(renditions, key=lambda r: r['size'])
info['formats'] = [{ formats = []
'url': rend['defaultURL'], for rend in renditions:
'height': rend.get('frameHeight'), url = rend['defaultURL']
'width': rend.get('frameWidth'), if rend['remote']:
} for rend in renditions] # This type of renditions are served through akamaihd.net,
# but they don't use f4m manifests
url = url.replace('control/', '') + '?&v=3.3.0&fp=13&r=FEEFJ&g=RTSJIMBMPFPB'
ext = 'flv'
else:
ext = determine_ext(url)
formats.append({
'url': url,
'ext': ext,
'height': rend.get('frameHeight'),
'width': rend.get('frameWidth'),
})
info['formats'] = formats
elif video_info.get('FLVFullLengthURL') is not None: elif video_info.get('FLVFullLengthURL') is not None:
info.update({ info.update({
'url': video_info['FLVFullLengthURL'], 'url': video_info['FLVFullLengthURL'],