Instantly share code, notes, and snippets.

@scarpentier /votebot.py Secret
Last active Dec 25, 2015

Embed
What would you like to do?
import urllib2
from random import randint
from time import sleep
proxyfile = 'proxy.txt'
url1 = 'http://socialize.us1.gigya.com/socialize.incrementReactionsCount?format=jsonp&sdk=js_2.21.7&APIKey=2_1ZHSfzlERzsDih4WQUsH3FV7ixrjeBFgQneQK0He-7w7XNIMcTJEM0i8Id6tXbCy&source=showReactionsBarUI&sourceData=%7B%22barID%22%3A%22geekOct17%22%2C%22buttonID%22%3A%22Simon%22%2C%22buttonText%22%3Aundefined%7D&barID=geekOct17&buttonID=Simon&count=1&callback=gigya.global.JPCMD.prototype.handleResponse&context=888943447'
url2 = 'http://backend.musiqueplus.com/incVideoCount_Polopoly.jsp?callback=jQuery171016662127245217562_1382063794585&videoId=1.1245456&title=Geek+Recherch%C3%A9+-+Simon+Carpentier&artist=&isrc=&upc=&label=&_=1382063817115'
referer = 'http://www.musiqueplus.com/videos/geek-recherche-simon-carpentier-1.1245456'
def voteGigya():
try:
print 'Vote Gigya :',
req = urllib2.Request(url1)
req.add_header('Referer', referer)
response1 = urllib2.urlopen(req).read()
print 'OK'
except Exception:
print 'FAIL'
def voteMP():
try:
print 'Vote MP :',
req = urllib2.Request(url2)
req.add_header('Referer', referer)
response2 = urllib2.urlopen(req).read()
print 'OK'
except Exception:
print 'FAIL'
def proxyVote():
with open(proxyfile) as file:
for line in file:
line = line.rstrip()
proxy = urllib2.ProxyHandler({'http': line})
opener = urllib2.build_opener(proxy)
urllib2.install_opener(opener)
print 'Current IP : %s ...' % line
vote()
def vote():
voteGigya()
voteMP()
sleepyTime = randint(10,30)
print 'Sleeping %s seconds' % sleepyTime
sleep(sleepyTime)
print '------------'
while(True):
proxyVote()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment