コード例 #1
0
        public async Task <Skin> GetSkinAsync()
        {
            string url  = BiliFactory.UrlContact(Api.SKIN_PACKAGE, hasAccessKey: true);
            var    data = await BiliClient.ConvertEntityFromWebAsync <Skin>(url);

            return(data);
        }
コード例 #2
0
        /// <summary>
        /// 获取观看的历史记录
        /// </summary>
        /// <param name="page">页码</param>
        /// <returns></returns>
        public async Task <List <VideoDetail> > GetVideoHistoryAsync(int page = 1)
        {
            string url  = Api.ACCOUNT_HISTORY + $"?pn={page}&ps=40";
            var    data = await BiliClient.ConvertEntityFromWebAsync <List <VideoDetail> >(url);

            return(data);
        }
コード例 #3
0
        /// <summary>
        /// 获取稍后观看列表
        /// </summary>
        /// <param name="page">页码</param>
        /// <returns></returns>
        public async Task <List <VideoDetail> > GetViewLaterAsync(int page = 1)
        {
            string url  = Api.ACCOUNT_VIEWLATER + $"?pn={page}&ps=40";
            var    data = await BiliClient.ConvertEntityFromWebAsync <List <VideoDetail> >(url, "data.list");

            return(data);
        }
コード例 #4
0
        /// <summary>
        /// 获取账户的未读消息
        /// </summary>
        /// <returns></returns>
        public async Task <MyMessage> GetMyUnreadMessageAsync()
        {
            string url  = BiliFactory.UrlContact(Api.ACCOUNT_UNREAD, null, true);
            var    data = await BiliClient.ConvertEntityFromWebAsync <MyMessage>(url);

            return(data);
        }
コード例 #5
0
        /// <summary>
        /// 获取动漫区块综合信息
        /// </summary>
        /// <param name="isJp"><c>true</c>代表番剧,<c>false</c>代表国创</param>
        /// <returns></returns>
        public async Task <List <AnimeModule> > GetAnimeSquareAsync(bool isJp = true)
        {
            string api = isJp ? Api.ANIME_JP_SQUARE : Api.ANIME_CHN_SQUARE;
            var    url = BiliFactory.UrlContact(api, null, true);

            return(await BiliClient.ConvertEntityFromWebAsync <List <AnimeModule> >(url, "result.modules"));
        }
コード例 #6
0
        /// <summary>
        /// 获取频道分类索引
        /// </summary>
        /// <returns></returns>
        public async Task <List <ChannelTab> > GetChannelTabsAsync()
        {
            var url  = BiliFactory.UrlContact(Api.CHANNEL_TABS, hasAccessKey: true);
            var data = await BiliClient.ConvertEntityFromWebAsync <List <ChannelTab> >(url);

            return(data);
        }
コード例 #7
0
        /// <summary>
        /// 获取我的个人信息
        /// </summary>
        /// <returns></returns>
        public async Task <Me> GetMeAsync()
        {
            var url  = BiliFactory.UrlContact(Api.ACCOUNT_MINE, hasAccessKey: true);
            var data = await BiliClient.ConvertEntityFromWebAsync <Me>(url);

            Me             = data;
            BiliClient.Mid = _userId = data.mid.ToString();
            return(data);
        }
コード例 #8
0
        /// <summary>
        /// 获取标签信息
        /// </summary>
        /// <param name="tagId">标签ID</param>
        /// <returns></returns>
        public async Task <ChannelTag> GetTagDetail(int tagId)
        {
            var param = new Dictionary <string, string>();

            param.Add("channel_id", tagId.ToString());
            string url  = BiliFactory.UrlContact(Api.CHANNEL_TAG_TAB, param, true);
            var    data = await BiliClient.ConvertEntityFromWebAsync <ChannelTag>(url);

            return(data);
        }
コード例 #9
0
        /// <summary>
        /// 获取用户空间信息(经过删减)
        /// </summary>
        /// <param name="uid">用户ID</param>
        /// <returns></returns>
        public async Task <UserResponse> GetUserSpaceAsync(int uid)
        {
            var param = new Dictionary <string, string>();

            param.Add("vmid", uid.ToString());
            string url  = BiliFactory.UrlContact(Api.ACCOUNT_USER_SPACE, param, true);
            var    data = await BiliClient.ConvertEntityFromWebAsync <UserResponse>(url);

            return(data);
        }
コード例 #10
0
        /// <summary>
        /// 获取字幕数据
        /// </summary>
        /// <param name="url">网址</param>
        /// <returns></returns>
        public async Task <VideoSubtitle> GetSubtitlesAsync(string url)
        {
            if (!url.StartsWith("http"))
            {
                url = "https:" + url;
            }
            var response = await BiliClient.ConvertEntityFromWebAsync <VideoSubtitle>(url, "");

            return(response);
        }
コード例 #11
0
        /// <summary>
        /// 获取视频相关
        /// </summary>
        /// <param name="aid">视频avid</param>
        /// <returns></returns>
        public async Task <List <VideoDetail> > GetVideoRelatedAsync(int aid)
        {
            var param = new Dictionary <string, string>();

            param.Add("aid", aid.ToString());
            string url  = BiliFactory.UrlContact(Api.VIDEO_RELATED, param, true);
            var    data = await BiliClient.ConvertEntityFromWebAsync <List <VideoDetail> >(url);

            return(data);
        }
コード例 #12
0
        /// <summary>
        /// 获取回复我的列表
        /// </summary>
        /// <param name="replyTime">偏移值(上次请求的底部时间戳)</param>
        /// <returns></returns>
        public async Task <FeedReplyResponse> GetReplyMeListAsync(int replyTime = 0)
        {
            var param = new Dictionary <string, string>();

            param.Add("reply_time", replyTime.ToString());
            string url      = BiliFactory.UrlContact(Api.ACCOUNT_FEEDBACK_REPLY, param, true);
            var    response = await BiliClient.ConvertEntityFromWebAsync <FeedReplyResponse>(url);

            return(response);
        }
コード例 #13
0
        /// <summary>
        /// 获取视频简易信息
        /// </summary>
        /// <param name="aid">视频avid</param>
        /// <returns></returns>
        public async Task <VideoSlim> GetVideoSlimAsync(int aid)
        {
            var param = new Dictionary <string, string>();

            param.Add("aid", aid.ToString());
            string url  = BiliFactory.UrlContact(Api.VIDEO_SLIM_INFO, param, true);
            var    data = await BiliClient.ConvertEntityFromWebAsync <VideoSlim>(url);

            return(data);
        }
コード例 #14
0
        /// <summary>
        /// 获取视频分P
        /// </summary>
        /// <param name="aid">视频avid</param>
        /// <returns></returns>
        public async Task <List <VideoPart> > GetVideoPartsAsync(int aid)
        {
            var param = new Dictionary <string, string>();

            param.Add("aid", aid.ToString());
            string url   = BiliFactory.UrlContact(Api.VIDEO_PART, param, true);
            var    parts = await BiliClient.ConvertEntityFromWebAsync <List <VideoPart> >(url);

            return(parts);
        }
コード例 #15
0
        /// <summary>
        /// 获取区块刷新信息
        /// </summary>
        /// <param name="type">类型</param>
        /// <param name="moduleId">模块ID</param>
        /// <returns></returns>
        public async Task <List <AnimeModuleItem> > GetAnimeSectionExchange(int type, int moduleId)
        {
            var param = new Dictionary <string, string>();

            param.Add("type", type.ToString());
            param.Add("oid", moduleId.ToString());
            string url = BiliFactory.UrlContact(Api.ANIME_EXCHANGE, param, true);

            return(await BiliClient.ConvertEntityFromWebAsync <List <AnimeModuleItem> >(url, "result"));
        }
コード例 #16
0
        /// <summary>
        /// 获取表情包
        /// </summary>
        /// <returns></returns>
        public async Task <List <EmojiReplyContainer> > GetUserEmojiAsync()
        {
            var param = new Dictionary <string, string>();

            param.Add("business", "reply");
            string url   = BiliFactory.UrlContact(Api.ACCOUNT_EMOJI_PANEL, param, true);
            var    items = await BiliClient.ConvertEntityFromWebAsync <List <EmojiReplyContainer> >(url, "data.packages");

            return(items);
        }
コード例 #17
0
        /// <summary>
        /// 获取我的关注的分组
        /// </summary>
        /// <returns></returns>
        public async Task <List <FollowTag> > GetMyFollowTagsAsync()
        {
            var param = new Dictionary <string, string>();

            param.Add("vmid", BiliClient.Mid);
            string url  = BiliFactory.UrlContact(Api.ACCOUNT_RELATION_FOLLOW_TAGS, param, true);
            var    data = await BiliClient.ConvertEntityFromWebAsync <List <FollowTag> >(url);

            return(data);
        }
コード例 #18
0
        /// <summary>
        /// 获取用户的投稿
        /// </summary>
        /// <param name="uid">用户ID</param>
        /// <param name="page">页码</param>
        /// <returns></returns>
        public async Task <ArchiveResponse> GetUserArchiveAsync(int uid, int page)
        {
            var param = new Dictionary <string, string>();

            param.Add("vmid", uid.ToString());
            param.Add("pn", page.ToString());
            string url  = BiliFactory.UrlContact(Api.ACCOUNT_USER_ARCHIVE, param, true);
            var    data = await BiliClient.ConvertEntityFromWebAsync <ArchiveResponse>(url);

            return(data);
        }
コード例 #19
0
        /// <summary>
        /// 根据传入的id列表获取视频信息
        /// </summary>
        /// <param name="ids">Id列表</param>
        /// <returns></returns>
        public async Task <List <FavoriteVideo> > GetFavoriteVideosAsync(IEnumerable <FavoriteId> ids)
        {
            var items = ids.Select(p => p.id + ":" + p.type);
            var param = new Dictionary <string, string>();

            param.Add("resources", string.Join(",", items));
            string url      = BiliFactory.UrlContact(Api.ACCOUNT_FAVORITE_INFO, param, true);
            var    response = await BiliClient.ConvertEntityFromWebAsync <List <FavoriteVideo> >(url);

            return(response);
        }
コード例 #20
0
        /// <summary>
        /// 获取动漫时间线
        /// </summary>
        /// <param name="type">区块类型,番剧:2,国创:3</param>
        /// <returns></returns>
        public async Task <List <Timeline> > GetTimelineAsync(int type)
        {
            var param = new Dictionary <string, string>();

            param.Add("type", type.ToString());
            param.Add("filter_type", "0");
            string url  = BiliFactory.UrlContact(Api.ANIME_TIMELINE, param, true);
            var    data = await BiliClient.ConvertEntityFromWebAsync <List <Timeline> >(url, "result.data");

            return(data);
        }
コード例 #21
0
        /// <summary>
        /// 获取收集列表
        /// </summary>
        /// <param name="uid">用户ID</param>
        /// <param name="pn">页码</param>
        /// <returns></returns>
        public async Task <List <FavoriteItem> > GetCollectListAsync(int uid, int pn = 1)
        {
            var param = new Dictionary <string, string>();

            param.Add("up_mid", uid.ToString());
            param.Add("ps", "20");
            param.Add("pn", pn.ToString());
            string url = BiliFactory.UrlContact(Api.ACCOUNT_COLLECT_LIST, param, true);

            return(await BiliClient.ConvertEntityFromWebAsync <List <FavoriteItem> >(url, "data.list"));
        }
コード例 #22
0
        /// <summary>
        /// 获取我的粉丝
        /// </summary>
        /// <param name="page">页码</param>
        /// <param name="reversion">刷新标识</param>
        /// <returns></returns>
        public async Task <FanResponse> GetMyFansAsync(int page, long reversion = 0)
        {
            var param = new Dictionary <string, string>();

            param.Add("pn", page.ToString());
            param.Add("vmid", BiliClient.Mid);
            string url      = BiliFactory.UrlContact(Api.ACCOUNT_RELATION_FANS, param, true);
            var    response = await BiliClient.ConvertEntityFromWebAsync <FanResponse>(url);

            return(response);
        }
コード例 #23
0
        /// <summary>
        /// 获取热门频道
        /// </summary>
        /// <returns></returns>
        public async Task <List <ChannelBase> > GetHotChannelAsync()
        {
            _hotChannelOffset += 5;
            var param = new Dictionary <string, string>();

            param.Add("offset", _hotChannelOffset.ToString());
            string url  = BiliFactory.UrlContact(Api.CHANNEL_HOT, param, true);
            var    data = await BiliClient.ConvertEntityFromWebAsync <List <ChannelBase> >(url, "data.items.list");

            return(data);
        }
コード例 #24
0
        /// <summary>
        /// 获取频道的详细信息
        /// </summary>
        /// <param name="channelId">频道Id</param>
        /// <returns></returns>
        public async Task <ChannelDetail> GetChannelDetailInfoAsync(int channelId)
        {
            var param = new Dictionary <string, string>();

            param.Add("channel_id", channelId.ToString());

            string url  = BiliFactory.UrlContact(Api.CHANNEL_DETAIL, param, true);
            var    data = await BiliClient.ConvertEntityFromWebAsync <ChannelDetail>(url);

            return(data);
        }
コード例 #25
0
        /// <summary>
        /// 获取收藏夹的视频索引
        /// </summary>
        /// <param name="id">收藏夹Id</param>
        /// <returns></returns>
        public async Task <List <FavoriteId> > GetFavoriteIdsAsync(int id)
        {
            var param = new Dictionary <string, string>();

            param.Add("pn", "1");
            param.Add("media_id", id.ToString());
            string url      = BiliFactory.UrlContact(Api.ACCOUNT_FAVORITE_IDS, param, true);
            var    response = await BiliClient.ConvertEntityFromWebAsync <List <FavoriteId> >(url);

            return(response);
        }
コード例 #26
0
        /// <summary>
        /// 获取点赞的列表
        /// </summary>
        /// <param name="id">上次请求的Id</param>
        /// <param name="likeTime">上次请求的底部时间戳</param>
        /// <returns></returns>
        public async Task <FeedLikeResponse> GetLikeMeListAsync(long id, int likeTime = 0)
        {
            var param = new Dictionary <string, string>();

            param.Add("id", id.ToString());
            param.Add("at_time", likeTime.ToString());
            string url      = BiliFactory.UrlContact(Api.ACCOUNT_FEEDBACK_LIKE, param, true);
            var    response = await BiliClient.ConvertEntityFromWebAsync <FeedLikeResponse>(url);

            return(response);
        }
コード例 #27
0
        /// <summary>
        /// 获取动漫索引限制条件
        /// </summary>
        /// <param name="type">分区类型</param>
        /// <returns></returns>
        public async Task <IndexCondition> GetBangumiIndexConditionAsync(int type)
        {
            var param = new Dictionary <string, string>();

            param.Add("season_type", type.ToString());
            param.Add("type", "0");
            string url    = BiliFactory.UrlContact(Api.ANIME_INDEX_CONDITION, param, true);
            var    result = await BiliClient.ConvertEntityFromWebAsync <IndexCondition>(url);

            return(result);
        }
コード例 #28
0
        /// <summary>
        /// 获取互动视频的节点信息
        /// </summary>
        /// <param name="aid">视频ID</param>
        /// <param name="graphVersion">标识值</param>
        /// <param name="edgeId">选项ID</param>
        /// <returns></returns>
        public async Task <InteractionVideo> GetInteractionVideoAsync(int aid, int graphVersion, int edgeId = 0)
        {
            var param = new Dictionary <string, string>();

            param.Add("aid", aid.ToString());
            param.Add("graph_version", graphVersion.ToString());
            param.Add("edge_id", edgeId.ToString());
            string url  = BiliFactory.UrlContact(Api.VIDEO_INTERACTION_EDGE, param, true);
            var    data = await BiliClient.ConvertEntityFromWebAsync <InteractionVideo>(url);

            return(data);
        }
コード例 #29
0
        /// <summary>
        /// 获取频道搜索结果
        /// </summary>
        /// <param name="search">搜索文本</param>
        /// <param name="pn">页码</param>
        /// <param name="ps">每页条目数</param>
        /// <returns></returns>
        public async Task <List <ChannelListItem> > GetChannelSearchResult(string search, int pn = 1, int ps = 20)
        {
            var param = new Dictionary <string, string>();

            param.Add("keyword", Uri.EscapeDataString(search));
            param.Add("pn", pn.ToString());
            param.Add("ps", ps.ToString());
            string url   = BiliFactory.UrlContact(Api.CHANNEL_SEARCH, param, true);
            var    items = await BiliClient.ConvertEntityFromWebAsync <List <ChannelListItem> >(url, "data.items");

            return(items);
        }
コード例 #30
0
        /// <summary>
        /// 获取我关注的用户(按分组)
        /// </summary>
        /// <param name="tagId">分组ID</param>
        /// <param name="pn">页码</param>
        /// <returns></returns>
        public async Task <List <RelationUser> > GetMyFollowUserAsync(int tagId, int pn)
        {
            var param = new Dictionary <string, string>();

            param.Add("mid", BiliClient.Mid);
            param.Add("ps", "50");
            param.Add("pn", pn.ToString());
            param.Add("tagid", tagId.ToString());
            string url  = BiliFactory.UrlContact(Api.ACCOUNT_RELATION_FOLLOW_DETAIL, param, true);
            var    data = await BiliClient.ConvertEntityFromWebAsync <List <RelationUser> >(url);

            return(data);
        }