[byutv] Extract subtitles from streaming manifests

This commit is contained in:
Felix S 2021-04-18 08:40:39 +02:00
parent 7a450a3b1c
commit 64a5cf7929

View File

@ -82,6 +82,7 @@ class BYUtvIE(InfoExtractor):
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 @@ class BYUtvIE(InfoExtractor):
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 @@ class BYUtvIE(InfoExtractor):
'display_id': display_id, 'display_id': display_id,
'title': display_id, 'title': display_id,
'formats': formats, 'formats': formats,
'subtitles': subtitles,
}) })