C # Realize Baidu Automatic Click Software Design

Baidu click principle is not complicated, search-find the specified result, click.

        Difficult point one, C # realizes Baidu input box to input words like manual. Here only need to use webBrowser1, timer combined with System.Windows.Forms.SendKeys.Send

                       System.Windows.Forms.SendKeys.Send ("x"); where x is to send a word every second, directly enter all keywords into Baidu search frame.

         Difficult point 2. How to find the set webpage or title after pressing Enter, and then click.

                          Use URL features such as http://www.baidu.com/s?wd=%E6%B9%96%E5%8D%97126%E8%80%83%E8%AF%95%E7%BD%91&pn= 10 & tn = baiduhome_pg & ie = utf-8 & f = 3 Analysis, there is a pn, where pn = 10 is the second page, plus 10 for each page. Use webBrowser1 to loop through tags with <A until it is detected to contain pn this.webBrowser1.Document.All [i] .GetAttribute ("href"). IndexOf ("pn =" + page1)! =-1. Then click on webBrowser1.Document.All [i] .InvokeMember ("click");

 

       Difficult point three, the target website, by setting the title of the website, only, after finding, click.

 

      The fourth difficulty is how to click casually after entering the target website. Direct post code:

        Random xx = new Random ();
                    int yy = xx.Next (1, this.webBrowser1.Document.Links.Count-2); Why -2 here is because some sites have more statistical codes in the lower part, which is easy to click. So -2 will not be clicked.
                    this.webBrowser1.Navigate (this.webBrowser1.Document.Links [yy] .GetAttribute ("href"). ToString ()); The

      last point is to set the code IP. This is very simple. Use C # to modify the registry. But I found some proxy IP on the Internet, the speed is very slow. This is relatively difficult to solve for a timer that has been set.

Guess you like

Origin www.cnblogs.com/yidanda888/p/12713387.html