Exemplo n.º 1
0
        public override string GetPageString(int page, int count, string keyWord, IWebProxy proxy)
        {
            Login(proxy);
            //if (page > 1000) throw new Exception("页码过大,若需浏览更多图片请使用关键词限定范围");
            string url = null;

            if (srcType == PixivSrcType.Pid)
            {
                if (keyWord.Length > 0 && Regex.Match(keyWord, @"^[0-9]+$").Success)
                {
                    url = SiteUrl + "/member_illust.php?mode=medium&illust_id=" + keyWord;
                }
                else
                {
                    throw new Exception("请输入图片id");
                }
            }
            else
            {
                //http://www.pixiv.net/new_illust.php?p=2
                url = SiteUrl + "/new_illust.php?p=" + page;

                if (keyWord.Length > 0)
                {
                    //http://www.pixiv.net/search.php?s_mode=s_tag&word=hatsune&order=date_d&p=2
                    url = SiteUrl + "/search.php?s_mode=s_tag"
                          + (srcType == PixivSrcType.TagFull ? "_full" : "")
                          + "&word=" + keyWord + "&order=date_d&p=" + page;
                }
                if (srcType == PixivSrcType.Author)
                {
                    int memberId = 0;
                    if (keyWord.Trim().Length == 0 || !int.TryParse(keyWord.Trim(), out memberId))
                    {
                        throw new Exception("必须在关键词中指定画师 id;若需要使用标签进行搜索请使用 www.pixiv.net [TAG]");
                    }
                    //member id
                    url = SiteUrl + "/member_illust.php?id=" + memberId + "&p=" + page;
                }
                else if (srcType == PixivSrcType.Day)
                {
                    url = SiteUrl + "/ranking.php?mode=daily&p=" + page;
                }
                else if (srcType == PixivSrcType.Week)
                {
                    url = SiteUrl + "/ranking.php?mode=weekly&p=" + page;
                }
                else if (srcType == PixivSrcType.Month)
                {
                    url = SiteUrl + "/ranking.php?mode=monthly&p=" + page;
                }
            }
            shc.Remove("X-Requested-With");
            shc.Remove("Accept-Ranges");
            shc.ContentType = SessionHeadersValue.AcceptTextHtml;
            string pageString = Sweb.Get(url, proxy, shc);

            return(pageString);
        }
Exemplo n.º 2
0
        public override string GetPageString(int page, int count, string keyWord, IWebProxy proxy)
        {
            Login(proxy);
            //http://yuriimg.com/post/?.html
            string url = SiteUrl + "/post/" + page + ".html";

            // string url = "http://yuriimg.com/show/ge407xd5o.jpg";

            if (keyWord.Length > 0)
            {
                //http://yuriimg.com/search/index/tags/?/p/?.html
                url = SiteUrl + "/search/index/tags/" + keyWord + "/p/" + page + ".html";
            }

            shc.Remove("Accept-Ranges");
            shc.Accept      = SessionHeadersValue.AcceptTextHtml;
            shc.ContentType = SessionHeadersValue.AcceptTextHtml;
            string pageString = Sweb.Get(url, proxy, shc);

            return(pageString);
        }
Exemplo n.º 3
0
        public override string GetPageString(int page, int count, string keyWord, IWebProxy proxy)
        {
            Login(proxy);
            //if (page > 1000) throw new Exception("页码过大,若需浏览更多图片请使用关键词限定范围");
            int    memberId = 0;
            string url      = null;

            this.page    = page;
            this.count   = count;
            this.keyWord = keyWord;
            if (srcType == PixivSrcType.Pid || srcType == PixivSrcType.PidPlus)
            {
                if (keyWord.Length > 0 && int.TryParse(keyWord.Trim(), out memberId))
                {
                    url = SiteUrl + "/member_illust.php?mode=medium&illust_id=" + memberId;
                }
                else
                {
                    throw new Exception("请输入图片id");
                }
            }
            else
            {
                //http://www.pixiv.net/new_illust.php?p=2
                url = SiteUrl + "/new_illust.php?p=" + page;

                if (keyWord.Length > 0)
                {
                    //http://www.pixiv.net/search.php?s_mode=s_tag&word=hatsune&order=date_d&p=2
                    url = SiteUrl + "/search.php?s_mode=s_tag"
                          + (srcType == PixivSrcType.TagFull ? "_full" : "")
                          + "&word=" + keyWord + "&order=date_d&p=" + page;
                }

                memberId = 0;
                if (srcType == PixivSrcType.Author)
                {
                    if (keyWord.Trim().Length == 0 || !int.TryParse(keyWord.Trim(), out memberId))
                    {
                        throw new Exception("必须在关键词中指定画师 id;若需要使用标签进行搜索请使用 www.pixiv.net [TAG]");
                    }
                    //member id
                    //url = SiteUrl + "/member_illust.php?id=" + memberId + "&p=" + page;
                    //https://www.pixiv.net/ajax/user/212801/profile/all
                    //https://www.pixiv.net/ajax/user/212801/profile/illusts?ids%5B%5D=70095905&ids%5B%5D=69446164&is_manga_top=0
                    url = SiteUrl + "/ajax/user/" + memberId + "/profile/all";
                }
                else if (srcType == PixivSrcType.Day)
                {
                    url = $"{SiteUrl}/ranking.php?mode=daily&p={page}";
                    url = $"{url}{(keyWord.Trim().Length > 0 && int.TryParse(keyWord.Trim(), out memberId) ? $"&date={memberId}" : string.Empty)}";
                }
                else if (srcType == PixivSrcType.Week)
                {
                    url = $"{SiteUrl}/ranking.php?mode=weekly&p={page}";
                    url = $"{url}{(keyWord.Trim().Length > 0 && int.TryParse(keyWord.Trim(), out memberId) ? $"&date={memberId}" : string.Empty)}";
                }
                else if (srcType == PixivSrcType.Month)
                {
                    url = $"{SiteUrl}/ranking.php?mode=monthly&p={page}";
                    url = $"{url}{(keyWord.Trim().Length > 0 && int.TryParse(keyWord.Trim(), out memberId) ? $"&date={memberId}" : string.Empty)}";
                }
            }
            shc.Remove("X-Requested-With");
            shc.Remove("Accept-Ranges");
            shc.ContentType = SessionHeadersValue.AcceptTextHtml;
            shc.Set("Cookie", cookie);
            string pageString = Sweb.Get(url, proxy, shc);

            if (srcType == PixivSrcType.PidPlus)
            {
                //相关作品json信息
                //https://www.pixiv.net/ajax/illust/70575612/recommend/init?limit=18
                tempPage = Sweb.Get(SiteUrl + "/ajax/illust/" + keyWord + "/recommend/init?limit=18", proxy, shc);
            }
            return(pageString);
        }