Last active
June 6, 2022 13:15
-
-
Save raz0229/ee9c8982201d573c6eca1768ea6708de to your computer and use it in GitHub Desktop.
Mass unfollow instagram bot selenium webdriver python script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Log in to your account manually and let the bot do the job | |
| # Scroll down to the bottom of your following to start a new batch | |
| from selenium import webdriver | |
| from selenium.webdriver.support import expected_conditions as EC | |
| from selenium.webdriver.support.ui import WebDriverWait | |
| from selenium.webdriver.common.by import By | |
| driver = webdriver.Chrome(executable_path="/opt/chromedriver") # path to your webdriver | |
| page_name = input("Input your username: ") | |
| def open(): | |
| driver.get(f"https://www.instagram.com/{page_name}/following") | |
| unfollow() | |
| def unfollow(start=0): | |
| elems = WebDriverWait(driver, 120).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, '._aacl._aaco._aacw._aad6._aade'))) | |
| if (start < len(elems)): | |
| for i in range(start, len(elems)): | |
| elems[i].click() | |
| private = driver.find_element_by_css_selector('._a9--._a9-_') | |
| if private: | |
| private.click() | |
| start += 1 | |
| unfollow(start) | |
| if __name__ == '__main__': | |
| open() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment