From 975b2a1969bf4e26f08d91a50043c6aea921ee44 Mon Sep 17 00:00:00 2001 From: flyself <1432593898@qq.com> Date: Thu, 4 Mar 2021 19:53:55 +0800 Subject: [PATCH] v1.3.6 --- CHANGELOG.md | 9 + README.md | 22 +- src/Core/api/history/History.cs | 90 ++++ src/Core/api/history/ToView.cs | 58 ++ src/Core/api/login/LoginInfo.cs | 58 ++ src/Core/api/users/UserInfo.cs | 81 +++ src/Core/api/users/UserRelation.cs | 290 ++++++++++ src/Core/api/users/UserSpace.cs | 502 ++++++++++++++++++ src/Core/api/users/UserStatus.cs | 83 +++ src/Core/api/utils/BvId.cs | 63 +++ src/Core/api/utils/DanmakuSender.cs | 149 ++++++ src/Core/entity2/BaseEntity.cs | 30 ++ src/Core/entity2/history/History.cs | 101 ++++ src/Core/entity2/history/ToView.cs | 60 +++ .../entity2/login/UserInfoForNavigation.cs | 108 ++++ src/Core/entity2/users/BangumiFollow.cs | 103 ++++ src/Core/entity2/users/FollowingGroup.cs | 33 ++ .../entity2/users/FollowingGroupContent.cs | 42 ++ src/Core/entity2/users/MyInfo.cs | 166 ++++++ src/Core/entity2/users/RelationBlacks.cs | 43 ++ src/Core/entity2/users/RelationFollow.cs | 56 ++ src/Core/entity2/users/RelationWhisper.cs | 43 ++ src/Core/entity2/users/SpaceChannelList.cs | 48 ++ src/Core/entity2/users/SpaceChannelVideo.cs | 103 ++++ src/Core/entity2/users/SpaceCheese.cs | 65 +++ src/Core/entity2/users/SpaceFavoriteFolder.cs | 79 +++ .../users/SpaceFavoriteFolderResource.cs | 89 ++++ src/Core/entity2/users/SpaceInfo.cs | 77 +++ src/Core/entity2/users/SpacePublication.cs | 148 ++++++ src/Core/entity2/users/SpaceSettings.cs | 46 ++ src/Core/entity2/users/UpStat.cs | 31 ++ src/Core/entity2/users/UserRelationStat.cs | 28 + 32 files changed, 2892 insertions(+), 12 deletions(-) create mode 100644 src/Core/api/history/History.cs create mode 100644 src/Core/api/history/ToView.cs create mode 100644 src/Core/api/login/LoginInfo.cs create mode 100644 src/Core/api/users/UserInfo.cs create mode 100644 src/Core/api/users/UserRelation.cs create mode 100644 src/Core/api/users/UserSpace.cs create mode 100644 src/Core/api/users/UserStatus.cs create mode 100644 src/Core/api/utils/BvId.cs create mode 100644 src/Core/api/utils/DanmakuSender.cs create mode 100644 src/Core/entity2/BaseEntity.cs create mode 100644 src/Core/entity2/history/History.cs create mode 100644 src/Core/entity2/history/ToView.cs create mode 100644 src/Core/entity2/login/UserInfoForNavigation.cs create mode 100644 src/Core/entity2/users/BangumiFollow.cs create mode 100644 src/Core/entity2/users/FollowingGroup.cs create mode 100644 src/Core/entity2/users/FollowingGroupContent.cs create mode 100644 src/Core/entity2/users/MyInfo.cs create mode 100644 src/Core/entity2/users/RelationBlacks.cs create mode 100644 src/Core/entity2/users/RelationFollow.cs create mode 100644 src/Core/entity2/users/RelationWhisper.cs create mode 100644 src/Core/entity2/users/SpaceChannelList.cs create mode 100644 src/Core/entity2/users/SpaceChannelVideo.cs create mode 100644 src/Core/entity2/users/SpaceCheese.cs create mode 100644 src/Core/entity2/users/SpaceFavoriteFolder.cs create mode 100644 src/Core/entity2/users/SpaceFavoriteFolderResource.cs create mode 100644 src/Core/entity2/users/SpaceInfo.cs create mode 100644 src/Core/entity2/users/SpacePublication.cs create mode 100644 src/Core/entity2/users/SpaceSettings.cs create mode 100644 src/Core/entity2/users/UpStat.cs create mode 100644 src/Core/entity2/users/UserRelationStat.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d448fe..f5bc529 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # 更新日志 +* `2021/03/04` v1.3.6 + 1. [修复] 下载FLV时失败的问题。 + 2. [修复] 主页的登录信息更新不及时的问题。 + 3. [优化] 主页下方按钮居中。 + 4. [优化] 首页搜索框添加搜索按钮,点击可进行搜索。 + 5. [新增] 监听剪贴板。 + 6. [新增] 已下载视频列表排序。 + 7. [新增] 下载管理页面增加全部暂停、全部开始、全部删除。 + * `2021/02/21` v1.3.5 1. [修复] 分P标题相同时会下载失败的问题。 2. [修复] 个人空间中的头像可能显示不全的问题。 diff --git a/README.md b/README.md index bd91ffc..881e27b 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,8 @@ 哔哩下载姬支持多种复制于浏览器或APP的网址格式,在程序主页输入并按回车键即可开始检索。 -- 检索只获取视频的基本信息,视频下载链接需点击解析(v1.3.5)。 +- 检索只获取视频的基本信息,视频下载链接需点击解析。(v1.3.5) +- 监听剪贴板,复制即可开始检索。(v1.3.6) - 视频详情页中,先选中视频再下载,如果该视频已经在下载队列或者已下载列表中,则不会被添加。 - 用户收藏夹、订阅、稍后再看、历史记录中,点击下载后,会默认下载选中视频的所有分P。 @@ -59,17 +60,14 @@ [全部更新日志](https://github.com/FlySelfLog/downkyi/blob/main/CHANGELOG.md) -* `2021/02/21` v1.3.5 - 1. [修复] 分P标题相同时会下载失败的问题。 - 2. [修复] 个人空间中的头像可能显示不全的问题。 - 3. [优化] 订阅页面采用分页显示。 - 4. [优化] 增强程序健壮性。 - 5. [优化] 部分界面UI。 - 6. [优化] 视频详情页获取视频后不自动解析下载链接。 - 7. [新增] 视频详情页“自动解析”选项,“解析视频”按钮,列表右键菜单“解析”。 - 8. [新增] 视频详情页支持输入av号和BV号。 - 9. [新增] 视频详情页的UP主头像增加进入用户空间的入口。 - 10. [新增] 历史记录和稍后再看的up主头像增加进入用户空间的入口。 +* `2021/03/04` v1.3.6 + 1. [修复] 下载FLV时失败的问题。 + 2. [修复] 主页的登录信息更新不及时的问题。 + 3. [优化] 主页下方按钮居中。 + 4. [优化] 首页搜索框添加搜索按钮,点击可进行搜索。 + 5. [新增] 监听剪贴板。 + 6. [新增] 已下载视频列表排序。 + 7. [新增] 下载管理页面增加全部暂停、全部开始、全部删除。 ## 下载 diff --git a/src/Core/api/history/History.cs b/src/Core/api/history/History.cs new file mode 100644 index 0000000..c02e92a --- /dev/null +++ b/src/Core/api/history/History.cs @@ -0,0 +1,90 @@ +using Core.entity2.history; +using Newtonsoft.Json; +using System; + +namespace Core.api.history +{ + /// + /// 历史记录 + /// + public class History + { + private static History instance; + + /// + /// 获取UserInfo实例 + /// + /// + public static History GetInstance() + { + if (instance == null) + { + instance = new History(); + } + return instance; + } + + /// + /// History()方法,必须使用单例模式 + /// + private History() { } + + /// + /// 获取历史记录列表(视频、直播、专栏) + /// startId和startTime必须同时使用才有效,分别对应结果中的max和view_at,默认为0 + /// + /// 历史记录开始目标ID + /// 历史记录开始时间 + /// 每页项数 + /// 历史记录ID类型 + /// + public HistoryData GetHistory(long startId, long startTime, int ps = 30, HistoryBusiness business = HistoryBusiness.ARCHIVE) + { + string businessStr = string.Empty; + switch (business) + { + case HistoryBusiness.ARCHIVE: + businessStr = "archive"; + break; + case HistoryBusiness.PGC: + businessStr = "pgc"; + break; + case HistoryBusiness.LIVE: + businessStr = "live"; + break; + case HistoryBusiness.ARTICLE_LIST: + businessStr = "article-list"; + break; + case HistoryBusiness.ARTICLE: + businessStr = "article"; + break; + } + string url = $"https://api.bilibili.com/x/web-interface/history/cursor?max={startId}&view_at={startTime}&ps={ps}&business={businessStr}"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var history = JsonConvert.DeserializeObject(response); + if (history == null || history.Data == null) { return null; } + return history.Data; + } + catch (Exception e) + { + Console.WriteLine("GetHistory()发生异常: {0}", e); + return null; + } + } + + } + + public enum HistoryBusiness + { + ARCHIVE = 1, // 稿件 + PGC, // 番剧(影视) + LIVE, // 直播 + ARTICLE_LIST, // 文集 + ARTICLE, // 文章 + } + +} diff --git a/src/Core/api/history/ToView.cs b/src/Core/api/history/ToView.cs new file mode 100644 index 0000000..ceff6ef --- /dev/null +++ b/src/Core/api/history/ToView.cs @@ -0,0 +1,58 @@ +using Core.entity2.history; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; + +namespace Core.api.history +{ + /// + /// 获取稍后再看列表 + /// + public class ToView + { + private static ToView instance; + + /// + /// 获取ToView实例 + /// + /// + public static ToView GetInstance() + { + if (instance == null) + { + instance = new ToView(); + } + return instance; + } + + /// + /// 隐藏ToView()方法,必须使用单例模式 + /// + private ToView() { } + + /// + /// 获取稍后再看视频列表 + /// + /// + public List GetHistoryToView() + { + string url = "https://api.bilibili.com/x/v2/history/toview/web"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var toView = JsonConvert.DeserializeObject(response); + if (toView == null || toView.Data == null) { return null; } + return toView.Data.List; + } + catch (Exception e) + { + Console.WriteLine("GetHistoryToView()发生异常: {0}", e); + return null; + } + } + + } + +} diff --git a/src/Core/api/login/LoginInfo.cs b/src/Core/api/login/LoginInfo.cs new file mode 100644 index 0000000..65dab40 --- /dev/null +++ b/src/Core/api/login/LoginInfo.cs @@ -0,0 +1,58 @@ +using Core.entity2.login; +using Newtonsoft.Json; +using System; + +namespace Core.api.login +{ + /// + /// 登录基本信息 + /// + public class LoginInfo + { + private static LoginInfo instance; + + /// + /// 获取UserInfo实例 + /// + /// + public static LoginInfo GetInstance() + { + if (instance == null) + { + instance = new LoginInfo(); + } + return instance; + } + + /// + /// 隐藏LoginInfo()方法,必须使用单例模式 + /// + private LoginInfo() { } + + /// + /// 导航栏用户信息 + /// + /// + public UserInfoForNavigation GetUserInfoForNavigation() + { + string url = "https://api.bilibili.com/x/web-interface/nav"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var userInfo = JsonConvert.DeserializeObject(response); + if (userInfo == null || userInfo.Data == null) { return null; } + + if (userInfo.Data.IsLogin) { return userInfo.Data; } + else { return null; } + } + catch (Exception e) + { + Console.WriteLine("GetUserInfoForNavigation()发生异常: {0}", e); + return null; + } + } + + } +} diff --git a/src/Core/api/users/UserInfo.cs b/src/Core/api/users/UserInfo.cs new file mode 100644 index 0000000..5c0d421 --- /dev/null +++ b/src/Core/api/users/UserInfo.cs @@ -0,0 +1,81 @@ +using Core.entity2.users; +using Newtonsoft.Json; +using System; + +namespace Core.api.users +{ + /// + /// 用户基本信息 + /// + public class UserInfo + { + private static UserInfo instance; + + /// + /// 获取UserInfo实例 + /// + /// + public static UserInfo GetInstance() + { + if (instance == null) + { + instance = new UserInfo(); + } + return instance; + } + + /// + /// 隐藏UserInfo()方法,必须使用单例模式 + /// + private UserInfo() { } + + /// + /// 用户详细信息1 (用于空间) + /// + /// 目标用户UID + /// + public SpaceInfo GetInfoForSpace(long mid) + { + string url = $"https://api.bilibili.com/x/space/acc/info?mid={mid}"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var spaceInfo = JsonConvert.DeserializeObject(response); + if (spaceInfo == null || spaceInfo.Data == null) { return null; } + return spaceInfo.Data; + } + catch (Exception e) + { + Console.WriteLine("GetInfoForSpace()发生异常: {0}", e); + return null; + } + } + + /// + /// 本用户详细信息 + /// + /// + public MyInfo GetMyInfo() + { + string url = "https://api.bilibili.com/x/space/myinfo"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var myInfo = JsonConvert.DeserializeObject(response); + if (myInfo == null || myInfo.Data == null) { return null; } + return myInfo.Data; + } + catch (Exception e) + { + Console.WriteLine("GetMyInfo()发生异常: {0}", e); + return null; + } + } + + } + +} diff --git a/src/Core/api/users/UserRelation.cs b/src/Core/api/users/UserRelation.cs new file mode 100644 index 0000000..b7e432e --- /dev/null +++ b/src/Core/api/users/UserRelation.cs @@ -0,0 +1,290 @@ +using Core.entity2.users; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; + +namespace Core.api.users +{ + /// + /// 用户关系相关 + /// + public class UserRelation + { + private static UserRelation instance; + + /// + /// 获取UserRelation实例 + /// + /// + public static UserRelation GetInstance() + { + if (instance == null) + { + instance = new UserRelation(); + } + return instance; + } + + /// + /// 隐藏UserRelation()方法,必须使用单例模式 + /// + private UserRelation() { } + + /// + /// 查询用户粉丝明细 + /// + /// 目标用户UID + /// 页码 + /// 每页项数 + /// + public RelationFollow GetFollowers(long mid, int pn, int ps) + { + string url = $"https://api.bilibili.com/x/relation/followers?vmid={mid}&pn={pn}&ps={ps}"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var relationFollower = JsonConvert.DeserializeObject(response); + if (relationFollower == null || relationFollower.Data == null) { return null; } + return relationFollower.Data; + } + catch (Exception e) + { + Console.WriteLine("GetFollowers()发生异常: {0}", e); + return null; + } + } + + /// + /// 查询用户所有的粉丝明细 + /// + /// 目标用户UID + /// + public List GetAllFollowers(long mid) + { + List result = new List(); + + int i = 0; + while (true) + { + i++; + int ps = 50; + + var data = GetFollowers(mid, i, ps); + //if (data == null) { continue; } + + if (data == null || data.List == null || data.List.Count == 0) + { break; } + + result.AddRange(data.List); + } + + return result; + } + + /// + /// 查询用户关注明细 + /// + /// 目标用户UID + /// 页码 + /// 每页项数 + /// 排序方式 + /// + public RelationFollow GetFollowings(long mid, int pn, int ps, FollowingOrder order = FollowingOrder.DEFAULT) + { + string orderType = ""; + if (order == FollowingOrder.ATTENTION) + { + orderType = "attention"; + } + + string url = $"https://api.bilibili.com/x/relation/followings?vmid={mid}&pn={pn}&ps={ps}&order_type={orderType}"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var relationFollower = JsonConvert.DeserializeObject(response); + if (relationFollower == null || relationFollower.Data == null) { return null; } + return relationFollower.Data; + } + catch (Exception e) + { + Console.WriteLine("GetFollowings()发生异常: {0}", e); + return null; + } + } + + /// + /// 查询用户所有的关注明细 + /// + /// 目标用户UID + /// 排序方式 + /// + public List GetAllFollowings(long mid, FollowingOrder order = FollowingOrder.DEFAULT) + { + List result = new List(); + + int i = 0; + while (true) + { + i++; + int ps = 50; + + var data = GetFollowings(mid, i, ps, order); + //if (data == null) { continue; } + + if (data == null || data.List == null || data.List.Count == 0) + { break; } + + result.AddRange(data.List); + } + + return result; + } + + /// + /// 查询悄悄关注明细 + /// + /// 页码 + /// 每页项数 + /// + public List GetWhispers(int pn, int ps) + { + string url = $"https://api.bilibili.com/x/relation/whispers?pn={pn}&ps={ps}"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var relationWhisper = JsonConvert.DeserializeObject(response); + if (relationWhisper == null || relationWhisper.Data == null) { return null; } + return relationWhisper.Data; + } + catch (Exception e) + { + Console.WriteLine("GetWhispers()发生异常: {0}", e); + return null; + } + } + + /// + /// 查询黑名单明细 + /// + /// 页码 + /// 每页项数 + /// + public List GetBlacks(int pn, int ps) + { + string url = $"https://api.bilibili.com/x/relation/blacks?pn={pn}&ps={ps}"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var relationBlack = JsonConvert.DeserializeObject(response); + if (relationBlack == null || relationBlack.Data == null) { return null; } + return relationBlack.Data; + } + catch (Exception e) + { + Console.WriteLine("GetBlacks()发生异常: {0}", e); + return null; + } + } + + // 关注分组相关,只能查询当前登录账户的信息 + + /// + /// 查询关注分组列表 + /// + /// + public List GetFollowingGroup() + { + string url = $"https://api.bilibili.com/x/relation/tags"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var followingGroup = JsonConvert.DeserializeObject(response); + if (followingGroup == null || followingGroup.Data == null) { return null; } + return followingGroup.Data; + } + catch (Exception e) + { + Console.WriteLine("GetFollowingGroup()发生异常: {0}", e); + return null; + } + } + + /// + /// 查询关注分组明细 + /// + /// 分组ID + /// 页数 + /// 每页项数 + /// 排序方式 + /// + public List GetFollowingGroupContent(int tagId, int pn, int ps, FollowingOrder order = FollowingOrder.DEFAULT) + { + string orderType = ""; + if (order == FollowingOrder.ATTENTION) + { + orderType = "attention"; + } + + string url = $"https://api.bilibili.com/x/relation/tag?tagid={tagId}&pn={pn}&ps={ps}&order_type={orderType}"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var content = JsonConvert.DeserializeObject(response); + if (content == null || content.Data == null) { return null; } + return content.Data; + } + catch (Exception e) + { + Console.WriteLine("GetFollowingGroupContent()发生异常: {0}", e); + return null; + } + } + + /// + /// 查询所有的关注分组明细 + /// + /// 分组ID + /// 排序方式 + /// + public List GetAllFollowingGroupContent(int tagId, FollowingOrder order = FollowingOrder.DEFAULT) + { + List result = new List(); + + int i = 0; + while (true) + { + i++; + int ps = 50; + + var data = GetFollowingGroupContent(tagId, i, ps, order); + + if (data == null || data.Count == 0) + { break; } + + result.AddRange(data); + } + + return result; + } + + } + + public enum FollowingOrder + { + DEFAULT = 1, // 按照关注顺序排列,默认 + ATTENTION // 按照最常访问排列 + } + +} diff --git a/src/Core/api/users/UserSpace.cs b/src/Core/api/users/UserSpace.cs new file mode 100644 index 0000000..84421b8 --- /dev/null +++ b/src/Core/api/users/UserSpace.cs @@ -0,0 +1,502 @@ +using Core.entity2.users; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; + +namespace Core.api.users +{ + /// + /// 用户空间信息 + /// + public class UserSpace + { + private static UserSpace instance; + + /// + /// 获取UserSpace实例 + /// + /// + public static UserSpace GetInstance() + { + if (instance == null) + { + instance = new UserSpace(); + } + return instance; + } + + /// + /// 隐藏UserSpace()方法,必须使用单例模式 + /// + private UserSpace() { } + + /// + /// 查询空间设置 + /// + /// + /// + public SpaceSettings GetSpaceSettings(long mid) + { + string url = $"https://space.bilibili.com/ajax/settings/getSettings?mid={mid}"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var settings = JsonConvert.DeserializeObject(response); + if (settings == null || settings.Data == null || !settings.Status) { return null; } + + return settings.Data; + } + catch (Exception e) + { + Console.WriteLine("GetSpaceSettings()发生异常: {0}", e); + return null; + } + } + + /// + /// 获取用户投稿视频的所有分区 + /// + /// 用户id + /// + public List GetPublicationType(long mid) + { + int pn = 1; + int ps = 1; + var publication = GetPublication(mid, pn, ps); + return GetPublicationType(publication); + } + + /// + /// 获取用户投稿视频的所有分区 + /// + /// 用户id + /// + public List GetPublicationType(SpacePublicationList publication) + { + if (publication == null || publication.Tlist == null) + { + return null; + } + + List result = new List(); + JObject typeList = JObject.Parse(publication.Tlist.ToString("N")); + foreach (var item in typeList) + { + var value = JsonConvert.DeserializeObject(item.Value.ToString()); + result.Add(value); + } + return result; + } + + /// + /// 查询用户所有的投稿视频明细 + /// + /// 用户id + /// 排序 + /// 视频分区 + /// 搜索关键词 + /// + public List GetAllPublication(long mid, PublicationOrder order = PublicationOrder.PUBDATE, int tid = 0, string keyword = "") + { + List result = new List(); + + int i = 0; + while (true) + { + i++; + int ps = 100; + + var data = GetPublication(mid, i, ps, tid, order, keyword); + //if (data == null) { continue; } + + if (data == null || data.Vlist == null || data.Vlist.Count == 0) + { break; } + + result.AddRange(data.Vlist); + } + return result; + } + + /// + /// 查询用户投稿视频明细 + /// + /// 用户id + /// 页码 + /// 每页的视频数 + /// 排序 + /// 视频分区 + /// 搜索关键词 + /// + public SpacePublicationList GetPublication(long mid, int pn, int ps, int tid = 0, PublicationOrder order = PublicationOrder.PUBDATE, string keyword = "") + { + string url = $"https://api.bilibili.com/x/space/arc/search?mid={mid}&pn={pn}&ps={ps}&order={order.ToString("G").ToLower()}&tid={tid}&keyword={keyword}"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var spacePublication = JsonConvert.DeserializeObject(response); + if (spacePublication == null || spacePublication.Data == null) { return null; } + return spacePublication.Data.List; + } + catch (Exception e) + { + Console.WriteLine("GetPublication()发生异常: {0}", e); + return null; + } + } + + /// + /// 查询用户频道列表 + /// + /// 用户id + /// + public List GetChannelList(long mid) + { + string url = $"https://api.bilibili.com/x/space/channel/list?mid={mid}"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var spaceChannel = JsonConvert.DeserializeObject(response); + if (spaceChannel == null || spaceChannel.Data == null) { return null; } + return spaceChannel.Data.List; + } + catch (Exception e) + { + Console.WriteLine("GetChannelList()发生异常: {0}", e); + return null; + } + } + + /// + /// 查询用户频道中的所有视频 + /// + /// + /// + /// + public List GetAllChannelVideoList(long mid, long cid) + { + List result = new List(); + + int i = 0; + while (true) + { + i++; + int ps = 100; + + var data = GetChannelVideoList(mid, cid, i, ps); + if (data == null || data.Count == 0) + { break; } + + result.AddRange(data); + } + return result; + } + + /// + /// 查询用户频道中的视频 + /// + /// + /// + /// + /// + /// + public List GetChannelVideoList(long mid, long cid, int pn, int ps) + { + string url = $"https://api.bilibili.com/x/space/channel/video?mid={mid}&cid={cid}&pn={pn}&ps={ps}"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var spaceChannelVideo = JsonConvert.DeserializeObject(response); + if (spaceChannelVideo == null || spaceChannelVideo.Data == null || spaceChannelVideo.Data.List == null) + { return null; } + return spaceChannelVideo.Data.List.Archives; + } + catch (Exception e) + { + Console.WriteLine("GetChannelVideoList()发生异常: {0}", e); + return null; + } + } + + /// + /// 查询用户创建的视频收藏夹 + /// + /// 目标用户UID + /// 页码 + /// 每页项数 + /// + public List GetCreatedFavoriteFolder(long mid, int pn, int ps) + { + string url = $"https://api.bilibili.com/x/v3/fav/folder/created/list?up_mid={mid}&pn={pn}&ps={ps}"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var favoriteFolder = JsonConvert.DeserializeObject(response); + if (favoriteFolder == null || favoriteFolder.Data == null || favoriteFolder.Data.List == null) + { return null; } + return favoriteFolder.Data.List; + } + catch (Exception e) + { + Console.WriteLine("GetCreatedFavoriteFolder()发生异常: {0}", e); + return null; + } + } + + /// + /// 查询所有的用户创建的视频收藏夹 + /// + /// 目标用户UID + /// + public List GetAllCreatedFavoriteFolder(long mid) + { + List result = new List(); + + int i = 0; + while (true) + { + i++; + int ps = 50; + + var data = GetCreatedFavoriteFolder(mid, i, ps); + if (data == null || data.Count == 0) + { break; } + + result.AddRange(data); + } + return result; + } + + /// + /// 查询用户收藏的视频收藏夹 + /// + /// 目标用户UID + /// 页码 + /// 每页项数 + /// + public List GetCollectedFavoriteFolder(long mid, int pn, int ps) + { + string url = $"https://api.bilibili.com/x/v3/fav/folder/collected/list?up_mid={mid}&pn={pn}&ps={ps}"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var favoriteFolder = JsonConvert.DeserializeObject(response); + if (favoriteFolder == null || favoriteFolder.Data == null || favoriteFolder.Data.List == null) + { return null; } + return favoriteFolder.Data.List; + } + catch (Exception e) + { + Console.WriteLine("GetCollectedFavoriteFolder()发生异常: {0}", e); + return null; + } + } + + /// + /// 查询所有的用户收藏的视频收藏夹 + /// + /// 目标用户UID + /// + public List GetAllCollectedFavoriteFolder(long mid) + { + List result = new List(); + + int i = 0; + while (true) + { + i++; + int ps = 50; + + var data = GetCollectedFavoriteFolder(mid, i, ps); + if (data == null || data.Count == 0) + { break; } + + result.AddRange(data); + } + return result; + } + + /// + /// 查询视频收藏夹的内容 + /// + /// 收藏夹ID + /// 页码 + /// 每页项数 + /// + public List GetFavoriteFolderResource(long mediaId, int pn, int ps) + { + string url = $"https://api.bilibili.com/x/v3/fav/resource/list?media_id={mediaId}&pn={pn}&ps={ps}"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var resource = JsonConvert.DeserializeObject(response); + if (resource == null || resource.Data == null || resource.Data.Medias == null) + { return null; } + return resource.Data.Medias; + } + catch (Exception e) + { + Console.WriteLine("GetFavoriteFolderResource()发生异常: {0}", e); + return null; + } + } + + /// + /// 查询视频收藏夹的所有内容 + /// + /// 收藏夹ID + /// + public List GetAllFavoriteFolderResource(long mediaId) + { + List result = new List(); + + int i = 0; + while (true) + { + i++; + int ps = 20; + + var data = GetFavoriteFolderResource(mediaId, i, ps); + if (data == null || data.Count == 0) + { break; } + + result.AddRange(data); + } + return result; + } + + /// + /// 查询用户发布的课程列表 + /// + /// 目标用户UID + /// 页码 + /// 每页项数 + /// + public List GetCheese(long mid, int pn, int ps) + { + string url = $"https://api.bilibili.com/pugv/app/web/season/page?mid={mid}&pn={pn}&ps={ps}"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var cheese = JsonConvert.DeserializeObject(response); + if (cheese == null || cheese.Data == null || cheese.Data.Items == null) + { return null; } + return cheese.Data.Items; + } + catch (Exception e) + { + Console.WriteLine("GetCheese()发生异常: {0}", e); + return null; + } + } + + /// + /// 查询用户发布的所有课程列表 + /// + /// 目标用户UID + /// + public List GetAllCheese(long mid) + { + List result = new List(); + + int i = 0; + while (true) + { + i++; + int ps = 50; + + var data = GetCheese(mid, i, ps); + if (data == null || data.Count == 0) + { break; } + + result.AddRange(data); + } + return result; + } + + /// + /// 查询用户追番(追剧)明细 + /// + /// 目标用户UID + /// 查询类型 + /// 页码 + /// 每页项数 + /// + public BangumiFollowData GetBangumiFollow(long mid, BangumiType type, int pn, int ps) + { + string url = $"https://api.bilibili.com/x/space/bangumi/follow/list?vmid={mid}&type={type.ToString("D")}&pn={pn}&ps={ps}"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var bangumiFollow = JsonConvert.DeserializeObject(response); + if (bangumiFollow == null || bangumiFollow.Data == null) + { return null; } + return bangumiFollow.Data; + } + catch (Exception e) + { + Console.WriteLine("GetBangumiFollow()发生异常: {0}", e); + return null; + } + } + + /// + /// 查询用户所有的追番(追剧)明细 + /// + /// 目标用户UID + /// 查询类型 + /// + public List GetAllBangumiFollow(long mid, BangumiType type) + { + List result = new List(); + + int i = 0; + while (true) + { + i++; + int ps = 30; + + var data = GetBangumiFollow(mid, type, i, ps); + if (data == null || data.List == null || data.List.Count == 0) + { break; } + + result.AddRange(data.List); + } + return result; + } + + } + + + public enum PublicationOrder + { + PUBDATE = 1, // 最新发布,默认 + CLICK, // 最多播放 + STOW // 最多收藏 + } + + public enum BangumiType + { + ANIME = 1, // 番剧 + EPISODE = 2 // 剧集、电影 + } + +} diff --git a/src/Core/api/users/UserStatus.cs b/src/Core/api/users/UserStatus.cs new file mode 100644 index 0000000..3dcbb6a --- /dev/null +++ b/src/Core/api/users/UserStatus.cs @@ -0,0 +1,83 @@ +using Core.entity2.users; +using Newtonsoft.Json; +using System; + +namespace Core.api.users +{ + /// + /// 用户状态数 + /// + public class UserStatus + { + private static UserStatus instance; + + /// + /// 获取UserStatus实例 + /// + /// + public static UserStatus GetInstance() + { + if (instance == null) + { + instance = new UserStatus(); + } + return instance; + } + + /// + /// 隐藏UserStatus()方法,必须使用单例模式 + /// + private UserStatus() { } + + /// + /// 关系状态数 + /// + /// + /// + public UserRelationStat GetUserRelationStat(long mid) + { + string url = $"https://api.bilibili.com/x/relation/stat?vmid={mid}"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var userRelationStat = JsonConvert.DeserializeObject(response); + if (userRelationStat == null || userRelationStat.Data == null) { return null; } + return userRelationStat.Data; + } + catch (Exception e) + { + Console.WriteLine("GetUserRelationStat()发生异常: {0}", e); + return null; + } + } + + /// + /// UP主状态数 + /// + /// 注:该接口需要任意用户登录,否则不会返回任何数据 + /// + /// + /// + public UpStat GetUpStat(long mid) + { + string url = $"https://api.bilibili.com/x/space/upstat?mid={mid}"; + string referer = "https://www.bilibili.com"; + string response = Utils.RequestWeb(url, referer); + + try + { + var upStat = JsonConvert.DeserializeObject(response); + if (upStat == null || upStat.Data == null) { return null; } + return upStat.Data; + } + catch (Exception e) + { + Console.WriteLine("GetUpStat()发生异常: {0}", e); + return null; + } + } + + } +} diff --git a/src/Core/api/utils/BvId.cs b/src/Core/api/utils/BvId.cs new file mode 100644 index 0000000..3fcaad4 --- /dev/null +++ b/src/Core/api/utils/BvId.cs @@ -0,0 +1,63 @@ +using System; + +namespace Core.api.utils +{ + public static class BvId + { + private const string tableStr = "fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF"; //码表 + private static readonly char[] table = tableStr.ToCharArray(); + + private static readonly char[] tr = new char[124]; //反查码表 + private const ulong Xor = 177451812; //固定异或值 + private const ulong add = 8728348608; //固定加法值 + private static readonly int[] s = { 11, 10, 3, 8, 4, 6 }; //位置编码表 + + static BvId() + { + Tr_init(); + } + + //初始化反查码表 + private static void Tr_init() + { + for (int i = 0; i < 58; i++) + tr[table[i]] = (char)i; + } + + /// + /// bvid转avid + /// + /// + /// + public static ulong Bv2Av(string bvid) + { + char[] bv = bvid.ToCharArray(); + + ulong r = 0; + ulong av; + for (int i = 0; i < 6; i++) + r += tr[bv[s[i]]] * (ulong)Math.Pow(58, i); + av = (r - add) ^ Xor; + return av; + } + + /// + /// avid转bvid + /// + /// + /// + public static string Av2Bv(ulong av) + { + //编码结果 + string res = "BV1 4 1 7 "; + char[] result = res.ToCharArray(); + + av = (av ^ Xor) + add; + for (int i = 0; i < 6; i++) + result[s[i]] = table[av / (ulong)Math.Pow(58, i) % 58]; + string bv = new string(result); + return bv; + } + + } +} diff --git a/src/Core/api/utils/DanmakuSender.cs b/src/Core/api/utils/DanmakuSender.cs new file mode 100644 index 0000000..4801c74 --- /dev/null +++ b/src/Core/api/utils/DanmakuSender.cs @@ -0,0 +1,149 @@ +using System; + +namespace Core.api.utils +{ + public static class DanmakuSender + { + private const uint CRCPOLYNOMIAL = 0xEDB88320; + private static readonly uint[] crctable = new uint[256]; + + static DanmakuSender() + { + CreateTable(); + } + + private static void CreateTable() + { + for (int i = 0; i < 256; i++) + { + uint crcreg = (uint)i; + + for (int j = 0; j < 8; j++) + { + if ((crcreg & 1) != 0) + { + crcreg = CRCPOLYNOMIAL ^ (crcreg >> 1); + } + else + { + crcreg >>= 1; + } + } + crctable[i] = crcreg; + } + } + + private static uint Crc32(string userId) + { + uint crcstart = 0xFFFFFFFF; + for (int i = 0; i < userId.Length; i++) + { + uint index = (uint)(crcstart ^ (int)userId[i]) & 255; + crcstart = (crcstart >> 8) ^ crctable[index]; + } + return crcstart; + } + + private static uint Crc32LastIndex(string userId) + { + uint index = 0; + uint crcstart = 0xFFFFFFFF; + for (int i = 0; i < userId.Length; i++) + { + index = (uint)((crcstart ^ (int)userId[i]) & 255); + crcstart = (crcstart >> 8) ^ crctable[index]; + } + return index; + } + + private static int GetCrcIndex(long t) + { + for (int i = 0; i < 256; i++) + { + if ((crctable[i] >> 24) == t) + { + return i; + } + } + return -1; + } + + private static object[] DeepCheck(int i, int[] index) + { + object[] resultArray = new object[2]; + + string result = ""; + uint tc;// = 0x00; + var hashcode = Crc32(i.ToString()); + tc = (uint)(hashcode & 0xff ^ index[2]); + + if (!(tc <= 57 && tc >= 48)) + { + resultArray[0] = 0; + return resultArray; + } + + result += (tc - 48).ToString(); + hashcode = crctable[index[2]] ^ (hashcode >> 8); + tc = (uint)(hashcode & 0xff ^ index[1]); + + if (!(tc <= 57 && tc >= 48)) + { + resultArray[0] = 0; + return resultArray; + } + + result += (tc - 48).ToString(); + hashcode = crctable[index[1]] ^ (hashcode >> 8); + tc = (uint)(hashcode & 0xff ^ index[0]); + + if (!(tc <= 57 && tc >= 48)) + { + resultArray[0] = 0; + return resultArray; + } + + result += (tc - 48).ToString(); + //hashcode = crctable[index[0]] ^ (hashcode >> 8); + + resultArray[0] = 1; + resultArray[1] = result; + return resultArray; + } + + public static string FindDanmakuSender(string userId) + { + object[] deepCheckData = new object[2]; + + int[] index = new int[4]; + uint ht = (uint)Convert.ToInt32($"0x{userId}", 16); + ht ^= 0xffffffff; + + int i; + for (i = 3; i > -1; i--) + { + index[3 - i] = GetCrcIndex(ht >> (i * 8)); + uint snum = crctable[index[3 - i]]; + ht ^= snum >> ((3 - i) * 8); + } + for (i = 0; i < 100000000; i++) + { + uint lastindex = Crc32LastIndex(i.ToString()); + if (lastindex == index[3]) + { + deepCheckData = DeepCheck(i, index); + if ((int)deepCheckData[0] != 0) + { + break; + } + } + } + if (i == 100000000) + { + return "-1"; + } + return $"{i}{deepCheckData[1]}"; + } + + } +} diff --git a/src/Core/entity2/BaseEntity.cs b/src/Core/entity2/BaseEntity.cs new file mode 100644 index 0000000..1c55986 --- /dev/null +++ b/src/Core/entity2/BaseEntity.cs @@ -0,0 +1,30 @@ +using Newtonsoft.Json; + +namespace Core.entity2 +{ + public abstract class BaseEntity + { + public string ToString(string format = "") + { + // 设置为去掉null + var jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; + + switch (format) + { + case "": + return JsonConvert.SerializeObject(this); + case "F": + // 整理json格式 + return JsonConvert.SerializeObject(this, Formatting.Indented); + case "N": + // 去掉null后,转换为json字符串 + return JsonConvert.SerializeObject(this, Formatting.None, jsonSetting); + case "FN": + case "NF": + return JsonConvert.SerializeObject(this, Formatting.Indented, jsonSetting); + default: + return ToString(); + } + } + } +} diff --git a/src/Core/entity2/history/History.cs b/src/Core/entity2/history/History.cs new file mode 100644 index 0000000..3ca3cd3 --- /dev/null +++ b/src/Core/entity2/history/History.cs @@ -0,0 +1,101 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Core.entity2.history +{ + // https://api.bilibili.com/x/web-interface/history/cursor?max={startId}&view_at={startTime}&ps={ps}&business={businessStr} + [JsonObject] + public class HistoryOrigin : BaseEntity + { + //[JsonProperty("code")] + //public int Code { get; set; } + [JsonProperty("data")] + public HistoryData Data { get; set; } + //[JsonProperty("message")] + //public string Message { get; set; } + //[JsonProperty("ttl")] + //public int Ttl { get; set; } + } + + [JsonObject] + public class HistoryData : BaseEntity + { + [JsonProperty("cursor")] + public HistoryDataCursor Cursor { get; set; } + [JsonProperty("list")] + public List List { get; set; } + //public List tab { get; set; } + } + + [JsonObject] + public class HistoryDataCursor : BaseEntity + { + [JsonProperty("business")] + public string Business { get; set; } + [JsonProperty("max")] + public long Max { get; set; } + [JsonProperty("ps")] + public int Ps { get; set; } + [JsonProperty("view_at")] + public long ViewAt { get; set; } + } + + [JsonObject] + public class HistoryDataList : BaseEntity + { + [JsonProperty("author_face")] + public string AuthorFace { get; set; } + [JsonProperty("author_mid")] + public long AuthorMid { get; set; } + [JsonProperty("author_name")] + public string AuthorName { get; set; } + // ... + [JsonProperty("cover")] + public string Cover { get; set; } + // ... + [JsonProperty("duration")] + public long Duration { get; set; } + [JsonProperty("history")] + public HistoryDataListHistory History { get; set; } + // ... + [JsonProperty("new_desc")] + public string NewDesc { get; set; } + [JsonProperty("progress")] + public long Progress { get; set; } + [JsonProperty("show_title")] + public string ShowTitle { get; set; } + [JsonProperty("tag_name")] + public string TagName { get; set; } + [JsonProperty("title")] + public string Title { get; set; } + // ... + [JsonProperty("uri")] + public string Uri { get; set; } + [JsonProperty("videos")] + public int Videos { get; set; } + [JsonProperty("view_at")] + public long ViewAt { get; set; } + } + + [JsonObject] + public class HistoryDataListHistory : BaseEntity + { + [JsonProperty("business")] + public string Business { get; set; } + [JsonProperty("bvid")] + public string Bvid { get; set; } + [JsonProperty("cid")] + public long Cid { get; set; } + [JsonProperty("dt")] + public int Dt { get; set; } + [JsonProperty("epid")] + public long Epid { get; set; } + [JsonProperty("oid")] + public long Oid { get; set; } + [JsonProperty("page")] + public int Page { get; set; } + [JsonProperty("part")] + public string Part { get; set; } + } + +} diff --git a/src/Core/entity2/history/ToView.cs b/src/Core/entity2/history/ToView.cs new file mode 100644 index 0000000..8349682 --- /dev/null +++ b/src/Core/entity2/history/ToView.cs @@ -0,0 +1,60 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Core.entity2.history +{ + // https://api.bilibili.com/x/v2/history/toview/web + [JsonObject] + public class ToViewOrigin : BaseEntity + { + //public int code { get; set; } + [JsonProperty("data")] + public ToViewData Data { get; set; } + //public string message { get; set; } + //public int ttl { get; set; } + } + + [JsonObject] + public class ToViewData : BaseEntity + { + [JsonProperty("count")] + public int Count { get; set; } + [JsonProperty("list")] + public List List { get; set; } + } + + [JsonObject] + public class ToViewDataList : BaseEntity + { + [JsonProperty("add_at")] + public long AddAt { get; set; } + [JsonProperty("aid")] + public long Aid { get; set; } + //public long attribute { get; set; } + [JsonProperty("bvid")] + public string Bvid { get; set; } + [JsonProperty("cid")] + public long Cid { get; set; } + // ... + [JsonProperty("owner")] + public ToViewDataListOwner Owner { get; set; } + // ... + [JsonProperty("pic")] + public string Cover { get; set; } + // ... + [JsonProperty("title")] + public string Title { get; set; } + } + + [JsonObject] + public class ToViewDataListOwner : BaseEntity + { + [JsonProperty("face")] + public string Face { get; set; } + [JsonProperty("mid")] + public long Mid { get; set; } + [JsonProperty("name")] + public string Name { get; set; } + } + +} diff --git a/src/Core/entity2/login/UserInfoForNavigation.cs b/src/Core/entity2/login/UserInfoForNavigation.cs new file mode 100644 index 0000000..1cb9347 --- /dev/null +++ b/src/Core/entity2/login/UserInfoForNavigation.cs @@ -0,0 +1,108 @@ +using Newtonsoft.Json; + +namespace Core.entity2.login +{ + // https://api.bilibili.com/x/web-interface/nav + [JsonObject] + public class UserInfoForNavigationOrigin : BaseEntity + { + //[JsonProperty("code")] + //public int Code { get; set; } + [JsonProperty("data")] + public UserInfoForNavigation Data { get; set; } + //[JsonProperty("message")] + //public string Message { get; set; } + //[JsonProperty("ttl")] + //public int Ttl { get; set; } + } + + [JsonObject] + public class UserInfoForNavigation : BaseEntity + { + //public int allowance_count { get; set; } + //public int answer_status { get; set; } + //public int email_verified { get; set; } + [JsonProperty("face")] + public string Face { get; set; } + //public bool has_shop { get; set; } + [JsonProperty("isLogin")] + public bool IsLogin { get; set; } + //public NavDataLevelInfo level_info { get; set; } + [JsonProperty("mid")] + public long Mid { get; set; } + //public int mobile_verified { get; set; } + [JsonProperty("money")] + public float Money { get; set; } + //public int moral { get; set; } + //public NavDataOfficial official { get; set; } + //public NavDataOfficialVerify officialVerify { get; set; } + //public NavDataPendant pendant { get; set; } + //public int scores { get; set; } + //public string shop_url { get; set; } + [JsonProperty("uname")] + public string Name { get; set; } + //public long vipDueDate { get; set; } + [JsonProperty("vipStatus")] + public int VipStatus { get; set; } + //public int vipType { get; set; } + //public int vip_avatar_subscript { get; set; } + //public NavDataVipLabel vip_label { get; set; } + //public string vip_nickname_color { get; set; } + //public int vip_pay_type { get; set; } + //public int vip_theme_type { get; set; } + [JsonProperty("wallet")] + public UserInfoWallet Wallet { get; set; } + } + + //public class NavDataLevelInfo + //{ + // public int current_exp { get; set; } + // public int current_level { get; set; } + // public int current_min { get; set; } + // //public int next_exp { get; set; } // 当等级为6时,next_exp为string类型,值为"--" + //} + + //public class NavDataOfficial + //{ + // public string desc { get; set; } + // public int role { get; set; } + // public string title { get; set; } + // public int type { get; set; } + //} + + //public class NavDataOfficialVerify + //{ + // public string desc { get; set; } + // public int type { get; set; } + //} + + //public class NavDataPendant + //{ + // public int expire { get; set; } + // public string image { get; set; } + // public string image_enhance { get; set; } + // public string name { get; set; } + // public int pid { get; set; } + //} + + //public class NavDataVipLabel + //{ + // public string label_theme { get; set; } + // public string path { get; set; } + // public string text { get; set; } + //} + + [JsonObject] + public class UserInfoWallet : BaseEntity + { + [JsonProperty("bcoin_balance")] + public float BcoinBalance { get; set; } + [JsonProperty("coupon_balance")] + public float CouponBalance { get; set; } + [JsonProperty("coupon_due_time")] + public long CouponDueTime { get; set; } + [JsonProperty("mid")] + public long Mid { get; set; } + } + +} diff --git a/src/Core/entity2/users/BangumiFollow.cs b/src/Core/entity2/users/BangumiFollow.cs new file mode 100644 index 0000000..e26e875 --- /dev/null +++ b/src/Core/entity2/users/BangumiFollow.cs @@ -0,0 +1,103 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Core.entity2.users +{ + // https://api.bilibili.com/x/space/bangumi/follow/list?vmid={mid}&type={type}&pn={pn}&ps={ps} + [JsonObject] + public class BangumiFollowOrigin : BaseEntity + { + //[JsonProperty("code")] + //public int Code { get; set; } + [JsonProperty("data")] + public BangumiFollowData Data { get; set; } + //[JsonProperty("message")] + //public string Message { get; set; } + //[JsonProperty("ttl")] + //public int Ttl { get; set; } + } + + [JsonObject] + public class BangumiFollowData : BaseEntity + { + [JsonProperty("list")] + public List List { get; set; } + [JsonProperty("pn")] + public int Pn { get; set; } + [JsonProperty("ps")] + public int Ps { get; set; } + [JsonProperty("total")] + public int Total { get; set; } + } + + [JsonObject] + public class BangumiFollow : BaseEntity + { + [JsonProperty("areas")] + public List Areas { get; set; } + [JsonProperty("badge")] + public string Badge { get; set; } + [JsonProperty("badge_ep")] + public string BadgeEp { get; set; } + // ... + [JsonProperty("cover")] + public string Cover { get; set; } + [JsonProperty("evaluate")] + public string Evaluate { get; set; } + // ... + [JsonProperty("media_id")] + public long MediaId { get; set; } + // ... + [JsonProperty("new_ep")] + public BangumiFollowNewEp NewEp { get; set; } + [JsonProperty("progress")] + public string Progress { get; set; } + // ... + [JsonProperty("season_id")] + public long SeasonId { get; set; } + [JsonProperty("season_status")] + public int SeasonStatus { get; set; } + [JsonProperty("season_title")] + public string SeasonTitle { get; set; } + [JsonProperty("season_type")] + public int SeasonType { get; set; } + [JsonProperty("season_type_name")] + public string SeasonTypeName { get; set; } + // ... + [JsonProperty("title")] + public string Title { get; set; } + [JsonProperty("total_count")] + public int TotalCount { get; set; } + [JsonProperty("url")] + public string Url { get; set; } + } + + [JsonObject] + public class BangumiFollowAreas : BaseEntity + { + [JsonProperty("id")] + public int Id { get; set; } + [JsonProperty("name")] + public string Name { get; set; } + } + + [JsonObject] + public class BangumiFollowNewEp : BaseEntity + { + [JsonProperty("cover")] + public string Cover { get; set; } + [JsonProperty("duration")] + public long Duration { get; set; } + [JsonProperty("id")] + public long Id { get; set; } + [JsonProperty("index_show")] + public string IndexShow { get; set; } + [JsonProperty("long_title")] + public string LongTitle { get; set; } + [JsonProperty("pub_time")] + public string PubTime { get; set; } + [JsonProperty("title")] + public string Title { get; set; } + } + +} diff --git a/src/Core/entity2/users/FollowingGroup.cs b/src/Core/entity2/users/FollowingGroup.cs new file mode 100644 index 0000000..35d4162 --- /dev/null +++ b/src/Core/entity2/users/FollowingGroup.cs @@ -0,0 +1,33 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Core.entity2.users +{ + // https://api.bilibili.com/x/relation/tags + [JsonObject] + public class FollowingGroupOrigin : BaseEntity + { + //[JsonProperty("code")] + //public int Code { get; set; } + [JsonProperty("data")] + public List Data { get; set; } + //[JsonProperty("message")] + //public string Message { get; set; } + //[JsonProperty("ttl")] + //public int Ttl { get; set; } + } + + [JsonObject] + public class FollowingGroup : BaseEntity + { + [JsonProperty("count")] + public int Count { get; set; } + [JsonProperty("name")] + public string Name { get; set; } + [JsonProperty("tagid")] + public int TagId { get; set; } + [JsonProperty("tip")] + public string Tip { get; set; } + } + +} diff --git a/src/Core/entity2/users/FollowingGroupContent.cs b/src/Core/entity2/users/FollowingGroupContent.cs new file mode 100644 index 0000000..8c0275b --- /dev/null +++ b/src/Core/entity2/users/FollowingGroupContent.cs @@ -0,0 +1,42 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Core.entity2.users +{ + // https://api.bilibili.com/x/relation/tag?tagid={tagId}&pn={pn}&ps={ps}&order_type={orderType} + [JsonObject] + public class FollowingGroupContentOrigin : BaseEntity + { + //[JsonProperty("code")] + //public int Code { get; set; } + [JsonProperty("data")] + public List Data { get; set; } + //[JsonProperty("message")] + //public string Message { get; set; } + //[JsonProperty("ttl")] + //public int Ttl { get; set; } + } + + [JsonObject] + public class FollowingGroupContent : BaseEntity + { + [JsonProperty("attribute")] + public int Attribute { get; set; } + // ... + [JsonProperty("face")] + public string Face { get; set; } + [JsonProperty("mid")] + public long Mid { get; set; } + // ... + [JsonProperty("sign")] + public string Sign { get; set; } + [JsonProperty("special")] + public int Special { get; set; } + [JsonProperty("tag")] + public List Tag { get; set; } + [JsonProperty("uname")] + public string Name { get; set; } + // ... + } + +} diff --git a/src/Core/entity2/users/MyInfo.cs b/src/Core/entity2/users/MyInfo.cs new file mode 100644 index 0000000..eaef6eb --- /dev/null +++ b/src/Core/entity2/users/MyInfo.cs @@ -0,0 +1,166 @@ +using Newtonsoft.Json; + +namespace Core.entity2.users +{ + // https://api.bilibili.com/x/space/myinfo + [JsonObject] + public class MyInfoOrigin : BaseEntity + { + //[JsonProperty("code")] + //public int Code { get; set; } + [JsonProperty("data")] + public MyInfo Data { get; set; } + //[JsonProperty("message")] + //public string Message { get; set; } + //[JsonProperty("ttl")] + //public int Ttl { get; set; } + } + + [JsonObject] + public class MyInfo : BaseEntity + { + [JsonProperty("birthday")] + public long Birthday { get; set; } + [JsonProperty("coins")] + public float Coins { get; set; } + [JsonProperty("email_status")] + public int EmailStatus { get; set; } + [JsonProperty("face")] + public string Face { get; set; } + [JsonProperty("follower")] + public int Follower { get; set; } + [JsonProperty("following")] + public int Following { get; set; } + [JsonProperty("identification")] + public int Identification { get; set; } + [JsonProperty("is_deleted")] + public int IsDeleted { get; set; } + [JsonProperty("is_fake_account")] + public int IsFakeAccount { get; set; } + [JsonProperty("is_tourist")] + public int IsTourist { get; set; } + [JsonProperty("jointime")] + public int Jointime { get; set; } + [JsonProperty("level")] + public int Level { get; set; } + [JsonProperty("level_exp")] + public MyInfoLevelExp LevelExp { get; set; } + [JsonProperty("mid")] + public long Mid { get; set; } + [JsonProperty("moral")] + public int Moral { get; set; } + [JsonProperty("name")] + public string Name { get; set; } + [JsonProperty("nameplate")] + public MyInfoNamePlate Nameplate { get; set; } + [JsonProperty("official")] + public MyInfoOfficial Official { get; set; } + [JsonProperty("pendant")] + public MyInfoPendant Pendant { get; set; } + [JsonProperty("pin_prompting")] + public int PinPrompting { get; set; } + [JsonProperty("rank")] + public int Rank { get; set; } + [JsonProperty("sex")] + public string Sex { get; set; } + [JsonProperty("sign")] + public string Sign { get; set; } + [JsonProperty("silence")] + public int Silence { get; set; } + [JsonProperty("tel_status")] + public int TelStatus { get; set; } + [JsonProperty("vip")] + public MyInfoVip Vip { get; set; } + } + + [JsonObject] + public class MyInfoLevelExp : BaseEntity + { + [JsonProperty("current_exp")] + public int CurrentExp { get; set; } + [JsonProperty("current_level")] + public int CurrentLevel { get; set; } + [JsonProperty("current_min")] + public int CurrentMin { get; set; } + [JsonProperty("next_exp")] + public int NextExp { get; set; } + } + + [JsonObject] + public class MyInfoNamePlate : BaseEntity + { + [JsonProperty("condition")] + public string Condition { get; set; } + [JsonProperty("image")] + public string Image { get; set; } + [JsonProperty("image_small")] + public string ImageSmall { get; set; } + [JsonProperty("level")] + public string Level { get; set; } + [JsonProperty("name")] + public string Name { get; set; } + [JsonProperty("nid")] + public int Nid { get; set; } + } + + [JsonObject] + public class MyInfoOfficial : BaseEntity + { + [JsonProperty("desc")] + public string Desc { get; set; } + [JsonProperty("role")] + public int Role { get; set; } + [JsonProperty("title")] + public string Title { get; set; } + [JsonProperty("type")] + public int Type { get; set; } + } + + [JsonObject] + public class MyInfoPendant : BaseEntity + { + [JsonProperty("expire")] + public int Expire { get; set; } + [JsonProperty("image")] + public string Image { get; set; } + [JsonProperty("image_enhance")] + public string ImageEnhance { get; set; } + [JsonProperty("name")] + public string Name { get; set; } + [JsonProperty("pid")] + public int Pid { get; set; } + } + + [JsonObject] + public class MyInfoVip : BaseEntity + { + [JsonProperty("avatar_subscript")] + public int AvatarSubscript { get; set; } + [JsonProperty("due_date")] + public long DueDate { get; set; } + [JsonProperty("label")] + public MyInfoDataVipLabel Label { get; set; } + [JsonProperty("nickname_color")] + public string NicknameColor { get; set; } + [JsonProperty("status")] + public int Status { get; set; } + [JsonProperty("theme_type")] + public int ThemeType { get; set; } + [JsonProperty("type")] + public int Type { get; set; } + [JsonProperty("vip_pay_type")] + public int VipPayType { get; set; } + } + + [JsonObject] + public class MyInfoDataVipLabel : BaseEntity + { + [JsonProperty("label_theme")] + public string LabelTheme { get; set; } + [JsonProperty("path")] + public string Path { get; set; } + [JsonProperty("text")] + public string Text { get; set; } + } + +} diff --git a/src/Core/entity2/users/RelationBlacks.cs b/src/Core/entity2/users/RelationBlacks.cs new file mode 100644 index 0000000..9ab962e --- /dev/null +++ b/src/Core/entity2/users/RelationBlacks.cs @@ -0,0 +1,43 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Core.entity2.users +{ + // https://api.bilibili.com/x/relation/blacks?pn={pn}&ps={ps} + [JsonObject] + public class RelationBlackOrigin : BaseEntity + { + //[JsonProperty("code")] + //public int Code { get; set; } + [JsonProperty("data")] + public List Data { get; set; } + //[JsonProperty("message")] + //public string Message { get; set; } + //[JsonProperty("ttl")] + //public int Ttl { get; set; } + } + + public class RelationBlack : BaseEntity + { + [JsonProperty("attribute")] + public int Attribute { get; set; } + // ... + [JsonProperty("face")] + public string Face { get; set; } + [JsonProperty("mid")] + public long Mid { get; set; } + [JsonProperty("mtime")] + public long Mtime { get; set; } + // ... + [JsonProperty("sign")] + public string Sign { get; set; } + [JsonProperty("special")] + public int Special { get; set; } + [JsonProperty("tag")] + public List Tag { get; set; } + [JsonProperty("uname")] + public string Name { get; set; } + // ... + } + +} diff --git a/src/Core/entity2/users/RelationFollow.cs b/src/Core/entity2/users/RelationFollow.cs new file mode 100644 index 0000000..7e9b6b3 --- /dev/null +++ b/src/Core/entity2/users/RelationFollow.cs @@ -0,0 +1,56 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Core.entity2.users +{ + // https://api.bilibili.com/x/relation/followers?vmid={mid}&pn={pn}&ps={ps} + // https://api.bilibili.com/x/relation/followings?vmid={mid}&pn={pn}&ps={ps}&order_type={orderType} + [JsonObject] + public class RelationFollowOrigin : BaseEntity + { + //[JsonProperty("code")] + //public int Code { get; set; } + [JsonProperty("data")] + public RelationFollow Data { get; set; } + //[JsonProperty("message")] + //public string Message { get; set; } + //[JsonProperty("ttl")] + //public int Ttl { get; set; } + } + + [JsonObject] + public class RelationFollow : BaseEntity + { + [JsonProperty("list")] + public List List { get; set; } + //[JsonProperty("re_version")] + //public long reVersion { get; set; } + [JsonProperty("total")] + public int Total { get; set; } + } + + [JsonObject] + public class RelationFollowInfo : BaseEntity + { + [JsonProperty("attribute")] + public int Attribute { get; set; } + // ... + [JsonProperty("face")] + public string Face { get; set; } + [JsonProperty("mid")] + public long Mid { get; set; } + [JsonProperty("mtime")] + public long Mtime { get; set; } + // ... + [JsonProperty("sign")] + public string Sign { get; set; } + [JsonProperty("special")] + public int Special { get; set; } + [JsonProperty("tag")] + public List Tag { get; set; } + [JsonProperty("uname")] + public string Name { get; set; } + // ... + } + +} diff --git a/src/Core/entity2/users/RelationWhisper.cs b/src/Core/entity2/users/RelationWhisper.cs new file mode 100644 index 0000000..76a3c70 --- /dev/null +++ b/src/Core/entity2/users/RelationWhisper.cs @@ -0,0 +1,43 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Core.entity2.users +{ + // https://api.bilibili.com/x/relation/whispers?pn={pn}&ps={ps} + [JsonObject] + public class RelationWhisperOrigin : BaseEntity + { + //[JsonProperty("code")] + //public int Code { get; set; } + [JsonProperty("data")] + public List Data { get; set; } + //[JsonProperty("message")] + //public string Message { get; set; } + //[JsonProperty("ttl")] + //public int Ttl { get; set; } + } + + public class RelationWhisper : BaseEntity + { + [JsonProperty("attribute")] + public int Attribute { get; set; } + // ... + [JsonProperty("face")] + public string Face { get; set; } + [JsonProperty("mid")] + public long Mid { get; set; } + [JsonProperty("mtime")] + public long Mtime { get; set; } + // ... + [JsonProperty("sign")] + public string Sign { get; set; } + [JsonProperty("special")] + public int Special { get; set; } + [JsonProperty("tag")] + public List Tag { get; set; } + [JsonProperty("uname")] + public string Name { get; set; } + // ... + } + +} diff --git a/src/Core/entity2/users/SpaceChannelList.cs b/src/Core/entity2/users/SpaceChannelList.cs new file mode 100644 index 0000000..19f6d97 --- /dev/null +++ b/src/Core/entity2/users/SpaceChannelList.cs @@ -0,0 +1,48 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Core.entity2.users +{ + // https://api.bilibili.com/x/space/channel/list?mid= + [JsonObject] + public class SpaceChannelOrigin : BaseEntity + { + //[JsonProperty("code")] + //public int Code { get; set; } + [JsonProperty("data")] + public SpaceChannel Data { get; set; } + //[JsonProperty("message")] + //public string Message { get; set; } + //[JsonProperty("ttl")] + //public int Ttl { get; set; } + } + + [JsonObject] + public class SpaceChannel : BaseEntity + { + [JsonProperty("count")] + public int Count { get; set; } + [JsonProperty("list")] + public List List { get; set; } + } + + [JsonObject] + public class SpaceChannelList : BaseEntity + { + [JsonProperty("cid")] + public long Cid { get; set; } + [JsonProperty("count")] + public int Count { get; set; } + [JsonProperty("cover")] + public string Cover { get; set; } + [JsonProperty("intro")] + public string Intro { get; set; } + [JsonProperty("mid")] + public long Mid { get; set; } + [JsonProperty("mtime")] + public long Mtime { get; set; } + [JsonProperty("name")] + public string Name { get; set; } + } + +} diff --git a/src/Core/entity2/users/SpaceChannelVideo.cs b/src/Core/entity2/users/SpaceChannelVideo.cs new file mode 100644 index 0000000..65a65bf --- /dev/null +++ b/src/Core/entity2/users/SpaceChannelVideo.cs @@ -0,0 +1,103 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Core.entity2.users +{ + // https://api.bilibili.com/x/space/channel/video?mid={mid}&cid={cid}&pn={pn}&ps={ps} + [JsonObject] + public class SpaceChannelVideoOrigin : BaseEntity + { + //[JsonProperty("code")] + //public int Code { get; set; } + [JsonProperty("data")] + public SpaceChannelVideo Data { get; set; } + //[JsonProperty("message")] + //public string Message { get; set; } + //[JsonProperty("ttl")] + //public int Ttl { get; set; } + } + + [JsonObject] + public class SpaceChannelVideo : BaseEntity + { + [JsonProperty("list")] + public SpaceChannelVideoList List { get; set; } + [JsonProperty("page")] + public SpaceChannelVideoPage Page { get; set; } + } + + [JsonObject] + public class SpaceChannelVideoList : BaseEntity + { + [JsonProperty("archives")] + public List Archives { get; set; } + [JsonProperty("cid")] + public long Cid { get; set; } + [JsonProperty("count")] + public int Count { get; set; } + [JsonProperty("cover")] + public string Cover { get; set; } + [JsonProperty("intro")] + public string Intro { get; set; } + [JsonProperty("mid")] + public long Mid { get; set; } + [JsonProperty("mtime")] + public long Mtime { get; set; } + [JsonProperty("name")] + public string Name { get; set; } + } + + [JsonObject] + public class SpaceChannelVideoPage : BaseEntity + { + [JsonProperty("count")] + public int Count { get; set; } + [JsonProperty("num")] + public int Num { get; set; } + [JsonProperty("size")] + public int Size { get; set; } + } + + [JsonObject] + public class SpaceChannelVideoArchive : BaseEntity + { + [JsonProperty("aid")] + public long Aid { get; set; } + [JsonProperty("bvid")] + public string Bvid { get; set; } + [JsonProperty("cid")] + public long Cid { get; set; } + // ... + [JsonProperty("ctime")] + public long Ctime { get; set; } + [JsonProperty("desc")] + public string Desc { get; set; } + // ... + [JsonProperty("duration")] + public long Duration { get; set; } + // ... + [JsonProperty("pic")] + public string Pic { get; set; } + [JsonProperty("pubdate")] + public long Pubdate { get; set; } + // ... + [JsonProperty("stat")] + public SpaceChannelVideoArchiveStat Stat { get; set; } + // ... + [JsonProperty("tid")] + public int Tid { get; set; } + [JsonProperty("title")] + public string Title { get; set; } + [JsonProperty("tname")] + public string Tname { get; set; } + } + + [JsonObject] + public class SpaceChannelVideoArchiveStat : BaseEntity + { + // ... + [JsonProperty("view")] + public long View { get; set; } + } + +} diff --git a/src/Core/entity2/users/SpaceCheese.cs b/src/Core/entity2/users/SpaceCheese.cs new file mode 100644 index 0000000..0802ded --- /dev/null +++ b/src/Core/entity2/users/SpaceCheese.cs @@ -0,0 +1,65 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Core.entity2.users +{ + // https://api.bilibili.com/pugv/app/web/season/page?mid={mid}&pn={pn}&ps={ps} + [JsonObject] + public class SpaceCheeseOrigin : BaseEntity + { + //[JsonProperty("code")] + //public int Code { get; set; } + [JsonProperty("data")] + public SpaceCheeseList Data { get; set; } + //[JsonProperty("message")] + //public string Message { get; set; } + //[JsonProperty("ttl")] + //public int Ttl { get; set; } + } + + [JsonObject] + public class SpaceCheeseList : BaseEntity + { + [JsonProperty("items")] + public List Items { get; set; } + [JsonProperty("page")] + public SpaceCheesePage Page { get; set; } + } + + [JsonObject] + public class SpaceCheese : BaseEntity + { + [JsonProperty("cover")] + public string Cover { get; set; } + [JsonProperty("ep_count")] + public int EpCount { get; set; } + [JsonProperty("link")] + public string Link { get; set; } + [JsonProperty("page")] + public int Page { get; set; } + [JsonProperty("play")] + public int Play { get; set; } + [JsonProperty("season_id")] + public long SeasonId { get; set; } + [JsonProperty("status")] + public string Status { get; set; } + [JsonProperty("subtitle")] + public string SubTitle { get; set; } + [JsonProperty("title")] + public string Title { get; set; } + } + + [JsonObject] + public class SpaceCheesePage : BaseEntity + { + [JsonProperty("next")] + public bool Next { get; set; } + [JsonProperty("num")] + public int Num { get; set; } + [JsonProperty("size")] + public int Size { get; set; } + [JsonProperty("total")] + public int Total { get; set; } + } + +} diff --git a/src/Core/entity2/users/SpaceFavoriteFolder.cs b/src/Core/entity2/users/SpaceFavoriteFolder.cs new file mode 100644 index 0000000..1b70cfc --- /dev/null +++ b/src/Core/entity2/users/SpaceFavoriteFolder.cs @@ -0,0 +1,79 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Core.entity2.users +{ + // https://api.bilibili.com/x/v3/fav/folder/created/list?up_mid={mid}&pn={pn}&ps={ps} + // https://api.bilibili.com/x/v3/fav/folder/collected/list?up_mid={mid}&pn={pn}&ps={ps} + [JsonObject] + public class SpaceFavoriteFolderOrigin : BaseEntity + { + //[JsonProperty("code")] + //public int Code { get; set; } + [JsonProperty("data")] + public SpaceFavoriteFolder Data { get; set; } + //[JsonProperty("message")] + //public string Message { get; set; } + //[JsonProperty("ttl")] + //public int Ttl { get; set; } + } + + [JsonObject] + public class SpaceFavoriteFolder : BaseEntity + { + [JsonProperty("count")] + public int Count { get; set; } + [JsonProperty("has_more")] + public int HasMore { get; set; } + [JsonProperty("list")] + public List List { get; set; } + } + + [JsonObject] + public class SpaceFavoriteFolderList : BaseEntity + { + [JsonProperty("attr")] + public int Attr { get; set; } + [JsonProperty("cover")] + public string Cover { get; set; } + [JsonProperty("cover_type")] + public int CoverType { get; set; } + [JsonProperty("ctime")] + public long Ctime { get; set; } + [JsonProperty("fav_state")] + public int FavState { get; set; } + [JsonProperty("fid")] + public long Fid { get; set; } + [JsonProperty("id")] + public long Id { get; set; } + [JsonProperty("intro")] + public string Intro { get; set; } + [JsonProperty("link")] + public string Link { get; set; } + [JsonProperty("media_count")] + public int MediaCount { get; set; } + [JsonProperty("mid")] + public long Mid { get; set; } + [JsonProperty("mtime")] + public long Mtime { get; set; } + [JsonProperty("state")] + public int State { get; set; } + [JsonProperty("title")] + public string Title { get; set; } + [JsonProperty("upper")] + public FavoriteFolderUpper Upper { get; set; } + // ... + } + + [JsonObject] + public class FavoriteFolderUpper : BaseEntity + { + [JsonProperty("face")] + public string Face { get; set; } + [JsonProperty("mid")] + public long Mid { get; set; } + [JsonProperty("name")] + public string Name { get; set; } + } + +} diff --git a/src/Core/entity2/users/SpaceFavoriteFolderResource.cs b/src/Core/entity2/users/SpaceFavoriteFolderResource.cs new file mode 100644 index 0000000..bf050ad --- /dev/null +++ b/src/Core/entity2/users/SpaceFavoriteFolderResource.cs @@ -0,0 +1,89 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Core.entity2.users +{ + // https://api.bilibili.com/x/v3/fav/resource/list?media_id={mediaId}&pn={pn}&ps={ps} + [JsonObject] + public class SpaceFavoriteFolderResourceOrigin : BaseEntity + { + //[JsonProperty("code")] + //public int Code { get; set; } + [JsonProperty("data")] + public SpaceFavoriteFolderResource Data { get; set; } + //[JsonProperty("message")] + //public string Message { get; set; } + //[JsonProperty("ttl")] + //public int Ttl { get; set; } + } + + [JsonObject] + public class SpaceFavoriteFolderResource : BaseEntity + { + [JsonProperty("has_more")] + public int HasMore { get; set; } + // ... + [JsonProperty("medias")] + public List Medias { get; set; } + } + + [JsonObject] + public class SpaceFavoriteFolderMedia : BaseEntity + { + [JsonProperty("attr")] + public int Attr { get; set; } + [JsonProperty("bv_id")] + public string BvId { get; set; } + [JsonProperty("bvid")] + public string Bvid { get; set; } + [JsonProperty("cnt_info")] + public SpaceFavoriteFolderMediaCntInfo CntInfo { get; set; } + [JsonProperty("cover")] + public string Cover { get; set; } + [JsonProperty("ctime")] + public long Ctime { get; set; } + [JsonProperty("duration")] + public long Duration { get; set; } + [JsonProperty("fav_time")] + public long FavTime { get; set; } + [JsonProperty("id")] + public long Id { get; set; } + [JsonProperty("intro")] + public string Intro { get; set; } + [JsonProperty("link")] + public string Link { get; set; } + [JsonProperty("page")] + public int Page { get; set; } + [JsonProperty("pubtime")] + public long Pubtime { get; set; } + [JsonProperty("title")] + public string Title { get; set; } + [JsonProperty("type")] + public int Type { get; set; } + [JsonProperty("upper")] + public SpaceFavoriteFolderMediaUpper Upper { get; set; } + } + + [JsonObject] + public class SpaceFavoriteFolderMediaCntInfo : BaseEntity + { + [JsonProperty("collect")] + public long Collect { get; set; } + [JsonProperty("danmaku")] + public long Danmaku { get; set; } + [JsonProperty("play")] + public long Play { get; set; } + } + + [JsonObject] + public class SpaceFavoriteFolderMediaUpper : BaseEntity + { + [JsonProperty("face")] + public string Face { get; set; } + [JsonProperty("mid")] + public long Mid { get; set; } + [JsonProperty("name")] + public string Name { get; set; } + } + +} diff --git a/src/Core/entity2/users/SpaceInfo.cs b/src/Core/entity2/users/SpaceInfo.cs new file mode 100644 index 0000000..1e888d8 --- /dev/null +++ b/src/Core/entity2/users/SpaceInfo.cs @@ -0,0 +1,77 @@ +using Newtonsoft.Json; + +namespace Core.entity2.users +{ + // https://api.bilibili.com/x/space/acc/info?mid={mid} + [JsonObject] + public class SpaceInfoOrigin : BaseEntity + { + //[JsonProperty("code")] + //public int Code { get; set; } + [JsonProperty("data")] + public SpaceInfo Data { get; set; } + //[JsonProperty("message")] + //public string Message { get; set; } + //[JsonProperty("ttl")] + //public int Ttl { get; set; } + } + + [JsonObject] + public class SpaceInfo : BaseEntity + { + // ... + [JsonProperty("face")] + public string Face { get; set; } + [JsonProperty("fans_badge")] + public bool FansBadge { get; set; } + [JsonProperty("is_followed")] + public bool IsFollowed { get; set; } + // ... + [JsonProperty("level")] + public int Level { get; set; } + // ... + [JsonProperty("mid")] + public int Mid { get; set; } + // ... + [JsonProperty("name")] + public string Name { get; set; } + // ... + [JsonProperty("sex")] + public string Sex { get; set; } + // ... + [JsonProperty("sign")] + public string Sign { get; set; } + // ... + [JsonProperty("top_photo")] + public string TopPhoto { get; set; } + [JsonProperty("vip")] + public SpaceInfoVip Vip { get; set; } + } + + public class SpaceInfoVip + { + [JsonProperty("avatar_subscript")] + public int AvatarSubscript { get; set; } + [JsonProperty("label")] + public SpaceInfoVipLabel Label { get; set; } + [JsonProperty("nickname_color")] + public string NicknameColor { get; set; } + [JsonProperty("status")] + public int Status { get; set; } + [JsonProperty("theme_type")] + public int ThemeType { get; set; } + [JsonProperty("type")] + public int Type { get; set; } + } + + public class SpaceInfoVipLabel + { + [JsonProperty("label_theme")] + public string LabelTheme { get; set; } + [JsonProperty("path")] + public string Path { get; set; } + [JsonProperty("text")] + public string Text { get; set; } + } + +} diff --git a/src/Core/entity2/users/SpacePublication.cs b/src/Core/entity2/users/SpacePublication.cs new file mode 100644 index 0000000..d54afd5 --- /dev/null +++ b/src/Core/entity2/users/SpacePublication.cs @@ -0,0 +1,148 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace Core.entity2.users +{ + // https://api.bilibili.com/x/space/arc/search + [JsonObject] + public class SpacePublicationOrigin : BaseEntity + { + //[JsonProperty("code")] + //public int Code { get; set; } + [JsonProperty("data")] + public SpacePublication Data { get; set; } + //[JsonProperty("message")] + //public string Message { get; set; } + //[JsonProperty("ttl")] + //public int Ttl { get; set; } + } + + [JsonObject] + public class SpacePublication : BaseEntity + { + [JsonProperty("list")] + public SpacePublicationList List { get; set; } + [JsonProperty("page")] + public SpacePublicationPage Page { get; set; } + } + + [JsonObject] + public class SpacePublicationList : BaseEntity + { + [JsonProperty("tlist")] + public SpacePublicationListType Tlist { get; set; } + [JsonProperty("vlist")] + public List Vlist { get; set; } + } + + [JsonObject] + public class SpacePublicationPage : BaseEntity + { + [JsonProperty("count")] + public int Count { get; set; } + [JsonProperty("pn")] + public int Pn { get; set; } + [JsonProperty("ps")] + public int Ps { get; set; } + } + + [JsonObject] + public class SpacePublicationListType : BaseEntity + { + [JsonProperty("1")] + public SpacePublicationListTypeVideoZone Douga { get; set; } + [JsonProperty("13")] + public SpacePublicationListTypeVideoZone Anime { get; set; } + [JsonProperty("167")] + public SpacePublicationListTypeVideoZone Guochuang { get; set; } + [JsonProperty("3")] + public SpacePublicationListTypeVideoZone Music { get; set; } + [JsonProperty("129")] + public SpacePublicationListTypeVideoZone Dance { get; set; } + [JsonProperty("4")] + public SpacePublicationListTypeVideoZone Game { get; set; } + [JsonProperty("36")] + public SpacePublicationListTypeVideoZone Technology { get; set; } + [JsonProperty("188")] + public SpacePublicationListTypeVideoZone Digital { get; set; } + [JsonProperty("160")] + public SpacePublicationListTypeVideoZone Life { get; set; } + [JsonProperty("211")] + public SpacePublicationListTypeVideoZone Food { get; set; } + [JsonProperty("217")] + public SpacePublicationListTypeVideoZone Animal { get; set; } + [JsonProperty("119")] + public SpacePublicationListTypeVideoZone Kichiku { get; set; } + [JsonProperty("155")] + public SpacePublicationListTypeVideoZone Fashion { get; set; } + [JsonProperty("202")] + public SpacePublicationListTypeVideoZone Information { get; set; } + [JsonProperty("5")] + public SpacePublicationListTypeVideoZone Ent { get; set; } + [JsonProperty("181")] + public SpacePublicationListTypeVideoZone Cinephile { get; set; } + [JsonProperty("177")] + public SpacePublicationListTypeVideoZone Documentary { get; set; } + [JsonProperty("23")] + public SpacePublicationListTypeVideoZone Movie { get; set; } + [JsonProperty("11")] + public SpacePublicationListTypeVideoZone Tv { get; set; } + } + + [JsonObject] + public class SpacePublicationListVideo : BaseEntity + { + [JsonProperty("aid")] + public long Aid { get; set; } + //[JsonProperty("author")] + //public string Author { get; set; } + [JsonProperty("bvid")] + public string Bvid { get; set; } + //[JsonProperty("comment")] + //public int Comment { get; set; } + //[JsonProperty("copyright")] + //public string Copyright { get; set; } + [JsonProperty("created")] + public long Created { get; set; } + //[JsonProperty("description")] + //public string Description { get; set; } + //[JsonProperty("hide_click")] + //public bool HideClick { get; set; } + //[JsonProperty("is_pay")] + //public int IsPay { get; set; } + //[JsonProperty("is_steins_gate")] + //public int IsSteinsGate { get; set; } + //[JsonProperty("is_union_video")] + //public int IsUnionVideo { get; set; } + [JsonProperty("length")] + public string Length { get; set; } + [JsonProperty("mid")] + public long Mid { get; set; } + [JsonProperty("pic")] + public string Pic { get; set; } + [JsonProperty("play")] + public int Play { get; set; } + //[JsonProperty("review")] + //public int Review { get; set; } + //[JsonProperty("subtitle")] + //public string Subtitle { get; set; } + [JsonProperty("title")] + public string Title { get; set; } + [JsonProperty("typeid")] + public int Typeid { get; set; } + //[JsonProperty("video_review")] + //public int VideoReview { get; set; } + } + + [JsonObject] + public class SpacePublicationListTypeVideoZone : BaseEntity + { + [JsonProperty("count")] + public int Count { get; set; } + [JsonProperty("name")] + public string Name { get; set; } + [JsonProperty("tid")] + public int Tid { get; set; } + } + +} diff --git a/src/Core/entity2/users/SpaceSettings.cs b/src/Core/entity2/users/SpaceSettings.cs new file mode 100644 index 0000000..6b7f140 --- /dev/null +++ b/src/Core/entity2/users/SpaceSettings.cs @@ -0,0 +1,46 @@ +using Newtonsoft.Json; + +namespace Core.entity2.users +{ + // https://space.bilibili.com/ajax/settings/getSettings?mid={mid} + [JsonObject] + public class SpaceSettingsOrigin : BaseEntity + { + [JsonProperty("data")] + public SpaceSettings Data { get; set; } + [JsonProperty("status")] + public bool Status { get; set; } + } + + [JsonObject] + public class SpaceSettings : BaseEntity + { + // ... + [JsonProperty("toutu")] + public SpaceSettingsToutu Toutu { get; set; } + } + + [JsonObject] + public class SpaceSettingsToutu : BaseEntity + { + [JsonProperty("android_img")] + public string AndroidImg { get; set; } + [JsonProperty("expire")] + public long Expire { get; set; } + [JsonProperty("ipad_img")] + public string IpadImg { get; set; } + [JsonProperty("iphone_img")] + public string IphoneImg { get; set; } + [JsonProperty("l_img")] + public string Limg { get; set; } // 完整url为http://i0.hdslb.com/+相对路径 + [JsonProperty("platform")] + public int Platform { get; set; } + [JsonProperty("s_img")] + public string Simg { get; set; } // 完整url为http://i0.hdslb.com/+相对路径 + [JsonProperty("sid")] + public int Sid { get; set; } + [JsonProperty("thumbnail_img")] + public string ThumbnailImg { get; set; } + } + +} diff --git a/src/Core/entity2/users/UpStat.cs b/src/Core/entity2/users/UpStat.cs new file mode 100644 index 0000000..c913ad9 --- /dev/null +++ b/src/Core/entity2/users/UpStat.cs @@ -0,0 +1,31 @@ +using Newtonsoft.Json; + +namespace Core.entity2.users +{ + // https://api.bilibili.com/x/space/upstat?mid={mid} + [JsonObject] + public class UpStatOrigin : BaseEntity + { + [JsonProperty("data")] + public UpStat Data { get; set; } + } + + [JsonObject] + public class UpStat : BaseEntity + { + [JsonProperty("archive")] + public UpStatArchive Archive { get; set; } + [JsonProperty("article")] + public UpStatArchive Article { get; set; } + [JsonProperty("likes")] + public long Likes { get; set; } + } + + [JsonObject] + public class UpStatArchive : BaseEntity + { + [JsonProperty("view")] + public long View { get; set; } // 视频播放量 + } + +} diff --git a/src/Core/entity2/users/UserRelationStat.cs b/src/Core/entity2/users/UserRelationStat.cs new file mode 100644 index 0000000..7a31e9a --- /dev/null +++ b/src/Core/entity2/users/UserRelationStat.cs @@ -0,0 +1,28 @@ +using Newtonsoft.Json; + +namespace Core.entity2.users +{ + // https://api.bilibili.com/x/relation/stat?vmid={mid} + [JsonObject] + public class UserRelationStatOrigin : BaseEntity + { + [JsonProperty("data")] + public UserRelationStat Data { get; set; } + } + + [JsonObject] + public class UserRelationStat : BaseEntity + { + [JsonProperty("black")] + public long Black { get; set; } + [JsonProperty("follower")] + public long Follower { get; set; } // 粉丝数 + [JsonProperty("following")] + public long Following { get; set; } // 关注数 + [JsonProperty("mid")] + public long Mid { get; set; } + [JsonProperty("whisper")] + public long Whisper { get; set; } + } + +}