Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- import os
- import random
- import string
- from selenium import webdriver
- from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
- from selenium.webdriver.support.ui import WebDriverWait
- from selenium.webdriver.common.by import By
- from selenium.webdriver.support import expected_conditions as EC
- from selenium.webdriver.common.proxy import Proxy, ProxyType
- num_accs = 1
- proxy_list = open("proxies.txt", "r").read().split("\n")
- user_agents = open("user_agents.txt", "r").read().split("\n")
- print("START WORK, {0} for create!".format(str(num_accs)))
- def generate_random_str():
- count = random.randint(8, 12)
- val = ''.join(random.choice(
- string.ascii_letters + string.digits) for _ in range(count))
- return val
- def main():
- try:
- proxy_full = proxy_list.pop(0)
- if ";" in proxy_full:
- proxy = proxy_full.split(";")[0]
- userpass = proxy_full.split(";")[1]
- else:
- proxy = proxy_full
- userpass = ""
- proxytype = "http"
- print(userpass)
- print(proxytype)
- except:
- proxy = ""
- proxy_full = ""
- useragent = random.choice([line for line in user_agents])
- DesiredCapabilities.PHANTOMJS[
- "phantomjs.page.settings.userAgent"] = useragent
- path = os.path.abspath(
- os.path.dirname(
- "__file__") + 'bin/chromedriver')
- proxy = Proxy({
- 'proxyType': ProxyType.MANUAL,
- 'httpProxy': proxy,
- 'ftpProxy': proxy,
- 'sslProxy': proxy,
- 'noProxy': ''
- })
- path = 'C:\chromedriver.exe'
- driver = webdriver.Chrome(executable_path=path)
- driver.delete_all_cookies()
- driver.set_window_size(1248, 1024)
- driver.get("https://www.instagram.com/")
- try:
- WebDriverWait(driver, 90).until(
- EC.presence_of_element_located(
- (By.XPATH, '//input[@name="password"]')))
- except:
- driver.save_screenshot("open.png")
- raise Exception
- email = generate_random_str() + "@yahoo.com"
- driver.find_element(By.XPATH, '//input[@name="email"]').send_keys(email)
- driver.find_element(
- By.XPATH, '//input[@name="fullName"]').send_keys(generate_random_str())
- username = generate_random_str()
- driver.find_element(
- By.XPATH, '//input[@name="username"]').send_keys(username)
- password = generate_random_str()
- driver.find_element(
- By.XPATH, '//input[@name="password"]').send_keys(password)
- driver.find_element(
- By.XPATH, '//button[contains(text(), "Регистрация")]').click()
- try:
- WebDriverWait(driver, 30).until(
- EC.presence_of_element_located(
- (By.XPATH,
- '//p[contains(text(), "Experience the best version")]')))
- except:
- print("ERROR! INSTAGRAM NOT APPROVE ACC!")
- driver.save_screenshot("not_approve.png")
- driver.quit()
- return "ERROR"
- acc = username + ":" + password + "@" + proxy_full
- with open("success_reg.txt", "a") as f1:
- f1.write(acc + "\n")
- driver.exit()
- print("SUCCESS REG!!")
- count = 0
- while count <= num_accs:
- main()
- count += 1
- print("Finish work!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement