Ejemplo n.º 1
0
        /// <summary>
        /// 模拟打开视频播放(初始上报一次进度)
        /// </summary>
        /// <param name="videoInfo"></param>
        /// <returns></returns>
        private bool OpenVideo(VideoInfoDto videoInfo)
        {
            var request = new UploadVideoHeartbeatRequest
            {
                Aid  = long.Parse(videoInfo.Aid),
                Bvid = videoInfo.Bvid,
                Cid  = videoInfo.Cid,

                Mid  = long.Parse(_biliBiliCookie.UserId),
                Csrf = _biliBiliCookie.BiliJct,
            };

            //开始上报一次
            BiliApiResponse apiResponse = _videoApi.UploadVideoHeartbeat(request)
                                          .GetAwaiter().GetResult();

            if (apiResponse.Code == 0)
            {
                _logger.LogDebug("打开视频成功");
                return(true);
            }
            else
            {
                _logger.LogError("视频打开失败,原因:{msg}", apiResponse.Message);
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取每日任务完成情况
        /// </summary>
        /// <returns></returns>
        public HttpResponse <DailyTaskInfo> GetDailyTaskStatus(string cookie)
        {
            HttpResponse <DailyTaskInfo> responsemodel = new HttpResponse <DailyTaskInfo>();


            DailyTaskInfo result = new();

            string     url        = "http://api.bilibili.com/x/member/web/exp/reward";
            HttpResult httpresult = _httphelper.ToGet(url, cookie);

            BiliApiResponse <DailyTaskInfo> apiResponse = JsonConvert.DeserializeObject <BiliApiResponse <DailyTaskInfo> >(httpresult.Html);


            if (apiResponse.Code == 0)
            {
                responsemodel.Code = 1;
                responsemodel.Message.Add("请求本日任务完成状态成功");
                result             = apiResponse.Data;
                responsemodel.Data = result;
            }
            else
            {
                responsemodel.Code = 0;
                responsemodel.Message.Add(string.Format("获取今日任务完成状态失败:{result}", JsonConvert.SerializeObject(apiResponse)));

                result = apiResponse.Data;
            }
            return(responsemodel);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <returns></returns>
        public UserInfo LoginByCookie()
        {
            BiliApiResponse <UserInfo> apiResponse = _userInfoApi.LoginByCookie().GetAwaiter().GetResult();

            if (apiResponse.Code != 0 || !apiResponse.Data.IsLogin)
            {
                _logger.LogWarning("登录异常,请检查Cookie是否错误或过期");
                return(null);
            }

            UserInfo useInfo = apiResponse.Data;

            //获取到UserId
            _cookie.UserId = useInfo.Mid.ToString();

            _logger.LogInformation("【用户名】 {0}", useInfo.GetFuzzyUname());
            _logger.LogInformation("【硬币余额】 {0}", useInfo.Money ?? 0);

            if (useInfo.Level_info.Current_level < 6)
            {
                _logger.LogInformation("【距升级 Lv{0}】 {1}天(如每日做满65点经验)",
                                       useInfo.Level_info.Current_level + 1,
                                       (useInfo.Level_info.GetNext_expLong() - useInfo.Level_info.Current_exp) / Constants.EveryDayExp);
            }
            else
            {
                _logger.LogInformation("【当前经验】{0} (您已是 Lv6 的大佬了,无敌是多么寂寞~)", useInfo.Level_info.Current_exp);
            }

            return(useInfo);
        }
        /// <summary>
        /// 登录
        /// </summary>
        /// <returns></returns>
        public UserInfo LoginByCookie()
        {
            BiliApiResponse <UserInfo> apiResponse = _dailyTaskApi.LoginByCookie().Result;

            if (apiResponse.Code != 0 || !apiResponse.Data.IsLogin)
            {
                _logger.LogWarning("登录异常,Cookies可能失效了,请仔细检查Github Secrets中DEDEUSERID、SESSDATA、BILI_JCT三项的值是否正确");
                return(null);
            }

            UserInfo useInfo = apiResponse.Data;

            //获取到UserId
            _cookie.SetUserId(useInfo.Mid.ToString());

            _expDic.TryGetValue("每日登录", out int exp);
            _logger.LogInformation("登录成功,经验+{exp} √", exp);
            _logger.LogInformation("用户名: {0}", useInfo.GetFuzzyUname());
            _logger.LogInformation("硬币余额: {0}", useInfo.Money ?? 0);

            if (useInfo.Level_info.Current_level < 6)
            {
                _logger.LogInformation("距离升级到Lv{0}还有: {1}天",
                                       useInfo.Level_info.Current_level + 1,
                                       (useInfo.Level_info.GetNext_expLong() - useInfo.Level_info.Current_exp) / Constants.EveryDayExp);
            }
            else
            {
                _logger.LogInformation("当前等级Lv6,经验值为:{0}", useInfo.Level_info.Current_exp);
            }

            return(useInfo);
        }
Ejemplo n.º 5
0
        private VideoInfoDto GetRandomVideoOfFollowingUps()
        {
            //配置的UpId
            int configUpsCount = _dailyTaskOptions.SupportUpIdList.Count;

            if (configUpsCount > 0)
            {
                VideoInfoDto video = GetRandomVideoOfUps(_dailyTaskOptions.SupportUpIdList);
                if (video != null)
                {
                    return(video);
                }
            }

            //关注列表
            var request = new GetFollowingsRequest(long.Parse(_biliBiliCookie.UserId));
            BiliApiResponse <GetFollowingsResponse> result = _relationApi.GetFollowings(request)
                                                             .GetAwaiter().GetResult();

            if (result.Data.Total > 0)
            {
                VideoInfoDto video = GetRandomVideoOfUps(result.Data.List.Select(x => x.Mid).ToList());
                if (video != null)
                {
                    return(video);
                }
            }

            return(null);
        }
Ejemplo n.º 6
0
        private Tuple <string, string> GetRandomVideoOfFollowingUps()
        {
            //配置的UpId
            int configUpsCount = _dailyTaskOptions.SupportUpIdList.Count;

            if (configUpsCount > 0)
            {
                Tuple <string, string> video = GetRandomVideoOfUps(_dailyTaskOptions.SupportUpIdList);
                if (video != null)
                {
                    return(video);
                }
            }

            //关注列表
            BiliApiResponse <GetFollowingsResponse> result = _relationApi.GetFollowings(_biliBiliCookieOptions.UserId).GetAwaiter().GetResult();

            if (result.Data.Total > 0)
            {
                Tuple <string, string> video = GetRandomVideoOfUps(result.Data.List.Select(x => x.Mid).ToList());
                if (video != null)
                {
                    return(video);
                }
            }

            return(null);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 观看视频
        /// </summary>
        public void WatchVideo(VideoInfoDto videoInfo)
        {
            //开始上报一次
            OpenVideo(videoInfo);

            //结束上报一次
            videoInfo.Duration = videoInfo.Duration ?? 15;
            int max        = videoInfo.Duration < 15 ? videoInfo.Duration.Value : 15;
            int playedTime = new Random().Next(1, max);

            var request = new UploadVideoHeartbeatRequest
            {
                Aid  = long.Parse(videoInfo.Aid),
                Bvid = videoInfo.Bvid,
                Cid  = videoInfo.Cid,
                Mid  = long.Parse(_biliBiliCookie.UserId),
                Csrf = _biliBiliCookie.BiliJct,

                Played_time      = playedTime,
                Realtime         = playedTime,
                Real_played_time = playedTime,
            };
            BiliApiResponse apiResponse = _videoApi.UploadVideoHeartbeat(request)
                                          .GetAwaiter().GetResult();

            if (apiResponse.Code == 0)
            {
                _expDic.TryGetValue("每日观看视频", out int exp);
                _logger.LogInformation("视频播放成功,已观看到第{playedTime}秒,经验+{exp} √", playedTime, exp);
            }
            else
            {
                _logger.LogError("视频播放失败,原因:{msg}", apiResponse.Message);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <returns></returns>
        public UserInfo LoginByCookie()
        {
            BiliApiResponse <UserInfo> apiResponse = _userInfoApi.LoginByCookie().GetAwaiter().GetResult();

            if (apiResponse.Code != 0 || !apiResponse.Data.IsLogin)
            {
                _logger.LogWarning("登录异常,请检查Cookie是否错误或过期");
                return(null);
            }

            UserInfo useInfo = apiResponse.Data;

            //获取到UserId
            _cookie.UserId = useInfo.Mid.ToString();

            _expDic.TryGetValue("每日登录", out int exp);
            _logger.LogInformation("登录成功,经验+{exp} √", exp);
            _logger.LogInformation("用户名: {0}", useInfo.GetFuzzyUname());
            _logger.LogInformation("硬币余额: {0}", useInfo.Money ?? 0);

            if (useInfo.Level_info.Current_level < 6)
            {
                _logger.LogInformation("如每日做满65点经验,距离升级到 Lv{0} 还有: {1}天",
                                       useInfo.Level_info.Current_level + 1,
                                       (useInfo.Level_info.GetNext_expLong() - useInfo.Level_info.Current_exp) / Constants.EveryDayExp);
            }
            else
            {
                _logger.LogInformation("您已是 Lv6 的大佬了,当前经验:{0},无敌是多么寂寞~", useInfo.Level_info.Current_exp);
            }

            return(useInfo);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 月底自动给自己充电
        /// 仅充会到期的B币券,低于2的时候不会充
        /// </summary>
        public void Charge(UseInfo userInfo)
        {
            if (_dailyTaskOptions.DayOfAutoCharge == 0)
            {
                _logger.LogInformation("已配置为不进行自动充电,跳过充电任务");
                return;
            }

            int targetDay = _dailyTaskOptions.DayOfAutoCharge == -1
                ? DateTime.Today.LastDayOfMonth().Day
                : _dailyTaskOptions.DayOfAutoCharge;

            if (DateTime.Today.Day != targetDay)
            {
                _logger.LogInformation("目标充电日期为{targetDay}号,今天是{today}号,跳过充电任务", targetDay, DateTime.Today.Day);
                return;
            }

            //B币券余额
            decimal couponBalance = userInfo.Wallet.Coupon_balance;

            if (couponBalance < 2)
            {
                _logger.LogInformation("不是年度大会员或已过期,无法充电");
                return;
            }

            //大会员类型
            int vipType = userInfo.GetVipType();

            if (vipType != 2)
            {
                _logger.LogInformation("不是年度大会员或已过期,无法充电");
                return;
            }

            BiliApiResponse <ChargeResponse> response = _dailyTaskApi.Charge(couponBalance * 10, _cookieOptions.UserId, _cookieOptions.UserId, _cookieOptions.BiliJct).Result;

            if (response.Code == 0)
            {
                if (response.Data.Status == 4)
                {
                    _logger.LogInformation("给自己充电成功啦,送的B币券没有浪费哦");
                    _logger.LogInformation("本次给自己充值了: {num}个电池哦", couponBalance * 10);

                    //获取充电留言token
                    ChargeComments(response.Data.Order_no);
                }
                else
                {
                    _logger.LogDebug("充电失败了啊 原因:{reason}", response.ToJson());
                }
            }
            else
            {
                _logger.LogDebug("充电失败了啊 原因:{reason}", response.Message);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 获取UP主的视频总数量
        /// </summary>
        /// <param name="upId"></param>
        /// <returns></returns>
        private int GetVidoeCountOfUp(long upId)
        {
            BiliApiResponse <SearchUpVideosResponse> re = _dailyTaskApi.SearchVideosByUpId(upId, 1, 1).Result;

            if (re.Code != 0)
            {
                throw new Exception(re.Message);
            }

            return(re.Data.Page.Count);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 获取UP主的视频总数量
        /// </summary>
        /// <param name="upId"></param>
        /// <returns></returns>
        public int GetVideoCountOfUp(long upId)
        {
            //todo:通过获取分页实现的,有待改善
            BiliApiResponse <SearchUpVideosResponse> re = _dailyTaskApi.SearchVideosByUpId(upId, 1, 1).GetAwaiter().GetResult();

            if (re.Code != 0)
            {
                throw new Exception(re.Message);
            }

            return(re.Data.Page.Count);
        }
        /// <summary>
        /// 尝试从普通关注的Up主中随机获取一个可以投币的视频
        /// </summary>
        /// <param name="tryCount"></param>
        /// <returns></returns>
        private Tuple <string, string> TryGetCanDonateVideoByFollowingUps(int tryCount)
        {
            //获取特别关注列表
            BiliApiResponse <GetFollowingsResponse> result = _relationApi.GetFollowings(_biliBiliCookieOptions.UserId).Result;

            if (result.Data.Total == 0)
            {
                return(null);
            }

            return(TryCanDonateVideoByUps(result.Data.List.Select(x => x.Mid).ToList(), tryCount));
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 获取随机视频
        /// </summary>
        /// <returns></returns>
        public Tuple <string, string> GetRandomVideoOfRegion()
        {
            int[] arr = { 1, 3, 4, 5, 160, 22, 119 };
            int   rid = arr[new Random().Next(arr.Length - 1)];

            BiliApiResponse <List <RankingInfo> > apiResponse = _dailyTaskApi.GetRegionRankingVideos(rid, 3).GetAwaiter().GetResult();

            _logger.LogDebug("获取分区:{rid}的{day}日top10榜单成功", rid, 3);
            RankingInfo data = apiResponse.Data[new Random().Next(apiResponse.Data.Count)];

            return(Tuple.Create(data.Aid, data.Title));
        }
        /// <summary>
        /// 尝试从特别关注的Up主中随机获取一个可以投币的视频
        /// </summary>
        /// <param name="tryCount"></param>
        /// <returns></returns>
        private Tuple <string, string> TryGetCanDonateVideoBySpecialUps(int tryCount)
        {
            //获取特别关注列表
            BiliApiResponse <List <UpInfo> > specials = _relationApi.GetSpecialFollowings().Result;

            if (specials.Data == null || specials.Data.Count == 0)
            {
                return(null);
            }

            return(TryCanDonateVideoByUps(specials.Data.Select(x => x.Mid).ToList(), tryCount));
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 获取UP主的视频总数量
        /// </summary>
        /// <param name="upId"></param>
        /// <returns></returns>
        public int GetVideoCountOfUp(long upId)
        {
            BiliApiResponse <SearchUpVideosResponse> re = _videoWithoutCookieApi.SearchVideosByUpId(upId)
                                                          .GetAwaiter().GetResult();

            if (re.Code != 0)
            {
                throw new Exception(re.Message);
            }

            return(re.Data.Page.Count);
        }
Ejemplo n.º 16
0
        public UpVideoInfo GetRandomVideoOfUp(long upId, int total)
        {
            int pageNum = new Random().Next(1, total + 1);
            BiliApiResponse <SearchUpVideosResponse> re = _dailyTaskApi.SearchVideosByUpId(upId, 1, pageNum).GetAwaiter().GetResult();

            if (re.Code != 0)
            {
                throw new Exception(re.Message);
            }

            return(re.Data.List.Vlist.First());
        }
        /// <summary>
        /// 尝试从特别关注的Up主中随机获取一个可以投币的视频
        /// </summary>
        /// <param name="tryCount"></param>
        /// <returns></returns>
        private Tuple <string, string> TryGetCanDonateVideoBySpecialUps(int tryCount)
        {
            //获取特别关注列表
            var request = new GetSpecialFollowingsRequest(long.Parse(_biliBiliCookie.UserId));
            BiliApiResponse <List <UpInfo> > specials = _relationApi.GetSpecialFollowings(request)
                                                        .GetAwaiter().GetResult();

            if (specials.Data == null || specials.Data.Count == 0)
            {
                return(null);
            }

            return(TryCanDonateVideoByUps(specials.Data.Select(x => x.Mid).ToList(), tryCount));
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 分享视频
        /// </summary>
        /// <param name="aid">视频aid</param>
        public void ShareVideo(string aid, string title = "")
        {
            BiliApiResponse apiResponse = _dailyTaskApi.ShareVideo(aid, _biliBiliCookieOptions.BiliJct).Result;

            if (apiResponse.Code == 0)
            {
                _logger.LogInformation("视频分享成功");
            }
            else
            {
                _logger.LogInformation("视频分享失败,原因: {msg}", apiResponse.Message);
                _logger.LogDebug("开发者提示: 如果是csrf校验失败请检查BILI_JCT参数是否正确或者失效");
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 分享视频
        /// </summary>
        /// <param name="aid">视频aid</param>
        public void ShareVideo(string aid, string title = "")
        {
            BiliApiResponse apiResponse = _dailyTaskApi.ShareVideo(aid, _biliBiliCookieOptions.BiliJct).GetAwaiter().GetResult();

            if (apiResponse.Code == 0)
            {
                _expDic.TryGetValue("每日观看视频", out int exp);
                _logger.LogInformation("视频分享成功,经验+{exp} √", exp);
            }
            else
            {
                _logger.LogError("视频分享失败,原因: {msg}", apiResponse.Message);
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 观看视频
        /// </summary>
        public void WatchVideo(string aid, string title = "")
        {
            int             playedTime  = new Random().Next(1, 90);
            BiliApiResponse apiResponse = _dailyTaskApi.UploadVideoHeartbeat(aid, playedTime).Result;

            if (apiResponse.Code == 0)
            {
                _logger.LogInformation("视频播放成功,已观看到第{playedTime}秒", playedTime);
            }
            else
            {
                _logger.LogDebug("视频播放失败,原因:{msg}", apiResponse.Message);
            }
        }
        /// <summary>
        /// 尝试从普通关注的Up主中随机获取一个可以投币的视频
        /// </summary>
        /// <param name="tryCount"></param>
        /// <returns></returns>
        private Tuple <string, string> TryGetCanDonateVideoByFollowingUps(int tryCount)
        {
            //获取特别关注列表
            var request = new GetFollowingsRequest(long.Parse(_biliBiliCookie.UserId));
            BiliApiResponse <GetFollowingsResponse> result = _relationApi.GetFollowings(request)
                                                             .GetAwaiter().GetResult();

            if (result.Data.Total == 0)
            {
                return(null);
            }

            return(TryCanDonateVideoByUps(result.Data.List.Select(x => x.Mid).ToList(), tryCount));
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 观看视频
        /// </summary>
        public void WatchVideo(string aid, string title = "")
        {
            int             playedTime  = new Random().Next(1, 15);
            BiliApiResponse apiResponse = _dailyTaskApi.UploadVideoHeartbeat(aid, playedTime).GetAwaiter().GetResult();

            if (apiResponse.Code == 0)
            {
                _expDic.TryGetValue("每日观看视频", out int exp);
                _logger.LogInformation("视频播放成功,已观看到第{playedTime}秒,经验+{exp} √", playedTime, exp);
            }
            else
            {
                _logger.LogError("视频播放失败,原因:{msg}", apiResponse.Message);
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// 观看视频
        /// </summary>
        public void WatchVideo(VideoInfoDto videoInfo)
        {
            int             playedTime  = new Random().Next(5, videoInfo.SecondsLength ?? 15);
            BiliApiResponse apiResponse = _dailyTaskApi.UploadVideoHeartbeat(videoInfo.Aid, playedTime)
                                          .GetAwaiter().GetResult();

            if (apiResponse.Code == 0)
            {
                _expDic.TryGetValue("每日观看视频", out int exp);
                _logger.LogInformation("视频播放成功,已观看到第{playedTime}秒,经验+{exp} √", playedTime, exp);
            }
            else
            {
                _logger.LogError("视频播放失败,原因:{msg}", apiResponse.Message);
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 分享视频
        /// </summary>
        /// <param name="aid">视频aid</param>
        public void ShareVideo(VideoInfoDto videoInfo)
        {
            var             request     = new ShareVideoRequest(long.Parse(videoInfo.Aid), _biliBiliCookie.BiliJct);
            BiliApiResponse apiResponse = _videoApi.ShareVideo(request)
                                          .GetAwaiter().GetResult();

            if (apiResponse.Code == 0)
            {
                _expDic.TryGetValue("每日观看视频", out int exp);
                _logger.LogInformation("视频分享成功,经验+{exp} √", exp);
            }
            else
            {
                _logger.LogError("视频分享失败,原因: {msg}", apiResponse.Message);
            }
        }
Ejemplo n.º 25
0
        public UpVideoInfo GetRandomVideoOfUp(long upId, int total)
        {
            if (total <= 0)
            {
                return(null);
            }

            int pageNum = new Random().Next(1, total + 1);
            BiliApiResponse <SearchUpVideosResponse> re = _videoWithoutCookieApi.SearchVideosByUpId(upId, 1, pageNum).GetAwaiter().GetResult();

            if (re.Code != 0)
            {
                throw new Exception(re.Message);
            }

            return(re.Data.List.Vlist.FirstOrDefault());
        }
        /// <summary>
        /// 获取每日任务完成情况
        /// </summary>
        /// <returns></returns>
        public DailyTaskInfo GetDailyTaskStatus()
        {
            DailyTaskInfo result = new();
            BiliApiResponse <DailyTaskInfo> apiResponse = _dailyTaskApi.GetDailyTaskRewardInfo().Result;

            if (apiResponse.Code == 0)
            {
                _logger.LogDebug("请求本日任务完成状态成功");
                result = apiResponse.Data;
            }
            else
            {
                _logger.LogWarning("获取今日任务完成状态失败:{result}", apiResponse.ToJson());
                result = _dailyTaskApi.GetDailyTaskRewardInfo().Result.Data;
                //todo:偶发性请求失败,再请求一次,这么写很丑陋,待用polly再框架层面实现
            }

            return(result);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// 领取大会员每月赠送福利
        /// </summary>
        /// <param name="type">1.大会员B币券;2.大会员福利</param>
        private bool ReceiveVipPrivilege(int type, BiliCookie bilicookie, out string message)
        {
            string          csrf        = bilicookie.BiliJct;
            string          url         = string.Format("http://api.bilibili.com/x/vip/privilege/receive?type={0}&csrf={1}", type, csrf);
            var             response    = _httphelper.ToPost(url, bilicookie.CookieStr, "");
            BiliApiResponse apiResponse = JsonConvert.DeserializeObject <BiliApiResponse>(response.Html);
            var             name        = GetPrivilegeName(type);

            if (apiResponse.Code == 0)
            {
                _logger.LogDebug($"{name}成功");
                message = $"{name}成功";
                return(true);
            }
            else
            {
                _logger.LogError($"{name}失败,原因: {apiResponse.Message}");
                message = $"{name}失败,原因: {apiResponse.Message}";
                return(false);
            }
        }
        /// <summary>
        /// 为视频投币
        /// </summary>
        /// <param name="aid">av号</param>
        /// <param name="multiply">投币数量</param>
        /// <param name="select_like">是否同时点赞 1是0否</param>
        /// <returns>是否投币成功</returns>
        public bool DoAddCoinForVideo(string aid, int multiply, bool select_like, string title = "")
        {
            BiliApiResponse result = _dailyTaskApi.AddCoinForVideo(aid, multiply, select_like ? 1 : 0, _biliBiliCookieOptions.BiliJct).Result;

            if (result.Code == 0)
            {
                _logger.LogInformation("为“{title}”投币成功", title);
                return(true);
            }

            if (result.Code == -111)
            {
                string errorMsg = $"投币异常,Cookie配置项[BiliJct]错误或已过期,请检查并更新。接口返回:{result.Message}";
                _logger.LogError(errorMsg);
                throw new Exception(errorMsg);
            }
            else
            {
                _logger.LogInformation("为“{title}”投币失败,原因:{msg}", title, result.Message);
                return(false);
            }
        }
Ejemplo n.º 29
0
        public HttpResponse <BiliUserInfo> LoginByCookie(string cookie)
        {
            HttpResponse <BiliUserInfo> responsemodel = new HttpResponse <BiliUserInfo>();
            HttpHelper _http            = new HttpHelper();
            string     BiLiLoginForSure = "http://api.bilibili.com/x/web-interface/nav";
            HttpResult result           = _httphelper.ToGet(BiLiLoginForSure, cookie);

            BiliApiResponse <BiliUserInfo> apiResponse = JsonConvert.DeserializeObject <BiliApiResponse <BiliUserInfo> >(result.Html);

            if (apiResponse.Code != 0 || !apiResponse.Data.IsLogin)
            {
                responsemodel.Code = 0;
                responsemodel.Message.Add("登录异常,请检查Cookie是否错误或过期");
                _logger.LogWarning("登录异常,请检查Cookie是否错误或过期");
                return(responsemodel);
            }

            responsemodel.Code = 1;

            BiliUserInfo useInfo = apiResponse.Data;

            responsemodel.Message.Add("登录成功");
            responsemodel.Message.Add(string.Format("用户名: {0}", useInfo.GetFuzzyUname()));
            responsemodel.Message.Add(string.Format("硬币余额: {0}", useInfo.Money ?? 0));
            responsemodel.Data = useInfo;

            if (useInfo.Level_info.Current_level < 6)
            {
                responsemodel.Message.Add(string.Format("如每日做满65点经验,距离升级到 Lv{0} 还有: {1}天",
                                                        useInfo.Level_info.Current_level + 1,
                                                        (useInfo.Level_info.GetNext_expLong() - useInfo.Level_info.Current_exp) / 65));
            }
            else
            {
                responsemodel.Message.Add(string.Format("您已是 Lv6 的大佬了,当前经验:{0},无敌是多么寂寞~", useInfo.Level_info.Current_exp));
            }
            return(responsemodel);
        }
        /// <summary>
        /// 为视频投币
        /// </summary>
        /// <param name="aid">av号</param>
        /// <param name="multiply">投币数量</param>
        /// <param name="select_like">是否同时点赞 1是0否</param>
        /// <returns>是否投币成功</returns>
        public bool DoAddCoinForVideo(string aid, int multiply, bool select_like, string title = "")
        {
            BiliApiResponse result = _dailyTaskApi.AddCoinForVideo(aid, multiply, select_like ? 1 : 0, _biliBiliCookieOptions.BiliJct).Result;

            if (result.Code == 0)
            {
                _expDic.TryGetValue("每日投币", out int exp);
                _logger.LogInformation("为“{title}”投币成功,经验+{exp} √", title, exp);
                return(true);
            }

            if (_donateContinueStatusDic.Any(x => x.Key == result.Code.ToString()))
            {
                _logger.LogError("尝试为“{title}”投币失败,原因:{msg}", title, result.Message);
                return(false);
            }

            else
            {
                string errorMsg = $"投币发生未预计异常。接口返回:{result.Message}";
                _logger.LogError(errorMsg);
                throw new Exception(errorMsg);
            }
        }