[zype] Extract subtitles from the m3u8 manifest (#948)

Closes #929
Authored by: fstirlitz
pull/955/head
Felix S 3 years ago committed by GitHub
parent 81a136b80f
commit 1c5ce74c04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -56,6 +56,8 @@ class ZypeIE(InfoExtractor):
video = response['video'] video = response['video']
title = video['title'] title = video['title']
subtitles = {}
if isinstance(body, dict): if isinstance(body, dict):
formats = [] formats = []
for output in body.get('outputs', []): for output in body.get('outputs', []):
@ -64,7 +66,7 @@ class ZypeIE(InfoExtractor):
continue continue
name = output.get('name') name = output.get('name')
if name == 'm3u8': if name == 'm3u8':
formats = self._extract_m3u8_formats( formats, subtitles = self._extract_m3u8_formats_and_subtitles(
output_url, video_id, 'mp4', output_url, video_id, 'mp4',
'm3u8_native', m3u8_id='hls', fatal=False) 'm3u8_native', m3u8_id='hls', fatal=False)
else: else:
@ -97,7 +99,7 @@ class ZypeIE(InfoExtractor):
if get_attr('integration') == 'verizon-media': if get_attr('integration') == 'verizon-media':
m3u8_url = 'https://content.uplynk.com/%s.m3u8' % get_attr('id') m3u8_url = 'https://content.uplynk.com/%s.m3u8' % get_attr('id')
formats = self._extract_m3u8_formats( formats, subtitles = self._extract_m3u8_formats_and_subtitles(
m3u8_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls') m3u8_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls')
text_tracks = self._search_regex( text_tracks = self._search_regex(
r'textTracks\s*:\s*(\[[^]]+\])', r'textTracks\s*:\s*(\[[^]]+\])',
@ -107,7 +109,6 @@ class ZypeIE(InfoExtractor):
text_tracks, video_id, js_to_json, False) text_tracks, video_id, js_to_json, False)
self._sort_formats(formats) self._sort_formats(formats)
subtitles = {}
if text_tracks: if text_tracks:
for text_track in text_tracks: for text_track in text_tracks:
tt_url = dict_get(text_track, ('file', 'src')) tt_url = dict_get(text_track, ('file', 'src'))

Loading…
Cancel
Save