Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from selenium import webdriver
- from selenium.webdriver.common.keys import Keys
- from time import sleep
- driver = webdriver.Chrome("C:\Program Files\chromedriver\chromedriver.exe")
- insta_link = "https://instagram.com"
- username = "123mihai456"
- driver.get(insta_link)
- def load_firends():
- firends_file = open("friends.txt", "r")
- firends_list = []
- friends = firends_file.read()
- return firends_list
- def NotNow():
- try:
- not_now_butt = driver.find_element_by_class_name("/html/body/div[1]/section/main/div/div/div/button") #"sqdOP yWX7d y3zKF "
- not_now_butt.click()
- except:
- print("Nu s-a gasit not now")
- def TurnOffNotifications():
- try:
- turn_off_button = driver.find_element_by_xpath("/html/body/div[4]/div/div/div[3]/button[2]") #"aOOlW HoLwm"
- turn_off_button.click()
- except:
- print("nu s-a gasit notificare")
- # def find_verification_codes():
- # driver.get('https://www.instagram.com/accounts/two_factor_authentication/')
- # sleep(4)
- # get_backup_codes = driver.find_element_by_xpath('//button[text()="Get Backup Codes"]')
- # get_backup_codes.click()
- # sleep(3)
- # get_new_codes = driver.find_element_by_xpath('//button[text()="Get New Codes"]')
- # get_new_codes.click()
- # sleep(4)
- # code = driver.find_element_by_xpath("/html/body/div[1]/section/main/div/article/div/ul/li[2]")
- # code_file = open("code.txt", "w")
- # code_file.write(str(code))
- # code_file.close()
- # #except:
- # #"NU S-AU GASIT SETARILE!!!"
- def get_code():
- #code_file = open("code.txt", "r")
- #return str(code_file.read())
- return input("Introdu codul de autentificare: ")
- def Login(username, pw):
- sleep(2)
- username_field = driver.find_element_by_name("username")
- pw_field = driver.find_element_by_name("password")
- username_field.send_keys(username)
- pw_field.send_keys(pw)
- driver.find_element_by_xpath("/html/body/div[1]/section/main/article/div[2]/div[1]/div/form/div[4]").click()
- sleep(5)
- code_field = driver.find_element_by_name("verificationCode")
- code_field.send_keys(get_code())
- sleep(1)
- confirm_button = driver.find_element_by_xpath("/html/body/div[1]/section/main/div/article/div/div[1]/div/form/div[2]/button")
- confirm_button.click()
- #Login(username, "M8fcpG8rTGTqd4hC")
- #sleep(8)
- #NotNow()
- #TurnOffNotifications()
- print(load_firends())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement