]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/common.py
[downloader/hls] Assemble single-file WebVTT subtitles from HLS segments
[yt-dlp.git] / yt_dlp / extractor / common.py
index 6257c17cd7e93466617a1e11ccfd1c62fa8a85fa..803c7fa066a18ed6972f7a9bedc5daeb5577c837 100644 (file)
@@ -2035,6 +2035,12 @@ def extract_media(x_media_line):
                     'url': url,
                     'ext': determine_ext(url),
                 }
+                if sub_info['ext'] == 'm3u8':
+                    # Per RFC 8216 ยง3.1, the only possible subtitle format m3u8
+                    # files may contain is WebVTT:
+                    # <https://tools.ietf.org/html/rfc8216#section-3.1>
+                    sub_info['ext'] = 'vtt'
+                    sub_info['protocol'] = 'm3u8_native'
                 subtitles.setdefault(lang, []).append(sub_info)
             if media_type not in ('VIDEO', 'AUDIO'):
                 return