mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 23:26:53 +01:00
[byutv] Extract subtitles from streaming manifests
This commit is contained in:
parent
7a450a3b1c
commit
64a5cf7929
@ -82,6 +82,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
info = {}
|
info = {}
|
||||||
formats = []
|
formats = []
|
||||||
|
subtitles = {}
|
||||||
for format_id, ep in video.items():
|
for format_id, ep in video.items():
|
||||||
if not isinstance(ep, dict):
|
if not isinstance(ep, dict):
|
||||||
continue
|
continue
|
||||||
@ -90,12 +91,16 @@ def _real_extract(self, url):
|
|||||||
continue
|
continue
|
||||||
ext = determine_ext(video_url)
|
ext = determine_ext(video_url)
|
||||||
if ext == 'm3u8':
|
if ext == 'm3u8':
|
||||||
formats.extend(self._extract_m3u8_formats(
|
m3u8_fmts, m3u8_subs = self._extract_m3u8_formats_and_subtitles(
|
||||||
video_url, video_id, 'mp4', entry_protocol='m3u8_native',
|
video_url, video_id, 'mp4', entry_protocol='m3u8_native',
|
||||||
m3u8_id='hls', fatal=False))
|
m3u8_id='hls', fatal=False)
|
||||||
|
formats.extend(m3u8_fmts)
|
||||||
|
subtitles = self._merge_subtitles(subtitles, m3u8_subs)
|
||||||
elif ext == 'mpd':
|
elif ext == 'mpd':
|
||||||
formats.extend(self._extract_mpd_formats(
|
mpd_fmts, mpd_subs = self._extract_mpd_formats_and_subtitles(
|
||||||
video_url, video_id, mpd_id='dash', fatal=False))
|
video_url, video_id, mpd_id='dash', fatal=False)
|
||||||
|
formats.extend(mpd_fmts)
|
||||||
|
subtitles = self._merge_subtitles(subtitles, mpd_subs)
|
||||||
else:
|
else:
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
@ -114,4 +119,5 @@ def _real_extract(self, url):
|
|||||||
'display_id': display_id,
|
'display_id': display_id,
|
||||||
'title': display_id,
|
'title': display_id,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
'subtitles': subtitles,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user