优化HLS后缀识别

This commit is contained in:
nilaoda 2022-07-16 23:22:54 +08:00
parent 8cc6507c3f
commit e25b0d27dc
1 changed files with 11 additions and 1 deletions

View File

@ -512,8 +512,18 @@ namespace N_m3u8DL_RE.Parser.Extractor
//重新加载m3u8 //重新加载m3u8
await LoadM3u8FromUrlAsync(lists[i].Url!); await LoadM3u8FromUrlAsync(lists[i].Url!);
lists[i].Playlist = await ParseListAsync(); lists[i].Playlist = await ParseListAsync();
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"; lists[i].Extension = lists[i].Playlist!.MediaInit != null ? "mp4" : "ts";
} }
} }
} }
}
} }