asimptot / FollowerBot

Follower bot for Instagram
191 stars 67 forks source link

Error Followers.py #61

Closed arham837 closed 1 year ago

arham837 commented 1 year ago

from time import sleep import sys sys.path.append(r'C:\Projects\Get_Free_Followers') from init import * from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait

username = input('What is your Instagram username?\n') print('Getting followers... Please do not terminate the program.')

class Instagram: def setup(self): Setup.init(self)

def go_to_website(self):
    sleep(4)
    self.browser.get('https://tolinay.com/instagram-takipci-hilesi')
    sleep(4)

    uid = self.browser.find_element(By.XPATH, '/html/body/div[2]/div[2]/div[2]/form/div/div[1]/input')
    uid.send_keys(username)
    sleep(2)

    button = self.browser.find_element(By.XPATH, '/html/body/div[2]/div[2]/div[2]/form/div/div[3]/button')
    button.click()

    element_present = EC.presence_of_element_located((By.XPATH, '/html/body/div[2]/div[2]/div[1]/div/div/div[1]/div'))
    WebDriverWait(self.browser, 1000).until(element_present)

    if("Başarıyla Gönderildi" in self.browser.page_source):
        print(f"\n10 followers followed you!")
        self.browser.save_screenshot('followed.png')
    elif("Çok Hızlı İşlem Yapıyorsunuz" in self.browser.page_source):
        print(f"\nError! Do not run the program fast mode!")
        self.browser.save_screenshot('error.png')
    else:
        print(f"\nError! Your credits have been expired! Please change your Instagram username.")
        self.browser.save_screenshot('error.png')

def close_browser(self):
    Setup.close_browser(self)

ig = Instagram() j = 0 while(True): ig.setup() i = 0 try: while(True): try: ig.go_to_website() i = i + 1 except: ig.close_browser() j = j + 1 except: print('An error has been occurred. Retrying...') https://ibb.co/8jZ3GVZ

asimptot commented 1 year ago

Can you add in the following code block?

remove:

uid = self.browser.find_element(By.XPATH, '/html/body/div[2]/div[2]/div[2]/form/div/div[1]/input')
uid.send_keys(username)
sleep(2)

button = self.browser.find_element(By.XPATH, '/html/body/div[2]/div[2]/div[2]/form/div/div[3]/button')
button.click()

add:

N = 6 actions = ActionChains(self.browser) for _ in range(N): actions.send_keys(Keys.TAB).perform() sleep(2)

actions.send_keys(username).perform() sleep(2)

arham837 commented 1 year ago

I am getting same error. As chrome open and then closes

asimptot commented 1 year ago

Can you your source as screenshot please? I want to check whether you have changed correctly or not.

arham837 commented 1 year ago

screenshots are here https://ibb.co/gPMyJqM

asimptot commented 1 year ago

Why didn't you update the code? Please check my comment and update it. It seems wrong!

https://github.com/asimptot/FollowerBot/issues/61#issuecomment-1438232332

arham837 commented 1 year ago

i have updated code see this https://ibb.co/XYVLtYj

asimptot commented 1 year ago

No, it wasn't updated. Why do you write post_link in the 26th line? If you don't update the code, I can't help you, sorry. Please update it as I wrote in the above.

arham837 commented 1 year ago

See i have done coding as you have told it i am freezed here only https://ibb.co/wNqdDKr

asimptot commented 1 year ago

Please add

actions.send_keys(Keys.RETURN).perform() sleep(2)

after

actions.send_keys(username).perform() sleep(2)

It shouldn't be in for loop.

arham837 commented 1 year ago

Done thanks for your help.