mirror of
https://github.com/bolucat/Archive.git
synced 2025-12-24 13:28:37 +08:00
Update On Wed Aug 14 20:33:29 CEST 2024
This commit is contained in:
6
bbdown/.gitignore
vendored
6
bbdown/.gitignore
vendored
@@ -16,6 +16,12 @@
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Rider
|
||||
.idea
|
||||
|
||||
# macOS shit
|
||||
.DS_Store
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<Version>1.6.2</Version>
|
||||
<Version>1.6.3</Version>
|
||||
<Description>BBDown是一个免费且便捷高效的哔哩哔哩下载/解析软件.</Description>
|
||||
<PackageProjectUrl>https://github.com/nilaoda/BBDown</PackageProjectUrl>
|
||||
<StartupObject></StartupObject>
|
||||
|
||||
@@ -84,12 +84,12 @@ namespace BBDown
|
||||
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 @@ namespace BBDown
|
||||
{
|
||||
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..];
|
||||
|
||||
@@ -226,14 +226,15 @@ namespace BBDown
|
||||
|
||||
public static async Task<(string fetchedAid, VInfo vInfo, string apiType)> GetVideoInfoAsync(MyOption myOption, string aidOri, string input)
|
||||
{
|
||||
//加载认证信息
|
||||
Log("检测账号登录...");
|
||||
|
||||
// 加载认证信息
|
||||
LoadCredentials(myOption);
|
||||
|
||||
// 检测是否登录了账号
|
||||
bool is_login = await CheckLogin(Config.COOKIE);
|
||||
if (!myOption.UseIntlApi && !myOption.UseTvApi && Config.AREA == "")
|
||||
{
|
||||
Log("检测账号登录...");
|
||||
if (!is_login)
|
||||
{
|
||||
LogWarn("你尚未登录B站账号, 解析可能受到限制");
|
||||
@@ -251,7 +252,33 @@ namespace BBDown
|
||||
|
||||
Log("获取视频信息...");
|
||||
IFetcher fetcher = FetcherFactory.CreateFetcher(aidOri, myOption.UseIntlApi);
|
||||
var vInfo = await fetcher.FetchAsync(aidOri);
|
||||
VInfo? vInfo = null;
|
||||
|
||||
// 只输入 EP/SS 时优先按番剧查找,如果找不到则尝试按课程查找
|
||||
try
|
||||
{
|
||||
vInfo = await fetcher.FetchAsync(aidOri);
|
||||
}
|
||||
catch (KeyNotFoundException e)
|
||||
{
|
||||
if (e.Message != "Arg_KeyNotFound") throw; // 错误消息不符合预期,抛出异常
|
||||
if (aidOri.StartsWith("cheese:")) throw; // 已经按课程查找过,不再重复尝试
|
||||
|
||||
LogWarn("未找到此 EP/SS 对应番剧信息, 正在尝试按课程查找。");
|
||||
|
||||
aidOri = aidOri.Replace("ep", "cheese");
|
||||
Log("新的 aid: " + aidOri);
|
||||
|
||||
if (string.IsNullOrEmpty(aidOri))
|
||||
{
|
||||
throw new Exception("输入有误");
|
||||
}
|
||||
|
||||
Log("获取视频信息...");
|
||||
fetcher = FetcherFactory.CreateFetcher(aidOri, myOption.UseIntlApi);
|
||||
vInfo = await fetcher.FetchAsync(aidOri);
|
||||
}
|
||||
|
||||
string title = vInfo.Title;
|
||||
long pubTime = vInfo.PubTime;
|
||||
LogColor("视频标题: " + title);
|
||||
|
||||
Reference in New Issue
Block a user