From 6f5eaf7155cfcb96734878b7573c69f064731cca Mon Sep 17 00:00:00 2001 From: lc6464 <64722907+lc6464@users.noreply.github.com> Date: Wed, 14 Aug 2024 00:17:24 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AF=BE=E7=A8=8B=20EP?= =?UTF-8?q?=20ID=20=E8=A7=A3=E6=9E=90=E6=97=B6=E7=9A=84=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BBDown/BBDownUtil.cs | 19 ++++++++++++++++--- BBDown/Program.cs | 38 ++++++++++++++++++++++++++++++++------ 2 files changed, 48 insertions(+), 9 deletions(-) diff --git a/BBDown/BBDownUtil.cs b/BBDown/BBDownUtil.cs index 66cc882d5..d5ee05d5d 100644 --- a/BBDown/BBDownUtil.cs +++ b/BBDown/BBDownUtil.cs @@ -84,12 +84,12 @@ public static async Task GetAvIdAsync(string input) string epId = await GetEpIdByBangumiSSIdAsync(SsRegex().Match(input).Groups[1].Value); avid = $"ep:{epId}"; } - else if (input.Contains("/medialist/") && input.Contains("business_id=") && input.Contains("business=space_collection")) //列表类型是合集 + else if (input.Contains("/medialist/") && input.Contains("business_id=") && input.Contains("business=space_collection")) // 列表类型是合集 { string bizId = GetQueryString("business_id", input); avid = $"listBizId:{bizId}"; } - else if (input.Contains("/medialist/") && input.Contains("business_id=") && input.Contains("business=space_series")) //列表类型是系列 + else if (input.Contains("/medialist/") && input.Contains("business_id=") && input.Contains("business=space_series")) // 列表类型是系列 { string bizId = GetQueryString("business_id", input); avid = $"seriesBizId:{bizId}"; @@ -145,10 +145,23 @@ public static async Task GetAvIdAsync(string input) { avid = GetAidByBV(input[3..]); } - else if (input.ToLower().StartsWith("av")) //av + else if (input.ToLower().StartsWith("av")) // av { avid = input.ToLower()[2..]; } + else if (input.StartsWith("cheese/")) // cheese/(ep|ss)\d+ 格式 + { + string epId = ""; + if (input.Contains("/ep")) + { + epId = EpRegex().Match(input).Groups[1].Value; + } + else if (input.Contains("/ss")) + { + epId = await GetEpidBySSIdAsync(SsRegex().Match(input).Groups[1].Value); + } + avid = $"cheese:{epId}"; + } else if (input.StartsWith("ep")) { string epId = input[2..]; diff --git a/BBDown/Program.cs b/BBDown/Program.cs index ef980b14a..209ea7a56 100644 --- a/BBDown/Program.cs +++ b/BBDown/Program.cs @@ -226,20 +226,21 @@ public static (Dictionary encodingPriority, Dictionary GetVideoInfoAsync(MyOption myOption, string aidOri, string input) { - //加载认证信息 + Log("检测账号登录..."); + + // 加载认证信息 LoadCredentials(myOption); - // 检测是否登录了账号 - bool is_login = await CheckLogin(Config.COOKIE); + // 检测是否登录了账号 + bool is_login = await CheckLogin(Config.COOKIE); if (!myOption.UseIntlApi && !myOption.UseTvApi && Config.AREA == "") { - Log("检测账号登录..."); if (!is_login) { LogWarn("你尚未登录B站账号, 解析可能受到限制"); } } - + Log("获取aid..."); aidOri = await GetAvIdAsync(input); Log("获取aid结束: " + aidOri); @@ -251,7 +252,32 @@ public static (Dictionary encodingPriority, Dictionary Date: Wed, 14 Aug 2024 00:48:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=AE=80=E5=8D=95=E6=95=B4=E7=90=86?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BBDown/BBDownUtil.cs | 2 +- BBDown/Program.cs | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/BBDown/BBDownUtil.cs b/BBDown/BBDownUtil.cs index d5ee05d5d..5500ae830 100644 --- a/BBDown/BBDownUtil.cs +++ b/BBDown/BBDownUtil.cs @@ -149,7 +149,7 @@ public static async Task GetAvIdAsync(string input) { avid = input.ToLower()[2..]; } - else if (input.StartsWith("cheese/")) // cheese/(ep|ss)\d+ 格式 + else if (input.StartsWith("cheese/")) // ^cheese/(ep|ss)\d+ 格式 { string epId = ""; if (input.Contains("/ep")) diff --git a/BBDown/Program.cs b/BBDown/Program.cs index 209ea7a56..d14661d6f 100644 --- a/BBDown/Program.cs +++ b/BBDown/Program.cs @@ -226,13 +226,13 @@ public static (Dictionary encodingPriority, Dictionary GetVideoInfoAsync(MyOption myOption, string aidOri, string input) { - Log("检测账号登录..."); + Log("检测账号登录..."); // 加载认证信息 LoadCredentials(myOption); - // 检测是否登录了账号 - bool is_login = await CheckLogin(Config.COOKIE); + // 检测是否登录了账号 + bool is_login = await CheckLogin(Config.COOKIE); if (!myOption.UseIntlApi && !myOption.UseTvApi && Config.AREA == "") { if (!is_login) @@ -240,7 +240,7 @@ public static (Dictionary encodingPriority, Dictionary encodingPriority, Dictionary