diff --git a/BBDown.Core/Parser.cs b/BBDown.Core/Parser.cs index bb57bb3d3..97276e30e 100644 --- a/BBDown.Core/Parser.cs +++ b/BBDown.Core/Parser.cs @@ -113,7 +113,8 @@ private static async Task GetPlayJsonAsync(string aid, string cid, strin dfn = Config.qualitys[videoId], bandwith = Convert.ToInt64(dashVideo.GetProperty("bandwidth").ToString()) / 1000, baseUrl = dashVideo.GetProperty("base_url").ToString(), - codecs = GetVideoCodec(dashVideo.GetProperty("codecid").ToString()) + codecs = GetVideoCodec(dashVideo.GetProperty("codecid").ToString()), + size = dashVideo.TryGetProperty("size", out var sizeNode) ? Convert.ToDouble(sizeNode.ToString()) : 0 }; if (!videoTracks.Contains(v)) videoTracks.Add(v); } @@ -217,7 +218,8 @@ private static async Task GetPlayJsonAsync(string aid, string cid, strin dfn = Config.qualitys[videoId], bandwith = Convert.ToInt64(node.GetProperty("bandwidth").ToString()) / 1000, baseUrl = urlList.FirstOrDefault(i => !BaseUrlRegex().IsMatch(i), urlList.First()), - codecs = GetVideoCodec(node.GetProperty("codecid").ToString()) + codecs = GetVideoCodec(node.GetProperty("codecid").ToString()), + size = node.TryGetProperty("size", out var sizeNode) ? Convert.ToDouble(sizeNode.ToString()) : 0 }; if (!tvApi && !appApi) { diff --git a/BBDown/Program.cs b/BBDown/Program.cs index 3f3c30c79..07ee5196f 100644 --- a/BBDown/Program.cs +++ b/BBDown/Program.cs @@ -572,7 +572,8 @@ private static async Task DoWorkAsync(MyOption myOption) foreach (var v in videoTracks) { int pDur = p.dur == 0 ? v.dur : p.dur; - LogColor($"{index++}. [{v.dfn}] [{v.res}] [{v.codecs}] [{v.fps}] [{v.bandwith} kbps] [~{FormatFileSize(pDur * v.bandwith * 1024 / 8)}]".Replace("[] ", ""), false); + var size = v.size > 0 ? v.size : pDur * v.bandwith * 1024 / 8; + LogColor($"{index++}. [{v.dfn}] [{v.res}] [{v.codecs}] [{v.fps}] [{v.bandwith} kbps] [~{FormatFileSize(size)}]".Replace("[] ", ""), false); if (infoMode) Console.WriteLine(v.baseUrl); } } @@ -612,7 +613,10 @@ private static async Task DoWorkAsync(MyOption myOption) Log($"已选择的流:"); if (videoTracks.Count > 0) - LogColor($"[视频] [{videoTracks[vIndex].dfn}] [{videoTracks[vIndex].res}] [{videoTracks[vIndex].codecs}] [{videoTracks[vIndex].fps}] [{videoTracks[vIndex].bandwith} kbps] [~{FormatFileSize(videoTracks[vIndex].dur * videoTracks[vIndex].bandwith * 1024 / 8)}]".Replace("[] ", ""), false); + { + var size = videoTracks[vIndex].size > 0 ? videoTracks[vIndex].size : videoTracks[vIndex].dur * videoTracks[vIndex].bandwith * 1024 / 8; + LogColor($"[视频] [{videoTracks[vIndex].dfn}] [{videoTracks[vIndex].res}] [{videoTracks[vIndex].codecs}] [{videoTracks[vIndex].fps}] [{videoTracks[vIndex].bandwith} kbps] [~{FormatFileSize(size)}]".Replace("[] ", ""), false); + } if (audioTracks.Count > 0) LogColor($"[音频] [{audioTracks[aIndex].codecs}] [{audioTracks[aIndex].bandwith} kbps] [~{FormatFileSize(audioTracks[aIndex].dur * audioTracks[aIndex].bandwith * 1024 / 8)}]", false);