Advertisement
Guest User

Untitled

a guest
Sep 21st, 2018
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.69 KB | None | 0 0
  1. import os  
  2. from selenium import webdriver  
  3. from selenium.webdriver.chrome.options import Options  
  4. from selenium.webdriver.common.keys import Keys
  5. import time
  6. from multiprocessing import Process, Lock, Pool, TimeoutError
  7. from multiprocessing.dummy import Pool as ThreadPool
  8. import sys
  9.  
  10. target_url = 'https://chaturbate.com/username'
  11.  
  12. def web_instance(info):
  13.  
  14.     split_info = info.split("|")
  15.     proxy = split_info[1]
  16.  
  17.     userInfo = split_info[0].split(":")
  18.  
  19.     username = userInfo[0]
  20.     password = userInfo[1]
  21.  
  22.     chrome_options = Options()  
  23.     chrome_options.add_argument("--proxy-server=%s" % proxy)
  24.     chrome_options.add_argument("--headless")  
  25.     chrome_options.binary_location = r'C:\Users\%USERNAME%\AppData\Local\Google\Chrome SxS\Application\chrome.exe'
  26.     driver = webdriver.Chrome(executable_path=os.path.abspath("chromedriver"), chrome_options=chrome_options)
  27.  
  28.     driver.get('https://chaturbate.com')
  29.  
  30.     passField = driver.find_element_by_css_selector("#id_password")
  31.     nameField = driver.find_element_by_css_selector("#id_username")
  32.  
  33.     passField.send_keys(password)
  34.     nameField.send_keys(username)
  35.    
  36.     passField.send_keys(keys.RETURN)
  37.  
  38.     time.sleep(5)
  39.  
  40.     driver.get(target_url)
  41.  
  42.  
  43.  
  44. if __name__ == '__main__':
  45.  
  46.     userInfo = open("./user_info.txt", "r")
  47.     proxyInfo = open("./proxies.txt", "r")
  48.    
  49.     info = []
  50.  
  51.     for line in userInfo:
  52.         info.append(line)
  53.    
  54.     lc = 0
  55.  
  56.     for line in proxyInfo:
  57.         info[lc] = info[lc] + "|" + line
  58.         lc = lc + 1
  59.  
  60.     pool_count = len(info)
  61.     pool = ThreadPool(pool_count)
  62.     pool.map(web_instance, info)
  63.     pool.close()
  64.     pool.join()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement