Last active
December 29, 2024 13:53
-
-
Save Suleman-Elahi/e1d7843e4fc809866d5331ee7a628e94 to your computer and use it in GitHub Desktop.
Auto follow Instagram accounts from a list. The list can be a single column CSV file (without header) or a plain text file with usernames to follow in each line. The script follows 12 accounts in less than a minute. But that can customized by adjusting the sleep parameters at line 18 and 24.
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
from instagram_private_api import Client, ClientCompatPatch | |
import time | |
user_name = 'xxxxxxx' | |
password = 'xxxxxxx' | |
api = Client(user_name, password) | |
f = open("followers.csv", "r").read().split("\n") | |
i = 0 | |
for x in f: | |
if bool(x): | |
try: | |
user_info = api.username_info(x) | |
except Exception as e: | |
print(f"User: {x} ",e) | |
continue | |
time.sleep(1) | |
api.friendships_create(user_info['user']['pk']) | |
print ("Followed user:: "+x) | |
i=i+1 | |
if i % 12 == 0: | |
print("sleeping for 40 sec, total followed till now: ", i) | |
time.sleep(40) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i need this script please how its work