[kaltura] Support 'applehttp' containerFormat

This patch adds support for Kaltura video flavors with the
containerFormat 'applehttp'. In this case, the data returned from the url
is an m3u8 file which can subsequently be downloaded normally. This is
what AbcGo uses for its content.
This commit is contained in:
Mike Ruprecht 2016-05-04 01:07:08 -05:00
parent bc7e77a04b
commit 6d17aa096f

View File

@ -175,11 +175,18 @@ class KalturaIE(InfoExtractor):
unsigned_url += '?referrer=%s' % referrer
return unsigned_url
has_native_formats = False
formats = []
for f in flavor_assets:
# Continue if asset is not ready
if f['status'] != 2:
continue
if f['containerFormat'] == 'applehttp':
m3u8_url = sign_url(info['dataUrl'])
formats.extend(self._extract_m3u8_formats(
m3u8_url, entry_id, 'mp4', m3u8_id='hls', fatal=False))
continue
has_native_formats=True
video_url = sign_url('%s/flavorId/%s' % (info['dataUrl'], f['id']))
formats.append({
'format_id': '%(fileExt)s-%(bitrate)s' % f,
@ -193,9 +200,13 @@ class KalturaIE(InfoExtractor):
'width': int_or_none(f.get('width')),
'url': video_url,
})
m3u8_url = sign_url(info['dataUrl'].replace('format/url', 'format/applehttp'))
if has_native_formats:
m3u8_url = sign_url(info['dataUrl'].replace(
'format/url', 'format/applehttp'))
formats.extend(self._extract_m3u8_formats(
m3u8_url, entry_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))
m3u8_url, entry_id, 'mp4', 'm3u8_native', m3u8_id='hls',
fatal=False))
self._check_formats(formats, entry_id)
self._sort_formats(formats)