Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main(instance, proxy):
- url = "http://www.adidas.co.uk/yeezy"
- #url = "https://www.yzylab.com/yeezy"
- #url = "https://atcproxys.com/splash-page/"
- #url = "https://www.google.com/recaptcha/api2/demo"
- url = "http://www.adidas.ru/yeezy"
- while True:
- #Random staggered start to help your computer
- x = float(random.randint(1*100, 20*100))/100
- print "[#" + str(instance) + "]: will start in " + str(x) + " seconds using proxy: " + str(proxy) + "."
- time.sleep(x)
- print "[#" + str(instance) + "]: is starting."
- #All chrome driver dependencies
- driver_path = r"C:\Program Files (x86)\Google\Chrome\chromedriver.exe"
- chrome_options = webdriver.ChromeOptions()
- chrome_options.add_argument("disable-infobars")
- chrome_options.add_argument("--window-size=800,600")
- #chrome_options.add_argument("--window-position=-3000,0")
- #chrome_options.add_argument('--proxy-server=%s' % proxy)
- driver = webdriver.Chrome(executable_path=driver_path, chrome_options=chrome_options)
- driver.get(url)
- print "[#" + str(instance) + "]: has loaded the splash page."
- #script = 'document.styleSheets[0].insertRule("body {color: red !important;}", 0 )'
- #driver.execute_script(script)
- #IF WE HAVE A CAPTCHA THEN THIS IS WHERE WE WILL SOLVE IT.
- #captcha_solve(driver,instance,url,proxy)
- #Checks the page every 30 seconds for 5 minutes to see if pass has been passed.
- tries = 1
- while True:
- print "[#" + str(instance) + "]: is checking if splash has been passed for the: " + str(tries) + " time."
- html = driver.execute_script("return document.getElementsByTagName('html')[0].innerHTML")
- check = "DO NOT REFRESH"
- check2 = "ERROR"
- if check not in html:
- print "[#" + str(instance) + "]: has had an error."
- print "[#" + str(instance) + "]:"
- print "[#" + str(instance) + "]:"
- print "[#" + str(instance) + "]:"
- print "[#" + str(instance) + "]:"
- driver.set_window_position(1000, 100)
- if check2 not in html:
- print "[#" + str(instance) + "]: has possibly passed splash. Opening browser and writing cookies to file."
- print "[#" + str(instance) + "]:"
- print "[#" + str(instance) + "]:"
- print "[#" + str(instance) + "]:"
- print "[#" + str(instance) + "]:"
- driver.set_window_position(2000, 200)
- #Save the cookies to a file incase there contains cookies for future splash bypasses.
- pickle.dump(driver.get_cookies() , open(str(int(time.time())) + "-" + str(proxy.replace(":","-")) + '.pkl',"wb"))
- time.sleep(10000)
- else:
- tries +=1
- time.sleep(30)
- if tries > 50000:
- print "[#" + str(instance) + "]: is closing and will restart soon."
- driver.quit()
- time.sleep(20)
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement