From e25b0d27dc65d875648d2269e330a2a7224cc744 Mon Sep 17 00:00:00 2001 From: nilaoda Date: Sat, 16 Jul 2022 23:22:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96HLS=E5=90=8E=E7=BC=80?= =?UTF-8?q?=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/N_m3u8DL-RE.Parser/Extractor/HLSExtractor.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/N_m3u8DL-RE.Parser/Extractor/HLSExtractor.cs b/src/N_m3u8DL-RE.Parser/Extractor/HLSExtractor.cs index 50c23cf..0cbacb1 100644 --- a/src/N_m3u8DL-RE.Parser/Extractor/HLSExtractor.cs +++ b/src/N_m3u8DL-RE.Parser/Extractor/HLSExtractor.cs @@ -512,7 +512,17 @@ namespace N_m3u8DL_RE.Parser.Extractor //重新加载m3u8 await LoadM3u8FromUrlAsync(lists[i].Url!); lists[i].Playlist = await ParseListAsync(); - lists[i].Extension = lists[i].Playlist!.MediaInit != null ? "mp4" : "ts"; + if (lists[i].MediaType == MediaType.SUBTITLES) + { + var a = lists[i].Playlist!.MediaParts.Any(p => p.MediaSegments.Any(m => m.Url.Contains(".ttml"))); + var b = lists[i].Playlist!.MediaParts.Any(p => p.MediaSegments.Any(m => m.Url.Contains(".vtt") || m.Url.Contains(".webvtt"))); + if (a) lists[i].Extension = "ttml"; + if (b) lists[i].Extension = "vtt"; + } + else + { + lists[i].Extension = lists[i].Playlist!.MediaInit != null ? "mp4" : "ts"; + } } } }