[vk] Add subtitles (#1480)

Authored by: kaz-us
pull/1477/head
kaz-us 3 years ago committed by GitHub
parent b2f25dc242
commit 5b6cb56207
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -471,6 +471,13 @@ class VKIE(VKBaseIE):
}) })
self._sort_formats(formats) self._sort_formats(formats)
subtitles = {}
for sub in data.get('subs') or {}:
subtitles.setdefault(sub.get('lang', 'en'), []).append({
'ext': sub.get('title', '.srt').split('.')[-1],
'url': url_or_none(sub.get('url')),
})
return { return {
'id': video_id, 'id': video_id,
'formats': formats, 'formats': formats,
@ -484,6 +491,7 @@ class VKIE(VKBaseIE):
'like_count': int_or_none(mv_data.get('likes')), 'like_count': int_or_none(mv_data.get('likes')),
'comment_count': int_or_none(mv_data.get('commcount')), 'comment_count': int_or_none(mv_data.get('commcount')),
'is_live': is_live, 'is_live': is_live,
'subtitles': subtitles,
} }

Loading…
Cancel
Save