diff --git a/src/N_m3u8DL-RE.Common/Entity/StreamSpec.cs b/src/N_m3u8DL-RE.Common/Entity/StreamSpec.cs index 7198c79..5027b26 100644 --- a/src/N_m3u8DL-RE.Common/Entity/StreamSpec.cs +++ b/src/N_m3u8DL-RE.Common/Entity/StreamSpec.cs @@ -60,7 +60,7 @@ namespace N_m3u8DL_RE.Common.Entity else { prefixStr = $"[aqua]Vid[/] {encStr}"; - var d = $"{Resolution} | {Bandwidth / 1000} Kbps | {Name} | {FrameRate} | {Codecs} | {(Playlist != null ? Playlist.MediaParts.Sum(x => x.MediaSegments.Count) + " Segments" : "")}"; + var d = $"{Resolution} | {Bandwidth / 1000} Kbps | {GroupId} | {FrameRate} | {Codecs} | {(Playlist != null ? Playlist.MediaParts.Sum(x => x.MediaSegments.Count) + " Segments" : "")}"; returnStr = d.EscapeMarkup(); } diff --git a/src/N_m3u8DL-RE.Parser/Extractor/DASHExtractor.cs b/src/N_m3u8DL-RE.Parser/Extractor/DASHExtractor.cs index e65180d..58bda88 100644 --- a/src/N_m3u8DL-RE.Parser/Extractor/DASHExtractor.cs +++ b/src/N_m3u8DL-RE.Parser/Extractor/DASHExtractor.cs @@ -445,7 +445,7 @@ namespace N_m3u8DL_RE.Parser.Extractor { //基本信息 StreamSpec streamSpec = new(); - streamSpec.Name = item["FormatId"].GetValue(); + streamSpec.GroupId = item["FormatId"].GetValue(); streamSpec.Bandwidth = item["Tbr"].GetValue(); streamSpec.Codecs = item["Codecs"].GetValue(); streamSpec.Language = item["Language"].GetValue(); @@ -543,14 +543,40 @@ namespace N_m3u8DL_RE.Parser.Extractor streamSpec.Playlist = playlist; streamList.Add(streamSpec); } + + //为视频设置默认轨道 + var aL = streamList.Where(s => s.MediaType == MediaType.AUDIO); + var sL = streamList.Where(s => s.MediaType == MediaType.SUBTITLES); + foreach (var item in streamList) + { + if (!string.IsNullOrEmpty(item.Resolution)) + { + if (aL.Any()) + { + item.AudioId = aL.First().GroupId; + } + if (sL.Any()) + { + item.SubtitleId = sL.First().GroupId; + } + } + } + return streamList; } - static bool CheckValid(string url) + bool CheckValid(string url) { try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(url)); + if (ParserConfig.Headers != null) + { + foreach (var item in ParserConfig.Headers) + { + request.Headers.Add(item.Key, item.Value); + } + } request.Timeout = 120000; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); if (((int)response.StatusCode).ToString().StartsWith("2")) return true; diff --git a/src/N_m3u8DL-RE/Program.cs b/src/N_m3u8DL-RE/Program.cs index da618ef..448de46 100644 --- a/src/N_m3u8DL-RE/Program.cs +++ b/src/N_m3u8DL-RE/Program.cs @@ -32,8 +32,8 @@ namespace N_m3u8DL_RE //Logger.LogLevel = LogLevel.DEBUG; var config = new ParserConfig(); var url = string.Empty; - url = "http://playertest.longtailvideo.com/adaptive/oceans_aes/oceans_aes.m3u8"; - //url = "https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd"; + //url = "http://playertest.longtailvideo.com/adaptive/oceans_aes/oceans_aes.m3u8"; + url = "https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd"; if (string.IsNullOrEmpty(url)) {