예제 #1
0
        //public override bool IsSupportCount { get { return false; } }

        public SiteGelbooru()
        {
            booru = new SiteBooru(
                SiteUrl + "/index.php?page=dapi&s=post&q=index&pid={0}&limit={1}&tags={2}"
                , SiteUrl + "/index.php?page=dapi&s=tag&q=index&order=name&limit={0}&name={1}"
                , SiteName, ShortName, Referer, true, BooruProcessor.SourceType.XML);
        }
예제 #2
0
        /// <summary>
        /// 这破站用API需要登录!(╯‵□′)╯︵┻━┻
        /// 两个图站的账号还不通用(╯‵□′)╯︵┻━┻
        /// </summary>
        /// <param name="proxy"></param>
        private void Login(IWebProxy proxy)
        {
            string subdomain = sitePrefix.Substring(0, 1),
                   loginhost = "https://";

            subdomain += subdomain.Contains("c") ? "api-beta" : "api";
            loginhost += $"{subdomain}.sankakucomplex.com";

            if (string.IsNullOrWhiteSpace(cookie) || !cookie.Contains(subdomain + ".sankaku"))
            {
                try
                {
                    cookie = string.Empty;
                    int index = rand.Next(0, user.Length);
                    tempuser   = user[index];
                    temppass   = GetSankakuPwHash(pass[index]);
                    tempappkey = GetSankakuAppkey(tempuser);
                    string post = cookie;

                    if (subdomain.Contains("capi"))
                    {
                        post = "user[name]=" + tempuser + "&user[password]=" + pass[index] + "&appkey=" + tempappkey;
                    }
                    else
                    {
                        post = "login="******"&password_hash=" + temppass + "&appkey=" + tempappkey;
                    }

                    //Post登录取Cookie
                    shc.UserAgent   = ua;
                    shc.Referer     = Referer;
                    shc.Accept      = SessionHeadersValue.AcceptAppJson;
                    shc.ContentType = SessionHeadersValue.ContentTypeFormUrlencoded;
                    Sweb.Post(loginhost + "/user/authenticate.json", post, proxy, shc);
                    cookie = Sweb.GetURLCookies(loginhost);

                    if (sitePrefix == "idol" && !cookie.Contains("sankakucomplex_session"))
                    {
                        throw new Exception("获取登录Cookie失败");
                    }
                    else
                    {
                        cookie = subdomain + ".sankaku;" + cookie;
                    }

                    pageurl = loginhost + "/post/index.json?login="******"&password_hash="
                              + temppass + "&appkey=" + tempappkey + "&page={0}&limit={1}&tags={2}";


                    //登录成功才能初始化Booru类型站点
                    shc.Referer = Referer;
                    booru       = new SiteBooru(SiteUrl, pageurl, null, SiteName, ShortName, false, BooruProcessor.SourceType.JSONSku, shc);
                }
                catch (Exception e)
                {
                    throw new Exception("自动登录失败: " + e.Message);
                }
            }
        }
예제 #3
0
        public override string GetPageString(int page, int count, string keyWord, IWebProxy proxy)
        {
            string pageString = string.Empty;

            // API
            // JSON
            if (apiMode == APImode.NULL || apiMode == APImode.JSON)
            {
                booru.Url  = $"{SiteUrl}/index.php?page=dapi&s=post&q=index&pid={{0}}&limit={{1}}&json=1&tags={{2}}";
                pageString = booru.GetPageString(page, count, keyWord, proxy);
                if (pageString.Length < 24)
                {
                    return(pageString);
                }
                if (GetAPImode(pageString) == APImode.JSON)
                {
                    apiMode = APImode.JSON; return(pageString);
                }
            }
            // XML
            if (apiMode == APImode.NULL || apiMode == APImode.XML)
            {
                booru = new SiteBooru(
                    SiteUrl, string.Empty, $"{SiteUrl}/index.php?page=dapi&s=tag&q=index&order=name&limit={{0}}&name={{1}}"
                    , SiteName, ShortName, Referer, true, BooruProcessor.SourceType.XML)
                {
                    Url = $"{SiteUrl}/index.php?page=dapi&s=post&q=index&pid={{0}}&limit={{1}}&tags={{2}}"
                };
                pageString = booru.GetPageString(page, count, keyWord, proxy);
                if (pageString.Length < 24)
                {
                    return(pageString);
                }
                if (GetAPImode(pageString) == APImode.XML)
                {
                    apiMode = APImode.XML; return(pageString);
                }
            }
            // Html
            if (apiMode == APImode.NULL || apiMode == APImode.OTHER)
            {
                booru.Url  = $"{SiteUrl}/index.php?page=post&s=list&pid={{0}}&tags={{1}}";
                pageString = booru.GetPageString((page - 1) * 42, 0, keyWord, proxy);
                if (pageString.Length < 24)
                {
                    return(pageString);
                }
                apiMode = APImode.OTHER;
            }
            return(pageString);
        }
예제 #4
0
        public SiteRule34(Rule34srcType srcType)
        {
            this.srcType = srcType;
            booru        = new SiteBooru(
                SiteUrl,
                SiteUrl + "/index.php?page=dapi&s=post&q=index&pid={0}&limit={1}&tags={2}",
                SiteUrl + "/autocomplete.php?q={0}",
                SiteName, ShortName, Referer, true, BooruProcessor.SourceType.XML);
            StringBuilder sb = new StringBuilder();

            sb.Append("-anthro -lisa_simpson -animal -lapis_lazuli_(steven_universe) -lapis_lazuli_(jewel_pet) -abs -yaoi -yamatopawa");
            sb.Append("-starit -horizontal_cloaca -animal_genitalia -princess_zelda -legoman -soul_calibur -soulcalibur -spiderman");
            sb.Append("-spiderman_(series) -gardevoir -dragon_ball -dragon_ball_z -b******g -labor -zwijgen -my_little_pony -army");
            sb.Append("-nintendo -family_guy -alien -butt_grab -halo_(series) -justmegabenewell -sangheili -mammal -madeline_fenton");
            sb.Append("-onigrift -widowmaker -mastodon -mmjsoh -iontoon -zootopia -torbj?rn -noill -canine -dragon -sonic_(series) -blood");
            sb.Append("-phillipthe2 -sims_4 -dota -bull_(noill) -gats -adventure_time -undertale -xmen -disney -alyssa_bbw -pernalonga -bones");
            sb.Append("-mark -dexter's_laboratory -camp_lazlo -male_only -steven_universe -bara -princess_peach -super_mario_bros. -athorment");
            sb.Append("-male_focus -autofellatio -llortor -super_saiyan -aka6 -resident_evil -street_fighter -avian -dc -haydee -world_of_warcraft");
            sb.Append("-scalie -male_pov -animal_humanoid -kirby_(series) -mcarson -huge_cock -dickgirl -rasmustheowl -velma_dinkley -irispoplar");
            sb.Append("-the_legend_of_zelda -cuphead_(game) -male -mukucookie -exitation -don't_starve -kid -batmetal -barbara_gordon");
            filterTag = sb.ToString();
        }
예제 #5
0
        public override string GetPageString(int page, int count, string keyWord, IWebProxy proxy)
        {
            // API
            // JSON
            booru.Url = $"{SiteUrl}/index.php?page=dapi&s=post&q=index&pid={{0}}&limit={{1}}&json=1&tags={{2}}";
            string pageString = booru.GetPageString(page, count, keyWord, proxy);

            if (GetAPImode(pageString) == APImode.JSON)
            {
                return(pageString);
            }

            // XML
            if (pageString.Length < 24)
            {
                return(pageString);
            }
            booru = new SiteBooru(
                SiteUrl, string.Empty, $"{SiteUrl}/index.php?page=dapi&s=tag&q=index&order=name&limit={{0}}&name={{1}}"
                , SiteName, ShortName, Referer, true, BooruProcessor.SourceType.XML)
            {
                Url = $"{SiteUrl}/index.php?page=dapi&s=post&q=index&pid={{0}}&limit={{1}}&tags={{2}}"
            };
            pageString = booru.GetPageString(page, count, keyWord, proxy);
            if (GetAPImode(pageString) == APImode.XML)
            {
                return(pageString);
            }

            // Html
            if (pageString.Length < 24)
            {
                return(pageString);
            }
            booru.Url  = $"{SiteUrl}/index.php?page=post&s=list&pid={(page - 1) * 42}&tags={keyWord}";
            booru.Url  = keyWord.Length < 1 ? booru.Url.Substring(0, booru.Url.Length - 6) : booru.Url;
            pageString = booru.GetPageString(page, 0, keyWord, proxy);
            return(pageString);
        }
예제 #6
0
        //public override bool IsSupportCount { get { return false; } }

        public SiteGelbooru()
        {
            booru = new SiteBooru(
                SiteUrl, "", SiteUrl + "/index.php?page=dapi&s=tag&q=index&order=name&limit={0}&name={1}"
                , SiteName, ShortName, Referer, true, BooruProcessor.SourceType.JSONGelbooru);
        }