diff --git a/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeries.cs b/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeries.cs new file mode 100644 index 0000000..9a97f24 --- /dev/null +++ b/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeries.cs @@ -0,0 +1,26 @@ +using DownKyi.Core.BiliApi.Models; +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace DownKyi.Core.BiliApi.Users.Models +{ + public class SpaceSeasons : BaseModel + { + [JsonProperty("archives")] + public List Archives { get; set; } + [JsonProperty("meta")] + public SpaceSeasonsMeta Meta { get; set; } + [JsonProperty("recent_aids")] + public List RecentAids { get; set; } + } + + public class SpaceSeries : BaseModel + { + [JsonProperty("archives")] + public List Archives { get; set; } + [JsonProperty("meta")] + public SpaceSeriesMeta Meta { get; set; } + [JsonProperty("recent_aids")] + public List RecentAids { get; set; } + } +} diff --git a/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesArchives.cs b/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesArchives.cs new file mode 100644 index 0000000..3b23101 --- /dev/null +++ b/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesArchives.cs @@ -0,0 +1,28 @@ +using DownKyi.Core.BiliApi.Models; +using Newtonsoft.Json; + +namespace DownKyi.Core.BiliApi.Users.Models +{ + public class SpaceSeasonsSeriesArchives : BaseModel + { + [JsonProperty("aid")] + public long Aid { get; set; } + [JsonProperty("bvid")] + public string Bvid { get; set; } + [JsonProperty("ctime")] + public long Ctime { get; set; } + [JsonProperty("duration")] + public long Duration { get; set; } + [JsonProperty("interactive_video")] + public bool InteractiveVideo { get; set; } + [JsonProperty("pic")] + public string Pic { get; set; } + [JsonProperty("pubdate")] + public long Pubdate { get; set; } + // stat + // state + [JsonProperty("title")] + public string Title { get; set; } + // ugc_pay + } +} diff --git a/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesMeta.cs b/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesMeta.cs new file mode 100644 index 0000000..dacbeb6 --- /dev/null +++ b/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesMeta.cs @@ -0,0 +1,51 @@ +using DownKyi.Core.BiliApi.Models; +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace DownKyi.Core.BiliApi.Users.Models +{ + public class SpaceSeasonsSeriesMeta : BaseModel + { + [JsonProperty("category")] + public int Category { get; set; } + [JsonProperty("cover")] + public string Cover { get; set; } + [JsonProperty("description")] + public string Description { get; set; } + [JsonProperty("mid")] + public long Mid { get; set; } + [JsonProperty("name")] + public string Name { get; set; } + [JsonProperty("total")] + public int Total { get; set; } + } + + public class SpaceSeasonsMeta : SpaceSeasonsSeriesMeta + { + [JsonProperty("ptime")] + public long Ptime { get; set; } + [JsonProperty("season_id")] + public long SeasonId { get; set; } + } + + public class SpaceSeriesMeta : SpaceSeasonsSeriesMeta + { + [JsonProperty("creator")] + public string Creator { get; set; } + [JsonProperty("ctime")] + public long Ctime { get; set; } + [JsonProperty("keywords")] + public List Keywords { get; set; } + [JsonProperty("last_update_ts")] + public long LastUpdate { get; set; } + [JsonProperty("mtime")] + public long Mtime { get; set; } + [JsonProperty("raw_keywords")] + public string RawKeywords { get; set; } + [JsonProperty("series_id")] + public long SeriesId { get; set; } + [JsonProperty("state")] + public int State { get; set; } + } + +} diff --git a/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesOrigin.cs b/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesOrigin.cs new file mode 100644 index 0000000..435ba0b --- /dev/null +++ b/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesOrigin.cs @@ -0,0 +1,36 @@ +using DownKyi.Core.BiliApi.Models; +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace DownKyi.Core.BiliApi.Users.Models +{ + // https://api.bilibili.com/x/space/channel/video?mid={mid}&page_num={pageNum}&page_size={pageSize} + public class SpaceSeasonsSeriesOrigin : BaseModel + { + //[JsonProperty("code")] + //public int Code { get; set; } + //[JsonProperty("message")] + //public string Message { get; set; } + //[JsonProperty("ttl")] + //public int Ttl { get; set; } + [JsonProperty("data")] + public SpaceSeasonsSeriesData Data { get; set; } + } + + public class SpaceSeasonsSeriesData : BaseModel + { + [JsonProperty("items_lists")] + public SpaceSeasonsSeries ItemsLists { get; set; } + } + + public class SpaceSeasonsSeries : BaseModel + { + [JsonProperty("page")] + public SpaceSeasonsSeriesPage Page { get; set; } + [JsonProperty("seasons_list")] + public List SeasonsList { get; set; } + [JsonProperty("series_list")] + public List SeriesList { get; set; } + } + +} diff --git a/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesPage.cs b/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesPage.cs new file mode 100644 index 0000000..0f651bf --- /dev/null +++ b/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesPage.cs @@ -0,0 +1,15 @@ +using DownKyi.Core.BiliApi.Models; +using Newtonsoft.Json; + +namespace DownKyi.Core.BiliApi.Users.Models +{ + public class SpaceSeasonsSeriesPage : BaseModel + { + [JsonProperty("page_num")] + public int PageNum; + [JsonProperty("page_size")] + public int PageSize; + [JsonProperty("total")] + public int Total; + } +} diff --git a/DownKyi.Core/BiliApi/Users/UserSpace.cs b/DownKyi.Core/BiliApi/Users/UserSpace.cs index a0dee12..0f6dd56 100644 --- a/DownKyi.Core/BiliApi/Users/UserSpace.cs +++ b/DownKyi.Core/BiliApi/Users/UserSpace.cs @@ -232,10 +232,37 @@ namespace DownKyi.Core.BiliApi.Users #region 合集和列表 - // TODO - // https://api.bilibili.com/x/polymer/space/seasons_series_list?mid=27899754&page_num=1&page_size=18 - // page_size最大值为20 + /// + /// 查询用户的合集和列表 + /// + /// + /// 第几页 + /// 每页的数量;最大值为20 + /// + public static SpaceSeasonsSeries GetSeasonsSeries(long mid, int pageNum, int pageSize) + { + // https://api.bilibili.com/x/polymer/space/seasons_series_list?mid=49246269&page_num=1&page_size=18 + string url = $"https://api.bilibili.com/x/space/channel/video?mid={mid}&page_num={pageNum}&page_size={pageSize}"; + string referer = "https://www.bilibili.com"; + string response = WebClient.RequestWeb(url, referer); + try + { + SpaceSeasonsSeriesOrigin origin = JsonConvert.DeserializeObject(response); + if (origin == null || origin.Data == null || origin.Data.ItemsLists == null) + { return null; } + return origin.Data.ItemsLists; + } + catch (Exception e) + { + Utils.Debugging.Console.PrintLine("GetSeasonsSeries()发生异常: {0}", e); + LogManager.Error("UserSpace", e); + return null; + } + } + + + // TODO // https://api.bilibili.com/x/polymer/space/seasons_archives_list?mid=23947287&season_id=665&sort_reverse=false&page_num=1&page_size=30 // https://api.bilibili.com/x/series/archives?mid=27899754&series_id=1253087&only_normal=true&sort=desc&pn=1&ps=30 diff --git a/DownKyi.Core/DownKyi.Core.csproj b/DownKyi.Core/DownKyi.Core.csproj index a9875b5..2ab62e5 100644 --- a/DownKyi.Core/DownKyi.Core.csproj +++ b/DownKyi.Core/DownKyi.Core.csproj @@ -217,6 +217,11 @@ + + + + +