支持短链接和/s的url

croire 3 years ago
parent 7a0f3df4fb
commit 1e851ce1c2

@ -19,7 +19,10 @@ namespace DownKyi.Core.BiliApi.BiliUtils
public static class ParseEntrance public static class ParseEntrance
{ {
public static readonly string WwwUrl = "https://www.bilibili.com"; public static readonly string WwwUrl = "https://www.bilibili.com";
public static readonly string ShareWwwUrl = "https://www.bilibili.com/s";
public static readonly string ShortUrl = "https://b23.tv/";
public static readonly string MobileUrl = "https://m.bilibili.com"; public static readonly string MobileUrl = "https://m.bilibili.com";
public static readonly string SpaceUrl = "https://space.bilibili.com"; public static readonly string SpaceUrl = "https://space.bilibili.com";
public static readonly string VideoUrl = $"{WwwUrl}/video/"; public static readonly string VideoUrl = $"{WwwUrl}/video/";
@ -492,6 +495,8 @@ namespace DownKyi.Core.BiliApi.BiliUtils
string url = EnableHttps(input); string url = EnableHttps(input);
url = DeleteUrlParam(url); url = DeleteUrlParam(url);
url = url.Replace(ShareWwwUrl, WwwUrl);
url = url.Replace(ShortUrl, VideoUrl);
url = url.Replace(MobileUrl, WwwUrl); url = url.Replace(MobileUrl, WwwUrl);
if (!url.StartsWith(baseUrl)) { return ""; } if (!url.StartsWith(baseUrl)) { return ""; }

Loading…
Cancel
Save