mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-25 19:52:11 +00:00
[ooyala] extract subtitles
This commit is contained in:
parent
05b651e3a5
commit
e8593f346a
1 changed files with 19 additions and 9 deletions
|
@ -22,13 +22,7 @@ class OoyalaBaseIE(InfoExtractor):
|
||||||
metadata = content_tree[list(content_tree)[0]]
|
metadata = content_tree[list(content_tree)[0]]
|
||||||
embed_code = metadata['embed_code']
|
embed_code = metadata['embed_code']
|
||||||
pcode = metadata.get('asset_pcode') or embed_code
|
pcode = metadata.get('asset_pcode') or embed_code
|
||||||
video_info = {
|
title = metadata['title']
|
||||||
'id': embed_code,
|
|
||||||
'title': metadata['title'],
|
|
||||||
'description': metadata.get('description'),
|
|
||||||
'thumbnail': metadata.get('thumbnail_image') or metadata.get('promo_image'),
|
|
||||||
'duration': float_or_none(metadata.get('duration'), 1000),
|
|
||||||
}
|
|
||||||
|
|
||||||
urls = []
|
urls = []
|
||||||
formats = []
|
formats = []
|
||||||
|
@ -78,8 +72,24 @@ class OoyalaBaseIE(InfoExtractor):
|
||||||
self.IE_NAME, cur_auth_data['message']), expected=True)
|
self.IE_NAME, cur_auth_data['message']), expected=True)
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
video_info['formats'] = formats
|
subtitles = {}
|
||||||
return video_info
|
for lang, sub in metadata.get('closed_captions_vtt', {}).get('captions', {}).items():
|
||||||
|
sub_url = sub.get('url')
|
||||||
|
if not sub_url:
|
||||||
|
continue
|
||||||
|
subtitles[lang] = [{
|
||||||
|
'url': sub_url,
|
||||||
|
}]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': embed_code,
|
||||||
|
'title': title,
|
||||||
|
'description': metadata.get('description'),
|
||||||
|
'thumbnail': metadata.get('thumbnail_image') or metadata.get('promo_image'),
|
||||||
|
'duration': float_or_none(metadata.get('duration'), 1000),
|
||||||
|
'subtitles': subtitles,
|
||||||
|
'formats': formats,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class OoyalaIE(OoyalaBaseIE):
|
class OoyalaIE(OoyalaBaseIE):
|
||||||
|
|
Loading…
Reference in a new issue