Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #170 from niketanmoon/master
Browse files Browse the repository at this point in the history
Added csv file for storing usernames
  • Loading branch information
FeezyHendrix authored May 31, 2021
2 parents de3ec0d + 0f298c2 commit 10fcb07
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
20 changes: 14 additions & 6 deletions modules/seleniumbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, use_custom_proxy, use_local_ip_address):
self.sockets = []
self.use_custom_proxy = use_custom_proxy
self.use_local_ip_address = use_local_ip_address
self.url = 'https://www.instagram.com/'
self.url = 'https://www.instagram.com/accounts/emailsignup/'
self.__collect_sockets()


Expand Down Expand Up @@ -103,7 +103,7 @@ def createaccount(self, proxy=None):
sleep(2)

submit = driver.find_element_by_xpath(
'//*[@id="react-root"]/section/main/article/div[2]/div[1]/div/form/div[7]/div/button')
'//*[@id="react-root"]/section/main/div/div/div[1]/div/form/div[7]/div/button')

action_chains.move_to_element(submit)

Expand All @@ -113,12 +113,20 @@ def createaccount(self, proxy=None):
sleep(3)
try:

age_button = driver.find_element_by_xpath( "//input[@name='ageRadio' and @value='above_18']")
age_button.click()

month_button = driver.find_element_by_xpath( '//*[@id="react-root"]/section/main/div/div/div[1]/div/div[4]/div/div/span/span[1]/select')
month_button.click()
month_button.send_keys(account_info["birthday"].split(" ")[0])
sleep(1)
day_button = driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/div/div[1]/div/div[4]/div/div/span/span[2]/select')
day_button.click()
day_button.send_keys(account_info["birthday"].split[" "][1][:-1])
sleep(1)
year_button = driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/div/div[1]/div/div[4]/div/div/span/span[3]/select')
year_button.click()
year_button.send_keys(account_info["birthday"].split[" "][2])

sleep(2)
next_button = driver.find_elements_by_xpath('//button[text()="Next"]')[1]
next_button = driver.find_elements_by_xpath('//*[@id="react-root"]/section/main/div/div/div[1]/div/div[6]/button')
next_button.click()

except Exception as e :
Expand Down
16 changes: 16 additions & 0 deletions modules/storeusername.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
from .config import Config, ASSET_DIR
import logging
import pickle
import csv

def store(account):
with open(ASSET_DIR + '/usernames.pkl', 'ab') as f:
logging.info("Storing username {}".format(str(account['username'])))
logging.info(str(account))
pickle.dump(str(account), f, pickle.HIGHEST_PROTOCOL)

# storing username.csv file
with open('usernames.csv', 'w', newline='') as file:
logging.info("Storing username {}".format(str(account['username'])))
logging.info(str(account))
writer = csv.writer(file)
writer.writerow(["Name", "Username", "Password", "Email", "Gender", "Birthday"])
writer.writerow([
account["name"],
account["username"],
account["password"],
account["email"],
account["gender"],
account["birthday"]
])

0 comments on commit 10fcb07

Please sign in to comment.