mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-18 07:01:45 +00:00
[kaltura] Respect kaltura session
This commit is contained in:
parent
e5a2e17a9c
commit
9dce3c095b
@ -125,7 +125,7 @@ class KalturaIE(InfoExtractor):
|
|||||||
|
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
partner_id, entry_id = mobj.group('partner_id', 'id')
|
partner_id, entry_id = mobj.group('partner_id', 'id')
|
||||||
info, flavor_assets = None, None
|
ks = None
|
||||||
if partner_id and entry_id:
|
if partner_id and entry_id:
|
||||||
info, flavor_assets = self._get_video_info(entry_id, partner_id)
|
info, flavor_assets = self._get_video_info(entry_id, partner_id)
|
||||||
else:
|
else:
|
||||||
@ -158,6 +158,7 @@ class KalturaIE(InfoExtractor):
|
|||||||
entry_id = info['id']
|
entry_id = info['id']
|
||||||
else:
|
else:
|
||||||
raise ExtractorError('Invalid URL', expected=True)
|
raise ExtractorError('Invalid URL', expected=True)
|
||||||
|
ks = params.get('flashvars[ks]', [None])[0]
|
||||||
|
|
||||||
source_url = smuggled_data.get('source_url')
|
source_url = smuggled_data.get('source_url')
|
||||||
if source_url:
|
if source_url:
|
||||||
@ -167,14 +168,19 @@ class KalturaIE(InfoExtractor):
|
|||||||
else:
|
else:
|
||||||
referrer = None
|
referrer = None
|
||||||
|
|
||||||
|
def sign_url(unsigned_url):
|
||||||
|
if ks:
|
||||||
|
unsigned_url += '/ks/%s' % ks
|
||||||
|
if referrer:
|
||||||
|
unsigned_url += '?referrer=%s' % referrer
|
||||||
|
return unsigned_url
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for f in flavor_assets:
|
for f in flavor_assets:
|
||||||
# Continue if asset is not ready
|
# Continue if asset is not ready
|
||||||
if f['status'] != 2:
|
if f['status'] != 2:
|
||||||
continue
|
continue
|
||||||
video_url = '%s/flavorId/%s' % (info['dataUrl'], f['id'])
|
video_url = sign_url('%s/flavorId/%s' % (info['dataUrl'], f['id']))
|
||||||
if referrer:
|
|
||||||
video_url += '?referrer=%s' % referrer
|
|
||||||
formats.append({
|
formats.append({
|
||||||
'format_id': '%(fileExt)s-%(bitrate)s' % f,
|
'format_id': '%(fileExt)s-%(bitrate)s' % f,
|
||||||
'ext': f.get('fileExt'),
|
'ext': f.get('fileExt'),
|
||||||
@ -187,9 +193,7 @@ class KalturaIE(InfoExtractor):
|
|||||||
'width': int_or_none(f.get('width')),
|
'width': int_or_none(f.get('width')),
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
})
|
})
|
||||||
m3u8_url = info['dataUrl'].replace('format/url', 'format/applehttp')
|
m3u8_url = sign_url(info['dataUrl'].replace('format/url', 'format/applehttp'))
|
||||||
if referrer:
|
|
||||||
m3u8_url += '?referrer=%s' % referrer
|
|
||||||
formats.extend(self._extract_m3u8_formats(
|
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))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user