예제 #1
0
        /// <summary>
        /// 综合搜索
        /// </summary>
        /// <param name="keyword">关键字</param>
        /// <param name="order">排序</param>
        /// <param name="duration">时长</param>
        /// <param name="rid">分区</param>
        /// <param name="pn">页码</param>
        /// <param name="ps">页数</param>
        /// <returns></returns>
        public ApiModel Search(string keyword, string order = "", int duration = 0, int rid = 0, int pn = 1, int ps = 20)
        {
            ApiModel api = new ApiModel()
            {
                method    = HttpMethod.GET,
                baseUrl   = $"https://app.bilibili.com/x/v2/search",
                parameter = ApiUtils.MustParameter(ApiHelper.AndroidKey, true) + "&fnval=16&fnver=0&force_host=0&fourk=1&from_source=app_search&highlight=0&is_org_query=0&qn=112&recommend=1"
            };

            api.parameter += $"&keyword={Uri.EscapeDataString(keyword)}&local_time={Utils.GetTimestampS()}&pn={pn}&ps={ps}";
            if (string.IsNullOrEmpty(order))
            {
                api.parameter += $"&order={order}";
            }
            if (duration != 0)
            {
                api.parameter += $"&duration={duration}";
            }
            if (rid != 0)
            {
                api.parameter += $"&rid={rid}";
            }
            api.parameter += ApiUtils.GetSign(api.parameter, ApiHelper.AndroidKey);
            return(api);
        }
예제 #2
0
        public ApiModel Coin(string aid, int num)
        {
            ApiModel api = new ApiModel()
            {
                method  = HttpMethod.POST,
                baseUrl = $"https://app.biliapi.net/x/v2/view/coin/add",
                body    = ApiUtils.MustParameter(ApiHelper.AndroidKey, true) + $"&aid={aid}&multiply={num}&platform=android&select_like=0"
            };

            api.body += ApiUtils.GetSign(api.body, ApiHelper.AndroidKey);
            return(api);
        }
예제 #3
0
        /// <summary>
        /// 关注
        /// </summary>
        /// <param name="mid">用户ID</param>
        /// <param name="mode">1为关注,2为取消关注</param>
        /// <returns></returns>
        public ApiModel Attention(string mid, string mode)
        {
            ApiModel api = new ApiModel()
            {
                method  = HttpMethod.POST,
                baseUrl = $"https://api.bilibili.com/x/relation/modify",
                body    = ApiUtils.MustParameter(ApiHelper.AndroidKey, true) + $"&act={mode}&fid={mid}&re_src=32"
            };

            api.body += ApiUtils.GetSign(api.body, ApiHelper.AndroidKey);
            return(api);
        }
예제 #4
0
        /// <summary>
        ///点赞
        /// </summary>
        /// <param name="dislike"> 当前dislike状态</param>
        /// <param name="like">当前like状态</param>
        /// <returns></returns>
        public ApiModel Dislike(string aid, int dislike, int like)
        {
            ApiModel api = new ApiModel()
            {
                method  = HttpMethod.POST,
                baseUrl = $"https://app.biliapi.net/x/v2/view/dislike",
                body    = ApiUtils.MustParameter(ApiHelper.AndroidKey, true) + $"&aid={aid}&dislike={dislike}&from=7&like={like}"
            };

            api.body += ApiUtils.GetSign(api.body, ApiHelper.AndroidKey);
            return(api);
        }
예제 #5
0
        /// <summary>
        ///一键三连
        /// </summary>
        /// <returns></returns>
        public ApiModel Triple(string aid)
        {
            ApiModel api = new ApiModel()
            {
                method  = HttpMethod.POST,
                baseUrl = $"https://app.bilibili.com/x/v2/view/like/triple",
                body    = ApiUtils.MustParameter(ApiHelper.AndroidKey, true) + $"&aid={aid}"
            };

            api.body += ApiUtils.GetSign(api.body, ApiHelper.AndroidKey);
            return(api);
        }
예제 #6
0
        /// <summary>
        /// 添加弹幕屏蔽关键词
        /// </summary>
        /// <param name="word">关键词</param>
        /// <param name="type">类型,0=关键字,1=正则,2=用户</param>
        /// <returns></returns>
        public ApiModel AddDanmuFilterWord(string word, int type)
        {
            ApiModel api = new ApiModel()
            {
                method  = HttpMethod.POST,
                baseUrl = $"https://api.bilibili.com/x/dm/filter/user/add",
                body    = ApiUtils.MustParameter(ApiUtils.AndroidVideoKey, true) + $"&filter={Uri.EscapeDataString(word)}&type={type}"
            };

            api.body += ApiUtils.GetSign(api.parameter, ApiUtils.AndroidVideoKey);
            return(api);
        }
예제 #7
0
        public ApiModel Detail(string id, bool isbvid)
        {
            ApiModel api = new ApiModel()
            {
                method    = HttpMethod.GET,
                baseUrl   = $"https://app.bilibili.com/x/v2/view",
                parameter = ApiUtils.MustParameter(ApiHelper.AndroidKey, true) + $"&{(isbvid ? "bvid=" : "aid=")}{id}&plat=0"
            };

            api.parameter += ApiUtils.GetSign(api.parameter, ApiHelper.AndroidKey);
            return(api);
        }
예제 #8
0
        /// <summary>
        /// 弹幕关键词
        /// </summary>
        /// <returns></returns>
        public ApiModel GetDanmuFilterWords()
        {
            ApiModel api = new ApiModel()
            {
                method    = HttpMethod.GET,
                baseUrl   = $"https://api.bilibili.com/x/dm/filter/user",
                parameter = ApiUtils.MustParameter(ApiUtils.AndroidVideoKey, true)
            };

            api.parameter += ApiUtils.GetSign(api.parameter, ApiUtils.AndroidVideoKey);
            return(api);
        }
예제 #9
0
        /// <summary>
        /// 番剧播放记录上传
        /// </summary>
        /// <param name="aid">AVID</param>
        /// <param name="cid">CID</param>
        /// <param name="sid">SID</param>
        /// <param name="epid">EPID</param>
        /// <param name="type">类型 3=视频,4=番剧</param>
        /// <param name="progress">进度/秒</param>
        /// <returns></returns>
        public ApiModel SeasonHistoryReport(string aid, string cid, int progress, string sid = "0", string epid = "0", int type = 3)
        {
            ApiModel api = new ApiModel()
            {
                method  = HttpMethod.POST,
                baseUrl = $"https://api.bilibili.com/x/v2/history/report",
                body    = ApiUtils.MustParameter(ApiUtils.AndroidVideoKey, true) + $"&aid={aid}&cid={cid}&epid={epid}&sid={sid}&progress={progress}&realtime={progress}&sub_type=1&type={type}"
            };

            api.body += ApiUtils.GetSign(api.body, ApiUtils.AndroidVideoKey);
            return(api);
        }
예제 #10
0
        /// <summary>
        /// 发送弹幕
        /// </summary>
        /// <param name="aid">AV</param>
        /// <param name="cid">CID</param>
        /// <param name="color">颜色(10进制)</param>
        /// <param name="msg">内容</param>
        /// <param name="position">位置</param>
        /// <param name="mode">类型</param>
        /// <param name="plat">平台</param>
        /// <returns></returns>
        public ApiModel SendDanmu(string aid, string cid, string color, string msg, int position, int mode = 1, int plat = 2)
        {
            ApiModel api = new ApiModel()
            {
                method    = HttpMethod.POST,
                baseUrl   = $"https://api.bilibili.com/x/v2/dm/post",
                parameter = ApiUtils.MustParameter(ApiUtils.AndroidVideoKey, true) + $"&aid={aid}",
                body      = $"msg={Uri.EscapeDataString(msg)}&mode={mode}&screen_state=1&color={color}&pool=0&progress={Convert.ToInt32(position * 1000)}&fontsize=25&rnd={Utils.GetTimestampS()}&from=7&oid={cid}&plat={plat}&type=1"
            };

            api.parameter += ApiUtils.GetSign(api.parameter, ApiUtils.AndroidVideoKey);
            return(api);
        }
예제 #11
0
        public ApiModel VideoPlayUrl(string aid, string cid, int qn, bool dash)
        {
            ApiModel api = new ApiModel()
            {
                method    = HttpMethod.GET,
                baseUrl   = $"https://api.bilibili.com/x/player/playurl",
                parameter = ApiUtils.MustParameter(ApiUtils.WebVideoKey, true) + $"&avid={aid}&cid={cid}&qn={qn}&type=&otype=json&mid={(ApiHelper.IsLogin() ? ApiHelper.GetUserId() : "")}"
            };

            if (dash)
            {
                api.parameter += "&fourk=1&fnver=0&fnval=16";
            }
            api.parameter += ApiUtils.GetSign(api.parameter, ApiUtils.WebVideoKey);
            return(api);
        }
예제 #12
0
        public ApiModel SeasonPlayUrlBiliPlus(string aid, string cid, int qn, int season_type, bool dash)
        {
            ApiModel api = new ApiModel()
            {
                method    = HttpMethod.GET,
                baseUrl   = $"https://www.biliplus.com/BPplayurl.php",
                parameter = $"appkey={ApiUtils.WebVideoKey.Appkey}&cid={cid}&qn={qn}&type=&otype=json&module=bangumi&season_type={season_type}"
            };

            if (ApiHelper.IsLogin())
            {
                api.parameter += $"&access_key={ApiHelper.access_key}&mid={ApiHelper.GetUserId()}";
            }
            if (dash)
            {
                api.parameter += "&fnver=0&fnval=16";
            }
            api.parameter += ApiUtils.GetSign(api.parameter, ApiUtils.WebVideoKey);
            return(api);
        }