Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public override string GetPageString(int page, int count, string keyWord, IWebProxy proxy)
        {
            // API
            booru.Url = SiteUrl + "/index.php?page=dapi&s=post&q=index&pid={0}&limit={1}&tags={2}";
            string pageString = booru.GetPageString(page, count, keyWord, proxy);

            if (GetAPImode(pageString))
            {
                return(pageString);
            }

            // Html
            booru.Url  = string.Format(SiteUrl + "/index.php?page=post&s=list&pid={0}&tags={1}", (page - 1) * 42, 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);
        }
Exemplo n.º 3
0
        public override string GetPageString(int page, int count, string keyWord, IWebProxy proxy)
        {
            // API
            string pageString = booru.GetPageString(page, count, keyWord, proxy);

            if (pageString.Contains("<post"))
            {
                APImode = true;
                return(pageString);
            }

            // Html
            booru.siteUrl = string.Format(SiteUrl + "/index.php?page=post&s=list&pid={0}&tags={1}", (page - 1) * 42, keyWord);
            booru.siteUrl = keyWord.Length < 1 ? booru.siteUrl.Substring(0, booru.siteUrl.Length - 6) : booru.siteUrl;
            pageString    = booru.GetPageString(page, 0, keyWord, proxy);
            return(pageString);
        }
Exemplo n.º 4
0
        public override string GetPageString(int page, int count, string keyWord, IWebProxy proxy)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(keyWord);
            if (srcType == Rule34srcType.Filter)
            {
                sb.Append(" ");
                sb.Append(filterTag);
            }
            return(booru.GetPageString(page, count, sb.ToString(), proxy));
        }
Exemplo n.º 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);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 取页面源码 来自官方APP处理方式
        /// </summary>
        /// <param name="page"></param>
        /// <param name="count"></param>
        /// <param name="keyWord"></param>
        /// <param name="proxy"></param>
        /// <returns></returns>
        public override string GetPageString(int page, int count, string keyWord, IWebProxy proxy)
        {
            if (sitePrefix == "chan")
            {
                ua = "SCChannelApp/2.3 (Android; black)";
            }
            else if (sitePrefix == "idol")
            {
                ua = "SCChannelApp/2.3 (Android; idol)";
            }
            else
            {
                return(null);
            }

            Login(proxy);
            return(booru.GetPageString(page, count, keyWord, proxy));
        }