Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from selenium import webdriver;
- from random import randint;
- import hashlib;
- import time;
- import codecs;
- i = 0;
- female = [line.rstrip('\n') for line in codecs.open("female.txt", "r", "utf-8")];
- male = [line.rstrip('\n') for line in codecs.open("male.txt", "r", "utf-8")];
- surname = [line.rstrip('\n') for line in codecs.open("surname.txt", "r", "utf-8")];
- proxies = [line.rstrip('\n') for line in open("proxylist.txt")];
- action_time = 2;
- create_time = 5;
- implicit_wait_time = 30;
- avg_cooldown_time = 3; #min
- avg_cooldown_spread = 2; #min
- email_list = open("logs.txt", "r");
- while 1:
- try:
- print '====================================================';
- #proxy setup
- proxy_string = proxies[randint(0, len(proxies)-1)];
- proxy = proxy_string.split('|');
- profile = webdriver.FirefoxProfile() ;
- profile.set_preference("network.proxy.type", 1);
- profile.set_preference("network.proxy.http", proxy[0]);
- profile.set_preference("network.proxy.http_port", proxy[1]);
- profile.update_preferences();
- print 'Using proxy: ' + proxy[0] + ':' + proxy[1];
- browser1 = webdriver.Firefox(firefox_profile=profile);
- browser2 = webdriver.Firefox(firefox_profile=profile);
- browser1.implicitly_wait(implicit_wait_time);
- browser2.implicitly_wait(implicit_wait_time);
- #get email address
- email = email_list.readline();
- #create account
- browser2.get("http://www.anker.com/login?back=%2Fdeals%2Fanker_powers_up_competition");
- username = browser2.find_element_by_css_selector('input[name="email"]');
- password = browser2.find_element_by_css_selector('input[name="password"]');
- time.sleep(action_time);
- username.send_keys(email);
- password_text = hashlib.sha224(email).hexdigest()[:12];
- time.sleep(action_time);
- password.send_keys(password_text);
- time.sleep(create_time);
- while 1:
- browser2.find_element_by_css_selector('.submit').click();
- time.sleep(create_time);
- curr_url = browser2.current_url;
- if "activation" in curr_url:
- break;
- #cast vote
- browser1.get("http://www.anker.com/deals/anker_powers_up_competition/v/614892-don-t-let-others-overtake-you");
- browser1.find_element_by_css_selector('b.vote').click();
- i += 1;
- print 'Voted ', i;
- cooldown = randint((avg_cooldown_time-avg_cooldown_spread)*60, (avg_cooldown_time+avg_cooldown_spread)*60);
- print 'Cooldown: ' + str(cooldown) + 's';
- browser1.close();
- browser2.close();
- time.sleep(cooldown);
- except:
- pass;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement