subzeroid / instagrapi

🔥 The fastest and powerful Python library for Instagram Private API 2024
https://hikerapi.com/p/bkXQlaVe
MIT License
4.22k stars 667 forks source link

[BUG]user_follow not following everyone #1156

Open Pa3k25 opened 1 year ago

Pa3k25 commented 1 year ago

Hey, I am trying to write a bot that will automatically follow people. Here is the code I have so far

followers = []
peopleFollowed = 0

with open("./5kFolowers_{name}.txt".format(name="mini.loonaa"), "r") as f:
    for line in f.readlines():
        followers.append(line.strip())

print("[INFO] Logging in as " + username)

cl = Client()
cl.login(username, password)

print("[Success] Logged in as " + username)

for follower in followers:
    try:
        cl.user_follow(follower)
        print("[SUCCESS] Followed " + follower)
        peopleFollowed += 1
    except Exception as e:
        print("[ERROR] " + str(e))

print("[SUCCESS] Followed " + str(peopleFollowed) + " people")

The followers list is just the userId's and the problem I am having is that the line cl.user_follow(follower) only sometimes follows the person but always prints "[SUCCESS] Followed x". This means there is no error thrown but the program is still not following everybody.

Any ideas on why this may be happening?

adw0rd commented 1 year ago

Try it and show me what happened

result = cl.user_follow(follower)
print("[SUCCESS] Followed ", follower, result)
Pa3k25 commented 1 year ago

image It returns false. The [SUCCESS] is printed by me.

Yesterday when I ran the script, the script occasionally followed some people but today it's not following anyone at all

adw0rd commented 1 year ago

False means that it has not followed, but through the Instagram app this user can follow?

Pa3k25 commented 1 year ago

Yeah I tried and it works normally

Pa3k25 commented 1 year ago

I did some more testing and it is returning false if the user has a private account. How do I request to follow them if they have a private account?

charl-ie commented 1 year ago

I have the same problem, it is not letting me follow private accounts. Anyone know a fix?

Pa3k25 commented 1 year ago

It seems like it requests to follow everyone who's private (returns false) and follows everyone who's public (returns true)

LeilaSchooley commented 10 months ago

Same issue - just tested though and it seems it actually follows the private user in my case, but returns false because you have to request as said above