支持用户空间链接中mid在中间的情况(https://space.bilibili.com/27899754/channel/series)

croire 3 years ago
parent 8f6553d401
commit 67400b45bf

@ -368,9 +368,16 @@ namespace DownKyi.Core.BiliApi.BiliUtils
/// <returns></returns>
public static bool IsUserUrl(string input)
{
string baseUrl = $"{SpaceUrl}/";
string id = GetId(input, baseUrl);
return Number.IsInt(id);
if (!IsUrl(input)) { return false; }
if (input.Contains("space.bilibili.com"))
{
return true;
}
else
{
return false;
}
}
/// <summary>
@ -390,9 +397,17 @@ namespace DownKyi.Core.BiliApi.BiliUtils
}
else if (IsUserUrl(input))
{
string baseUrl = $"{SpaceUrl}/";
string id = GetId(input, baseUrl);
return Number.GetInt(id);
string url = EnableHttps(input);
url = DeleteUrlParam(url);
var match = Regex.Match(url, @"\d+");
if (match.Success)
{
return long.Parse(match.Value);
}
else
{
return -1;
}
}
else
{

Loading…
Cancel
Save