Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from selenium import webdriver
- from time import sleep
- import random
- import time
- from selenium.webdriver.common.action_chains import ActionChains
- file = open("list.txt", "r")
- read = file.readline()
- user = read.split(":")[0]
- password = read.split(":")[1]
- profile = webdriver.FirefoxProfile()
- profile.update_preferences()
- '''
- # Set Tor/Socks5 Proxy
- profile.set_preference( "network.proxy.socks_version", 5)
- profile.set_preference('network.proxy.type', 1)
- profile.set_preference('network.proxy.socks', '127.0.0.1')
- profile.set_preference('network.proxy.socks_port', 9150)
- profile.set_preference('network.proxy.socks_remote_dns', True)
- '''
- '''
- # Set Http Proxy
- profile.set_preference("network.proxy.type", 1)
- profile.set_preference("network.proxy.http", '127.0.0.1')
- profile.set_preference("network.proxy.http_port", int('80'))
- '''
- '''
- # Set Https Proxy
- profile.set_preference("network.proxy.type", 1)
- profile.set_preference("network.proxy.https", '127.0.0.1')
- profile.set_preference("network.proxy.http_port", int('8080'))
- '''
- '''
- # Set User-agent
- file = open("user-agent.txt", "r")
- read = file.readline()
- profile.set_preference("general.useragent.override", read)
- '''
- # Disable Cache
- profile.set_preference('browser.cache.disk.enable', False)
- profile.set_preference('browser.cache.memory.enable', False)
- profile.set_preference('browser.cache.offline.enable', False)
- # Private Browser
- profile.set_preference("browser.privatebrowsing.autostart", True)
- profile.set_preference('dom.ipc.plugins.enabled.libflashplayer.so', False)
- profile.set_preference("media.peerconnection.enabled", False)
- profile.update_preferences()
- driver = webdriver.Firefox(profile)
- def Login():
- print("inter Login");
- driver.get('https://twitter.com/login?lang=en');
- sleep(1);
- emailInput = driver.find_element_by_xpath("//div[@id='page-container']/div/div/form/fieldset/div/input")
- for i in user:
- emailInput.send_keys(i)
- sleep(round(random.uniform(0.2, 0.7), 1))
- actions = ActionChains(driver)
- passwordInput = driver.find_element_by_xpath("//div[@id='page-container']/div/div/form/fieldset/div[2]/input")
- sleep(1.5)
- actions.click(passwordInput)
- for j in password:
- passwordInput.send_keys(j)
- sleep(round(random.uniform(0.2, 0.7), 1))
- submit = driver.find_element_by_xpath("//button[@type='submit']")
- actions.click(submit)
- actions.perform()
- sleep(15);
- def LikeTimeline():
- print("inter LikeTimeline");
- actions = ActionChains(driver)
- actions.send_keys('jl')
- actions.perform()
- def ScrollTobottom():
- print("inter scroll");
- driver.execute_script("window.scrollBy(0," + str(random.randint(-750, 750)) + ")", "");
- def SleepForSomeTime():
- print("inter sleep");
- sleep(random.randint(0, 15));
- def Refresh():
- print("inter refresh");
- driver.refresh();
- def Follow():
- profileArray = [];
- murl = [];
- profileArray = driver.find_elements_by_xpath(
- "//a[contains(@class, 'account-group js-account-group js-action-profile js-user-profile-link js-nav')]");
- for url in profileArray:
- murl.append(url.get_attribute("href"))
- for url in murl:
- print(url);
- driver.get(url);
- navs = driver.find_elements_by_xpath("//span[contains(@class, 'ProfileNav-value')]");
- followers_count = navs[2].get_attribute("data-count");
- if (followers_count > 500 and random.randint(1, 15) > 7):
- try:
- flwButton = driver.find_element_by_xpath("//button[contains(@class, 'follow-text')]");
- flwButton.click();
- sleep(5);
- except:
- continue;
- #########################################################################################
- ############ ############
- ############ ############
- ############ ############
- ############ ############
- ############ ############
- ############ ############
- #########################################################################################
- random.seed(time.clock())
- driver.delete_all_cookies();
- Login();
- LikeTimeline();
- #Follow();
- # ScrollTobottom();
- # Refresh();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement