mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[brightcove] Extract subtitles from manifests
This commit is contained in:
parent
d5fe04f5c7
commit
67ad7759af
1 changed files with 8 additions and 5 deletions
|
@ -472,7 +472,7 @@ def _parse_brightcove_metadata(self, json_data, video_id, headers={}):
|
||||||
title = json_data['name'].strip()
|
title = json_data['name'].strip()
|
||||||
|
|
||||||
num_drm_sources = 0
|
num_drm_sources = 0
|
||||||
formats = []
|
formats, subtitles = [], {}
|
||||||
sources = json_data.get('sources') or []
|
sources = json_data.get('sources') or []
|
||||||
for source in sources:
|
for source in sources:
|
||||||
container = source.get('container')
|
container = source.get('container')
|
||||||
|
@ -488,12 +488,16 @@ def _parse_brightcove_metadata(self, json_data, video_id, headers={}):
|
||||||
elif ext == 'm3u8' or container == 'M2TS':
|
elif ext == 'm3u8' or container == 'M2TS':
|
||||||
if not src:
|
if not src:
|
||||||
continue
|
continue
|
||||||
formats.extend(self._extract_m3u8_formats(
|
f, subs = self._extract_m3u8_formats_and_subtitles(
|
||||||
src, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False))
|
src, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)
|
||||||
|
formats.extend(f)
|
||||||
|
subtitles = self._merge_subtitles(subtitles, subs)
|
||||||
elif ext == 'mpd':
|
elif ext == 'mpd':
|
||||||
if not src:
|
if not src:
|
||||||
continue
|
continue
|
||||||
formats.extend(self._extract_mpd_formats(src, video_id, 'dash', fatal=False))
|
f, subs = self._extract_mpd_formats_and_subtitles(src, video_id, 'dash', fatal=False)
|
||||||
|
formats.extend(f)
|
||||||
|
subtitles = self._merge_subtitles(subtitles, subs)
|
||||||
else:
|
else:
|
||||||
streaming_src = source.get('streaming_src')
|
streaming_src = source.get('streaming_src')
|
||||||
stream_name, app_name = source.get('stream_name'), source.get('app_name')
|
stream_name, app_name = source.get('stream_name'), source.get('app_name')
|
||||||
|
@ -556,7 +560,6 @@ def build_format_id(kind):
|
||||||
for f in formats:
|
for f in formats:
|
||||||
f.setdefault('http_headers', {}).update(headers)
|
f.setdefault('http_headers', {}).update(headers)
|
||||||
|
|
||||||
subtitles = {}
|
|
||||||
for text_track in json_data.get('text_tracks', []):
|
for text_track in json_data.get('text_tracks', []):
|
||||||
if text_track.get('kind') != 'captions':
|
if text_track.get('kind') != 'captions':
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue