網頁刷贊-無登錄

實現功能:  增長人氣,增長點贊數量json

分析:增長人氣就是刷頁面,刷一次頁面就增長一次人氣       增長點贊數是先獲取對應的Cookies填充後訪問對應的APIapi

代碼實現(功能正常新建一個控制檯就能夠直接使用目前刷贊數量是18888  https://pano.kujiale.com/cloud/design/3FO4HB881NUA/show):瀏覽器

private static readonly HttpClient httpClient0 = new HttpClient();

        static async void Test()
        {
            try
            {
                //第一個頁面地址
                string l_strURL =
                    @"https://pano.kujiale.com/cloud/design/3FO4HB881NUA/show";

                HttpResponseMessage response0 = await httpClient0.GetAsync(l_strURL);
                response0.EnsureSuccessStatusCode();
                //訪問第一個頁面後獲取服務端發過來的Cookies
                var cookies = response0.Headers.GetValues("Set-Cookie");


                //經過抓包工具Fiddler找到點贊對應的請求地址 拷貝出來
                string l_strCommond =
                    "https://pano.kujiale.com/api/pano/recommend?designid=3FO4HB881NUA&panoid=3FO4HB881NUA&panotype=1";


                var handler = new HttpClientHandler() { UseCookies = false };

                using (HttpClient client = new HttpClient(handler))
                {
                    var message = new HttpRequestMessage(HttpMethod.Get, l_strCommond);
                    message.Headers.Add("Cookie", cookies);
                    //這些附加信息無關緊要 若是服務器端有過濾器 指定了瀏覽器或者別的 那就須要再加上去
                    //                message.Headers.Add("User-Agent",
                    //                    "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0");
                    //                message.Headers.Add("Connection", "Keep-Alive");
                    //                message.Headers.Add("Accept", "application/json, text/plain, */*");
                    //                message.Headers.Add("Accept-Language", "zh,zh-cn,en-us,en");

                    //                httpClient0.Timeout = TimeSpan.FromMinutes(10);
                    
                    using (HttpResponseMessage response = await client.PostAsync(l_strCommond, message.Content))
                    {
                        if (response.IsSuccessStatusCode)
                            Console.WriteLine(response.Content.Headers.ContentLength);
                    }
                }
            }
            catch (HttpRequestException ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {

            }
        }
 
static void Main(string[] args)
        {
            httpClient0.Timeout = TimeSpan.FromMinutes(10);
            new Task(() =>
            {
                for (int i = 0; i < 8888; i++)
                {
                    Thread.Sleep(50);
                    Test();
                }
            }).Start();
    Console.ReadLine();
return; }

 

其它:爲何再Fiddler中 直接重複發送這兩條地址不行,怎麼樣才能才能保證每次發送的Sessionid不同,這樣不用寫代碼就能夠實現上面的功能;服務器

相關文章
相關標籤/搜索