User already followed glitch
This is my code:
from instapy import InstaPy from instapy import smart_run
my_username = 'balkanski.komentari' my_password = 'censored'
session = InstaPy(username= my_username, password = my_password, headless_browser = False)
with smart_run(session): session.set_relationship_bounds(enabled = True)
session.set_skip_users(skip_private=False)
session.follow_user_followers(['komenthub'], amount = 10, randomize = True)
session.end()
THIS IS RESULT
INFO [2021-12-09 14:33:46] [balkanski.komentari] User 'komenthub' [1/1] INFO [2021-12-09 14:33:53] [balkanski.komentari] GraphQL query hash: [c76146de99bb02f6415203be841dd25a] INFO [2021-12-09 14:33:56] [balkanski.komentari] To be followed: [1/10/.sim15.] INFO [2021-12-09 14:33:56] [balkanski.komentari] To be followed: [2/10/radojicajanjic] INFO [2021-12-09 14:33:56] [balkanski.komentari] To be followed: [3/10/_teedayy_9] INFO [2021-12-09 14:33:56] [balkanski.komentari] To be followed: [4/10/adii__ma] INFO [2021-12-09 14:33:56] [balkanski.komentari] To be followed: [5/10/todic10] INFO [2021-12-09 14:33:56] [balkanski.komentari] To be followed: [6/10/eldin.nasic] INFO [2021-12-09 14:33:56] [balkanski.komentari] To be followed: [7/10/sasa_mikic] INFO [2021-12-09 14:33:56] [balkanski.komentari] To be followed: [8/10/petargajic556] INFO [2021-12-09 14:33:56] [balkanski.komentari] To be followed: [9/10/dstupar23] INFO [2021-12-09 14:33:56] [balkanski.komentari] To be followed: [10/10/ak_93]
INFO [2021-12-09 14:33:56] [balkanski.komentari] Grabbed 10 usernames from 'komenthub's Followers to do following
INFO [2021-12-09 14:33:56] [balkanski.komentari] Ongoing Follow [1/10]: now following '.sim15.'... INFO [2021-12-09 14:33:56] [balkanski.komentari] --> .sim15. has already been followed 1 times
INFO [2021-12-09 14:33:57] [balkanski.komentari] Follow per user: 0 | Total Follow: 0
INFO [2021-12-09 14:33:57] [balkanski.komentari] Ongoing Follow [2/10]: now following 'radojicajanjic'... INFO [2021-12-09 14:34:25] [balkanski.komentari] --> Already following 'radojicajanjic'!
INFO [2021-12-09 14:34:31] [balkanski.komentari] Follow per user: 0 | Total Follow: 0
INFO [2021-12-09 14:34:31] [balkanski.komentari] Ongoing Follow [3/10]: now following '_teedayy_9'... INFO [2021-12-09 14:34:31] [balkanski.komentari] --> _teedayy_9 has already been followed 1 times
INFO [2021-12-09 14:34:32] [balkanski.komentari] Follow per user: 0 | Total Follow: 0
INFO [2021-12-09 14:34:32] [balkanski.komentari] Ongoing Follow [4/10]: now following 'adii__ma'... INFO [2021-12-09 14:34:32] [balkanski.komentari] --> adii__ma has already been followed 1 times
INFO [2021-12-09 14:34:33] [balkanski.komentari] Follow per user: 0 | Total Follow: 0
INFO [2021-12-09 14:34:33] [balkanski.komentari] Ongoing Follow [5/10]: now following 'todic10'... INFO [2021-12-09 14:34:33] [balkanski.komentari] --> todic10 has already been followed 1 times
INFO [2021-12-09 14:34:34] [balkanski.komentari] Follow per user: 0 | Total Follow: 0
INFO [2021-12-09 14:34:34] [balkanski.komentari] Ongoing Follow [6/10]: now following 'eldin.nasic'... INFO [2021-12-09 14:34:34] [balkanski.komentari] --> eldin.nasic has already been followed 1 times
INFO [2021-12-09 14:34:35] [balkanski.komentari] Follow per user: 0 | Total Follow: 0
INFO [2021-12-09 14:34:35] [balkanski.komentari] Ongoing Follow [7/10]: now following 'sasa_mikic'... INFO [2021-12-09 14:34:35] [balkanski.komentari] --> sasa_mikic has already been followed 1 times
INFO [2021-12-09 14:34:36] [balkanski.komentari] Follow per user: 0 | Total Follow: 0
INFO [2021-12-09 14:34:36] [balkanski.komentari] Ongoing Follow [8/10]: now following 'petargajic556'... INFO [2021-12-09 14:34:36] [balkanski.komentari] --> petargajic556 has already been followed 1 times
INFO [2021-12-09 14:34:37] [balkanski.komentari] Follow per user: 0 | Total Follow: 0
INFO [2021-12-09 14:34:37] [balkanski.komentari] Ongoing Follow [9/10]: now following 'dstupar23'... INFO [2021-12-09 14:34:50] [balkanski.komentari] Last follow is verified after reloading the page! INFO [2021-12-09 14:34:50] [balkanski.komentari] --> Followed 'b'dstupar23''! INFO [2021-12-09 14:34:50] [balkanski.komentari] Attempting to find user ID: Track: profile, Username dstupar23 INFO [2021-12-09 14:34:57] [balkanski.komentari] Follow per user: 1 | Total Follow: 1
INFO [2021-12-09 14:34:57] [balkanski.komentari] Ongoing Follow [10/10]: now following 'ak_93'... INFO [2021-12-09 14:34:57] [balkanski.komentari] --> ak_93 has already been followed 1 times
As you see above, it keeps choosing already followed accounts, how can I prevent this in my code?
Please help me , thanks in forward!
If that is the result of setting randomize=True, it looks pretty strange.
According to CodeMasterBond's answer, you should be able to get it without following the timeline.
For one thing, does the specified user hold enough followers? Unlikely, but if you only have less than the specified AMOUNT of followers, it won't work.
Another thing you can do is to try another approach. First, use grab_followers to get the followers of the specified user. Next, use follow_by_list to follow the followers.
I have never used follow_by_list, but I have confirmed that grab_followers works. If you specify amount="full", you will get all the followers for sure.
Is there any solution?