]> jfr.im git - yt-dlp.git/commitdiff
[zype] Extract subtitles from the m3u8 manifest (#948)
authorFelix S <redacted>
Sat, 11 Sep 2021 10:16:03 +0000 (10:16 +0000)
committerGitHub <redacted>
Sat, 11 Sep 2021 10:16:03 +0000 (15:46 +0530)
Closes #929
Authored by: fstirlitz

yt_dlp/extractor/zype.py

index f20f953cb85954b24a660165e1bb3c0a4a679ca3..7663cb36b01a55c07cd1459e3ed524505227c6f3 100644 (file)
@@ -56,6 +56,8 @@ def _real_extract(self, url):
         video = response['video']
         title = video['title']
 
+        subtitles = {}
+
         if isinstance(body, dict):
             formats = []
             for output in body.get('outputs', []):
@@ -64,7 +66,7 @@ def _real_extract(self, url):
                     continue
                 name = output.get('name')
                 if name == 'm3u8':
-                    formats = self._extract_m3u8_formats(
+                    formats, subtitles = self._extract_m3u8_formats_and_subtitles(
                         output_url, video_id, 'mp4',
                         'm3u8_native', m3u8_id='hls', fatal=False)
                 else:
@@ -97,7 +99,7 @@ def get_attr(key):
 
                 if get_attr('integration') == 'verizon-media':
                     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')
             text_tracks = self._search_regex(
                 r'textTracks\s*:\s*(\[[^]]+\])',
@@ -107,7 +109,6 @@ def get_attr(key):
                     text_tracks, video_id, js_to_json, False)
         self._sort_formats(formats)
 
-        subtitles = {}
         if text_tracks:
             for text_track in text_tracks:
                 tt_url = dict_get(text_track, ('file', 'src'))