Beispiel #1
0
        public override async Task <MoeItems> GetRealPageImagesAsync(SearchPara para, CancellationToken token)
        {
            if (Net?.HttpClientHandler?.CookieContainer == null)
            {
                Net = new NetOperator(Settings, HomeUrl);
                Net.HttpClientHandler.AllowAutoRedirect = true;
                Net.HttpClientHandler.UseCookies        = true;
                var cc = GetCookies();
                if (cc == null)
                {
                    Extend.ShowMessage("需要重新登录Pixiv站点", null, Extend.MessagePos.Window);
                    Net = null;
                    return(null);
                }
                Net.HttpClientHandler.CookieContainer = cc;
                Net.SetTimeOut(40);
            }
            else
            {
                Net = Net.CloneWithOldCookie();
            }

            var imgs = new MoeItems();

            switch ((SearchTypeEnum)para.SubMenuIndex)
            {
            case SearchTypeEnum.TagOrNew:
                await SearchByNewOrTag(imgs, para, token);

                break;

            case SearchTypeEnum.Author:     // 作者 member id  word = "4338012"; // test
                if (para.Keyword.ToInt() == 0)
                {
                    Extend.ShowMessage("参数错误,必须在关键词中指定画师 id(纯数字)", null, Extend.MessagePos.Window);
                }
                else
                {
                    await SearchByAuthor(imgs, para.Keyword.Trim(), para, token);
                }
                break;

            case SearchTypeEnum.Rank:
                await SearchByRank(imgs, para, token);

                break;
            }

            token.ThrowIfCancellationRequested();
            return(imgs);
        }
Beispiel #2
0
        //public override async Task<bool> ThumbAsync(MoeItem item, CancellationToken token)
        //{
        //    if (!IsLogin()) return false;
        //    var r = await AccountNet.Client.PostAsync()
        //}

        public bool Login()
        {
            AccountNet = new NetOperator(Settings, HomeUrl);
            AccountNet.HttpClientHandler.AllowAutoRedirect = true;
            AccountNet.HttpClientHandler.UseCookies        = true;
            var cc = GetCookies();

            if (cc == null)
            {
                Extend.ShowMessage("需要重新登录", null, Extend.MessagePos.Window);
                AccountNet = null;
                return(false);
            }
            AccountNet.HttpClientHandler.CookieContainer = cc;
            AccountNet.SetTimeOut(40);
            return(true);
        }
Beispiel #3
0
    public async Task LoginAsync(CancellationToken token)
    {
        Net = new NetOperator(Settings, this);
        Net.SetTimeOut(20);
        var index   = new Random().Next(0, _user.Length);
        var content = new FormUrlEncodedContent(new Dictionary <string, string>
        {
            { "login", _user[index] },
            { "password", _pass[index] }
        });
        var respose =
            await Net.Client.PostAsync($"{HomeUrl}/login/submit", content, token); // http://mjv-art.org/login/submit

        if (respose.IsSuccessStatusCode)
        {
            IsLogon = true;
        }
        else
        {
            Ex.Log("https://anime-pictures.net 网站登陆失败");
        }
    }