Import httplibimport randomimport timeimport urllib2import readdress = raw_input ("Please input the website address") count = Int (raw_input ("Please input the Add count number") req = Urllib2. Request (address) Res_data = Urllib2.urlopen (req) res = Res_data.read () pattern = Re.compile (R ' (/commend/\d{6}_\d.htm) ') Conntail = Pattern.findall (res) conntail = List (conntail[0]) conntail[16]= ' 1 ' conntail = "". Join (conntail) useragent = " mozilla/5.0 (Windows NT 6.1; WOW64) applewebkit/537.36 (khtml, like Gecko) chrome/41.0.2272.89 safari/537.36 "For I in Range (count): conn = Httplib. Httpconnection ("today.hit.edu.cn") ipAddress = "%d.%d.%d.%d"% (Random.randint (1,255), Random.randint (0,255), Random.randint (0,255), Random.randint (0,255)) headers={"x-forwarded-for": ipAddress, "user-agent": useragent} Conn.request ("HEAD", Conntail, "", Headers) Time.sleep (2) res = Conn.getresponse () print Res.status,res.reason
Inevitably someone will have doubts: Front urllib2 behind Httplib? Yes, I am a slag, so actually in the bright uncle's version of the change, the same strong C-style ...
The environment is Windows browser is Chrome #应该没什么关系吧
Use the method is to start entering the URL, and then enter the number of brush, slowly wait, as long as the speed is not too abnormal, generally a second can be brushed a vote
Today hit brush recommended Python script