新增查询用户的合集和列表api

croire 3 years ago
parent 755790aae0
commit 6b3044e9f7

@ -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<SpaceSeasonsSeriesArchives> Archives { get; set; }
[JsonProperty("meta")]
public SpaceSeasonsMeta Meta { get; set; }
[JsonProperty("recent_aids")]
public List<long> RecentAids { get; set; }
}
public class SpaceSeries : BaseModel
{
[JsonProperty("archives")]
public List<SpaceSeasonsSeriesArchives> Archives { get; set; }
[JsonProperty("meta")]
public SpaceSeriesMeta Meta { get; set; }
[JsonProperty("recent_aids")]
public List<long> RecentAids { get; set; }
}
}

@ -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
}
}

@ -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<string> 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; }
}
}

@ -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<SpaceSeasons> SeasonsList { get; set; }
[JsonProperty("series_list")]
public List<SpaceSeries> SeriesList { get; set; }
}
}

@ -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;
}
}

@ -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
/// <summary>
/// 查询用户的合集和列表
/// </summary>
/// <param name="mid"></param>
/// <param name="pageNum">第几页</param>
/// <param name="pageSize">每页的数量最大值为20</param>
/// <returns></returns>
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<SpaceSeasonsSeriesOrigin>(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

@ -217,6 +217,11 @@
<Compile Include="BiliApi\Users\Models\SpacePublicationListTypeVideoZone.cs" />
<Compile Include="BiliApi\Users\Models\SpacePublicationListVideo.cs" />
<Compile Include="BiliApi\Users\Models\SpacePublicationPage.cs" />
<Compile Include="BiliApi\Users\Models\SpaceSeasonsSeries.cs" />
<Compile Include="BiliApi\Users\Models\SpaceSeasonsSeriesArchives.cs" />
<Compile Include="BiliApi\Users\Models\SpaceSeasonsSeriesMeta.cs" />
<Compile Include="BiliApi\Users\Models\SpaceSeasonsSeriesOrigin.cs" />
<Compile Include="BiliApi\Users\Models\SpaceSeasonsSeriesPage.cs" />
<Compile Include="BiliApi\Users\Models\SpaceSettings.cs" />
<Compile Include="BiliApi\Users\Models\SpaceSettingsToutu.cs" />
<Compile Include="BiliApi\Users\Models\UpStat.cs" />

Loading…
Cancel
Save