public void Login() { Net = new NetOperator(Settings, this); var cc = SiteSettings.GetCookieContainer(); if (cc != null) { Net.SetCookie(cc); } }
public override async Task <SearchedPage> GetRealPageAsync(SearchPara para, CancellationToken token) { var islogin = CheckIsLogin(); if (!islogin) { return(null); } if (Net == null) { Net = new NetOperator(Settings, this); Net.SetCookie(SiteSettings.GetCookieContainer()); } var net = Net.CloneWithCookie(); net.SetTimeOut(40); var imgs = new SearchedPage(); if (para.MirrorSite.IsDefault) { switch ((SearchTypeEnum)para.Lv2MenuIndex) { case SearchTypeEnum.TagOrNew: await SearchByNewOrTag(net, imgs, para, token); break; case SearchTypeEnum.Author: // 作者 member id word = "4338012"; // test if (para.Keyword.ToInt() == 0) { Ex.ShowMessage("参数错误,必须在关键词中指定画师 id(纯数字)", null, Ex.MessagePos.Window); } else { await SearchByAuthor(net, imgs, para.Keyword.Trim(), para, token); } break; case SearchTypeEnum.Rank: await SearchByRank(net, imgs, para, token); break; } } else { await SearchViaMirrorSite(net, imgs, para, token); } token.ThrowIfCancellationRequested(); return(imgs); }
public void Login() { Net = new NetOperator(Settings, this); var cc = SiteSettings.GetCookieContainer(); if (cc == null) { return; } Net.SetCookie(cc); IsUserLogin = true; }
public override async Task <AutoHintItems> GetAutoHintItemsAsync(SearchPara para, CancellationToken token) { // if (para.MirrorSite != null) return null; var islogin = CheckIsLogin(); if (!islogin) { return(null); } if (AutoHintNet == null) { AutoHintNet = new NetOperator(Settings, this); AutoHintNet.SetCookie(SiteSettings.GetCookieContainer()); } var net = AutoHintNet.CloneWithCookie(); net.SetTimeOut(15); net.SetReferer(HomeUrl); var items = new AutoHintItems(); if (para.Lv2MenuIndex != 0 && para.Lv2MenuIndex != 5) { return(items); } var url = $"{HomeUrl}/rpc/cps.php?keyword={para.Keyword}"; var jList = await net.GetJsonAsync(url, token : token); foreach (var obj in Ex.GetList(jList?.candidates)) { items.Add($"{obj.tag_name}"); } return(items); }
public override async Task <MoeItems> GetRealPageImagesAsync(SearchPara para, CancellationToken token) { var imgs = new MoeItems(); const string api = "https://capi-v2.sankakucomplex.com"; const string beta = "https://beta.sankakucomplex.com"; if (Net == null) { Net = new NetOperator(Settings, api); var cc = GetCookies(); if (cc != null) { Net.SetCookie(cc); } } else { Net.CloneWithOldCookie(); } Net.SetReferer(beta); var pairs = new Pairs { { "lang", "en" }, { "next", $"{para.NextPagePara}" }, { "limit", $"{para.Count}" }, { "hide_posts_in_books", "in-larger-tags" }, { "default_threshold", "1" }, { "tags", para.Keyword.ToEncodedUrl() } }; var json = await Net.GetJsonAsync($"{api}/posts/keyset", token, pairs); para.NextPagePara = $"{json.meta.next}"; foreach (var jitem in Extend.GetList(json.data)) { var img = new MoeItem(this, para) { Net = Net.CloneWithOldCookie(), Id = $"{jitem.id}".ToInt(), Width = $"{jitem.width}".ToInt(), Height = $"{jitem.height}".ToInt(), Score = $"{jitem.total_score}".ToInt() }; img.Urls.Add(1, $"{jitem.preview_url}", beta); img.Urls.Add(2, $"{jitem.sample_url}", beta); img.Urls.Add(4, $"{jitem.file_url}", $"{beta}/post/show/{img.Id}"); img.IsExplicit = $"{jitem.rating}" != "s"; img.Date = $"{jitem.created_at?.s}".ToDateTime(); img.Uploader = $"{jitem.author?.name}"; img.DetailUrl = $"{beta}/post/show/{img.Id}"; if ($"{jitem.redirect_to_signup}".ToLower() == "true") { img.Tip = "此图片需要登录查看"; } foreach (var tag in Extend.GetList(jitem.tags)) { img.Tags.Add($"{tag.name_en}"); } img.OriginString = $"{jitem}"; imgs.Add(img); } return(imgs); }