projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #8611 from remitamine/ffmpegfd
[youtube-dl]
/
youtube_dl
/
extractor
/
kaltura.py
diff --git
a/youtube_dl/extractor/kaltura.py
b/youtube_dl/extractor/kaltura.py
index 78e29f481112d69096b599fa8d860b92c2be59eb..44d7c84a13f9bef9aa1d68dc5d38fe81b0af4a5f 100644
(file)
--- a/
youtube_dl/extractor/kaltura.py
+++ b/
youtube_dl/extractor/kaltura.py
@@
-125,7
+125,7
@@
class KalturaIE(InfoExtractor):
mobj = re.match(self._VALID_URL, url)
partner_id, entry_id = mobj.group('partner_id', 'id')
mobj = re.match(self._VALID_URL, url)
partner_id, entry_id = mobj.group('partner_id', 'id')
-
info, flavor_assets = None,
None
+
ks =
None
if partner_id and entry_id:
info, flavor_assets = self._get_video_info(entry_id, partner_id)
else:
if partner_id and entry_id:
info, flavor_assets = self._get_video_info(entry_id, partner_id)
else:
@@
-137,10
+137,7
@@
class KalturaIE(InfoExtractor):
params = compat_parse_qs(query)
if path:
splitted_path = path.split('/')
params = compat_parse_qs(query)
if path:
splitted_path = path.split('/')
- if not splitted_path[-1]:
- splitted_path = splitted_path[:-1]
- for i in range(0, len(splitted_path), 2):
- params[splitted_path[i]] = [splitted_path[i + 1]]
+ params.update(dict((zip(splitted_path[::2], [[v] for v in splitted_path[1::2]]))))
if 'wid' in params:
partner_id = params['wid'][0][1:]
elif 'p' in params:
if 'wid' in params:
partner_id = params['wid'][0][1:]
elif 'p' in params:
@@
-161,6
+158,7
@@
class KalturaIE(InfoExtractor):
entry_id = info['id']
else:
raise ExtractorError('Invalid URL', expected=True)
entry_id = info['id']
else:
raise ExtractorError('Invalid URL', expected=True)
+ ks = params.get('flashvars[ks]', [None])[0]
source_url = smuggled_data.get('source_url')
if source_url:
source_url = smuggled_data.get('source_url')
if source_url:
@@
-170,14
+168,19
@@
class KalturaIE(InfoExtractor):
else:
referrer = None
else:
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 = []
for f in flavor_assets:
# Continue if asset is not ready
if f['status'] != 2:
continue
formats = []
for f in flavor_assets:
# Continue if asset is not ready
if f['status'] != 2:
continue
- video_url = '%s/flavorId/%s' % (info['dataUrl'], f['id'])
- if referrer:
- video_url += '?referrer=%s' % referrer
+ video_url = sign_url('%s/flavorId/%s' % (info['dataUrl'], f['id']))
formats.append({
'format_id': '%(fileExt)s-%(bitrate)s' % f,
'ext': f.get('fileExt'),
formats.append({
'format_id': '%(fileExt)s-%(bitrate)s' % f,
'ext': f.get('fileExt'),
@@
-190,9
+193,7
@@
class KalturaIE(InfoExtractor):
'width': int_or_none(f.get('width')),
'url': video_url,
})
'width': int_or_none(f.get('width')),
'url': video_url,
})
- m3u8_url = info['dataUrl'].replace('format/url', 'format/applehttp')
- if referrer:
- m3u8_url += '?referrer=%s' % referrer
+ 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))
formats.extend(self._extract_m3u8_formats(
m3u8_url, entry_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))