Skip to content

Commit

Permalink
fix #575
Browse files Browse the repository at this point in the history
  • Loading branch information
nilaoda committed May 26, 2023
1 parent 398477f commit af03c84
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions BBDown.Core/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ private static async Task<string> 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);
}
Expand Down Expand Up @@ -217,7 +218,8 @@ private static async Task<string> 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)
{
Expand Down
8 changes: 6 additions & 2 deletions BBDown/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit af03c84

Please sign in to comment.