The
principle is to use proxy IP to access the polling address. With a lot of threads, it's fast.
last night two hours on the brush more than 1000 votes, mainly proxy IP is not easy to find.
running
in 2.7 environments
#!/usr/bin/env python #-*-coding:utf-8-*-import urllib2 from threading import Thread to time import time C
Lass Vote (Thread): Def __init__ (self, proxy): thread.__init__ (self) self.proxy = Proxy Self.url = ' http://www.studentboss.com/zhuanti/2014/cncc/vote.php?id=19 ' self.timeout = ten def run (self ): Proxy_handle = Urllib2. Proxyhandler ({"http": R ' http://%s '% self.proxy}) opener = Urllib2.build_opener (proxy_handle) urllib2.in Stall_opener (opener) Try:req = Urllib2.urlopen (Self.url, timeout=self.timeout) result
= Req.read (). Decode (' GBK ') print result pos = result.find (U ' success ') if POS > 1: Addnum () Else:pass except Exception,e:print e.message, '
Error ' Def addnum (): Global n + + 1 def shownum (): return n = 0 threads = []
proxylist = open (' Proxy.txt ', ' r ') for proxy in proxylist:t = Vote (proxy) threads.append (t) if __name __ = = ' __main__ ': start_time = time () to I in Threads:i.start () to I in Threads:i.joi N () print '%s votes have been voted successfully using%s seconds '% (Shownum (), Time ()-start_time)