Advertisement
l1von

asdadffsdg

May 11th, 2021
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.75 KB | None | 0 0
  1. from selenium.webdriver.support import expected_conditions as EC
  2. from selenium.webdriver.support.ui import WebDriverWait
  3. from selenium.webdriver.common.keys import Keys
  4. from selenium.webdriver.chrome.options import Options as chromeOptions
  5. from webdriver_manager.chrome import ChromeDriverManager
  6. from selenium.webdriver.common.by import By
  7. from fake_useragent import UserAgent
  8. import accountInfoGenerator as account
  9. import getVerifCode as verifiCode
  10. from seleniumwire import webdriver
  11. import fakeMail as email
  12. import time
  13. import argparse
  14. import json
  15. import requests
  16.  
  17.  
  18.  
  19. accNo = int(input("Кол-во аккаунтов для создания: "))
  20.  
  21.  
  22. options = {
  23.     'proxy': {
  24.         'http': 'http://MKoPMP:[email protected]:39292',
  25.         'https': 'https://MKoPMP:[email protected]:39292',
  26.         'no_proxy': 'localhost,127.0.0.1' # excludes
  27.     }
  28. }
  29. chrome_options = chromeOptions()
  30. chrome_options.add_argument("--start-maximized")
  31. chrome_options.add_argument('--log-level=2')
  32. driver = webdriver.Chrome(ChromeDriverManager().install(), seleniumwire_options=options, chrome_options=chrome_options)
  33.  
  34.  
  35. for i in range(accNo):
  36.     driver.get("https://www.instagram.com/accounts/emailsignup/")
  37.     time.sleep(8)
  38.     try:
  39.         cookie = driver.find_element_by_xpath('/html/body/div[2]/div/div/div/div[2]/button[1]').click()
  40.     except:
  41.         pass
  42.     name = account.username()
  43.  
  44.     #Fill the email value
  45.     token = 'a599ebffe1790ea88d7d42c7e8179808'
  46.  
  47.     url = f'http://api.kopeechka.store/mailbox-get-email?site=instagram.com&mail_type=ALL&token={token}&no_search=1&api=2.0'
  48.     r = requests.get(url)
  49.     if r.status_code == 200:
  50.         a = json.loads(r.content)
  51.         print(a)
  52.         ids = a['id']
  53.         fake_email = a['mail']
  54.  
  55.     email_field = driver.find_element_by_name('emailOrPhone')
  56.     email_field.send_keys(fake_email)
  57.     print(fake_email)
  58.     with open('femail.txt', 'a', encoding='utf8') as f:
  59.         f.write(str(fake_email) + "\n")
  60.  
  61.     # Fill the fullname value
  62.     fullname_field = driver.find_element_by_name('fullName')
  63.     fullname_field.send_keys(account.generatingName())
  64.     fname = account.generatingName()
  65.     print(fname)
  66.     with open('fullname.txt', 'a', encoding='utf8') as f:
  67.         f.write(fname + "\n")
  68.     # Fill username value
  69.     username_field = driver.find_element_by_name('username')
  70.     username_field.send_keys(name)
  71.     print(name)
  72.     with open('username.txt', 'a', encoding='utf8') as f:
  73.         f.write(name + "\n")
  74.     # Fill password value
  75.     password_field = driver.find_element_by_name('password')
  76.     password_field.send_keys(account.generatePassword())  # You can determine another password here.
  77.     passw = account.generatePassword()
  78.     print(passw)
  79.     with open('password.txt', 'a', encoding='utf8') as f:
  80.         f.write(passw + "\n")
  81.     WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//*[@id='react-root']/section/main/div/div/div[1]/div/form/div[7]/div/button"))).click()
  82.  
  83.     time.sleep(8)
  84.  
  85.     #Birthday verification
  86.     driver.find_element_by_xpath("//*[@id='react-root']/section/main/div/div/div[1]/div/div[4]/div/div/span/span[1]/select").click()
  87.     WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//*[@id='react-root']/section/main/div/div/div[1]/div/div[4]/div/div/span/span[1]/select/option[4]"))).click()
  88.  
  89.     driver.find_element_by_xpath("//*[@id='react-root']/section/main/div/div/div[1]/div/div[4]/div/div/span/span[2]/select").click()
  90.     WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//*[@id='react-root']/section/main/div/div/div[1]/div/div[4]/div/div/span/span[2]/select/option[10]"))).click()
  91.  
  92.     driver.find_element_by_xpath("//*[@id='react-root']/section/main/div/div/div[1]/div/div[4]/div/div/span/span[3]/select").click()
  93.     WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//*[@id='react-root']/section/main/div/div/div[1]/div/div[4]/div/div/span/span[3]/select/option[27]"))).click()
  94.  
  95.     WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//*[@id='react-root']/section/main/div/div/div[1]/div/div[6]/button"))).click()
  96.     time.sleep(3)
  97.     #
  98.     uri = f'http://api.kopeechka.store/mailbox-get-message?id={ids}&token={token}&api=2.0'
  99.     r = requests.get(uri)
  100.     if r.status_code == 200:
  101.         d = json.loads(r.content)
  102.         print(d)
  103.         val = d['value']
  104.         while val == 'WAIT_LINK':
  105.             r = requests.get(uri)
  106.             if r.status_code == 200:
  107.                 d = json.loads(r.content)
  108.                 val = d['value']
  109.                 print(val)
  110.         print('yeah,  code is', val)
  111.         instCode = val
  112.         driver.find_element_by_name('email_confirmation_code').send_keys(instCode, Keys.ENTER)
  113.         time.sleep(10)
  114.         try:
  115.             not_valid = driver.find_element_by_xpath('/html/body/div[1]/section/main/div/div/div[1]/div[2]/form/div/div[4]/div')
  116.             if(not_valid.text == 'That code isn\'t valid. You can request a new one.'):
  117.                 time.sleep(1)
  118.                 driver.find_element_by_xpath('/html/body/div[1]/section/main/div/div/div[1]/div[1]/div[2]/div/button').click()
  119.                 time.sleep(10)
  120.                 uri = f'http://api.kopeechka.store/mailbox-get-message?id={ids}&token={token}&api=2.0'
  121.                 r = requests.get(uri)
  122.                 if r.status_code == 200:
  123.                     d = json.loads(r.content)
  124.                     print(d)
  125.                     val = d['value']
  126.                     while val == 'WAIT_LINK':
  127.                         r = requests.get(uri)
  128.                         if r.status_code == 200:
  129.                             d = json.loads(r.content)
  130.                             val = d['value']
  131.                             print(val)
  132.                     print('yeah,  code is', val)
  133.                     confInput = driver.find_element_by_name('email_confirmation_code')
  134.                     confInput.send_keys(Keys.CONTROL + "a")
  135.                     confInput.send_keys(Keys.DELETE)
  136.                     confInput.send_keys(val, Keys.ENTER)
  137.         except:
  138.             pass
  139.  
  140.  
  141. # error:
  142. Traceback (most recent call last):
  143.   File "c:/Users/User/Desktop/instagram-auto-create-account-master/botAccountCreate.py", line 86, in <module>
  144.     driver.find_element_by_xpath("//*[@id='react-root']/section/main/div/div/div[1]/div/div[4]/div/div/span/span[1]/select").click()
  145.   File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 394, in find_element_by_xpath
  146.     return self.find_element(by=By.XPATH, value=xpath)
  147.   File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 978, in find_element
  148.     'value': value})['value']
  149.   File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
  150.     self.error_handler.check_response(response)
  151.   File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
  152.     raise exception_class(message, screen, stacktrace)
  153. selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id='react-root']/section/main/div/div/div[1]/div/div[4]/div/div/span/span[1]/select"}
  154.   (Session info: chrome=88.0.4324.104)
  155.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement