Python click voting script implementation code, python vote
The principle is to use the proxy IP address to access the voting address. Multithreading is used, and the speed is fast.
I spent more than 1000 votes in the last two hours, mainly because the proxy IP address is hard to find.
2.7 run in Environment
#! /Usr/bin/env python #-*-coding: UTF-8-*-import urllib2 from threading import Thread from time import time class 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 = 10 def run (self): proxy_handle = urllib2.ProxyHandler ({"http": r 'HTTP: // % s' % self. proxy}) opener = urllib2.build _ opener (proxy_handle) urllib2.install _ 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 T 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 () for I in threads: I. start () for I in threads: I. join () print '% s votes have been voted successfully using % s seconds' % (shownum (), time ()-start_time)