From 1d7e156c11de28ba1dbe79196095dfb653634833 Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Sun, 27 Feb 2022 17:31:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81https://www.bilibili.com/medi?= =?UTF-8?q?alist/play/ml94341835/BV1Ei4y1t7wf=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BiliApi/BiliUtils/ParseEntrance.cs | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/DownKyi.Core/BiliApi/BiliUtils/ParseEntrance.cs b/DownKyi.Core/BiliApi/BiliUtils/ParseEntrance.cs index 4b359c8..e4112e4 100644 --- a/DownKyi.Core/BiliApi/BiliUtils/ParseEntrance.cs +++ b/DownKyi.Core/BiliApi/BiliUtils/ParseEntrance.cs @@ -29,7 +29,8 @@ namespace DownKyi.Core.BiliApi.BiliUtils public static readonly string BangumiUrl = $"{WwwUrl}/bangumi/play/"; public static readonly string BangumiMediaUrl = $"{WwwUrl}/bangumi/media/"; public static readonly string CheeseUrl = $"{WwwUrl}/cheese/play/"; - public static readonly string FavoritesUrl = $"{WwwUrl}/medialist/detail/"; + public static readonly string FavoritesUrl1 = $"{WwwUrl}/medialist/detail/"; + public static readonly string FavoritesUrl2 = $"{WwwUrl}/medialist/play/"; #region 视频 @@ -314,10 +315,31 @@ namespace DownKyi.Core.BiliApi.BiliUtils /// public static bool IsFavoritesUrl(string input) { - string favoritesId = GetId(input, FavoritesUrl); + return IsFavoritesUrl1(input) || IsFavoritesUrl2(input); + } + + /// + /// 是否为收藏夹url1 + /// + /// + /// + private static bool IsFavoritesUrl1(string input) + { + string favoritesId = GetId(input, FavoritesUrl1); return IsFavoritesId(favoritesId); } + /// + /// 是否为收藏夹ur2 + /// + /// + /// + private static bool IsFavoritesUrl2(string input) + { + string favoritesId = GetId(input, FavoritesUrl2); + return IsFavoritesId(favoritesId.Split('/')[0]); + } + /// /// 获取收藏夹id /// @@ -329,9 +351,13 @@ namespace DownKyi.Core.BiliApi.BiliUtils { return Number.GetInt(input.Remove(0, 2)); } - else if (IsFavoritesUrl(input)) + else if (IsFavoritesUrl1(input)) + { + return Number.GetInt(GetId(input, FavoritesUrl1).Remove(0, 2)); + } + else if (IsFavoritesUrl2(input)) { - return Number.GetInt(GetId(input, FavoritesUrl).Remove(0, 2)); + return Number.GetInt(GetId(input, FavoritesUrl2).Remove(0, 2).Split('/')[0]); } else {