Closed ghost closed 7 years ago
Yes it's possible @inhaletime, I'll give you a quick and easy way (although this won't cover 100% of the people you follow). Luckily if you've been running the bot for a while you'll have a large following list
in profile.json
. Here's what you can do:
profile.json
and add all following
users with 2000+ following to a listfollowing.csv
in /cache
Here's the script to do this:
from json import load
from csv import writer
with open('profile.json') as dataFile:
profile = load(dataFile)
usersUnfollow = [[user['user_id']] for user in profile['follows'] if user['follows'] > 2000]
with open('unfollowTheseIDs.csv', 'wb') as out:
w = writer(out)
w.writerows(usersUnfollow)
Amazing Nick, Im having so much fun learning Python with people like you in this community. Now let see if I can figure out how to sort the .json file. and pull out the user names.
No problem!
If you have a large list of usernames you could even play around with check_user()
in instaFunctions.py
to get their IDs and include them in following.csv
in /cache
, and they will be unfollowed when you run the bot.
Note that check_user()
takes a requests.Session()
object with a desktop user agent (you can find out how to do this in start_requests()
in instabot.py
), the user URL https://www.instagram.com/%s/
and a username.
Is it possible to set the bot to unfollow everyone who is following more than 2000 accounts?
IE
bot scrapes followings>unfollows accounts with more than 2000 following