Unfollowing people not following me ... script not working
See original GitHub issueSo, I have been at this for days and it seems that there is no way to unfollow people who are not following me…
twitter_handle = "MyTwitterName"
friends_ids = api.friends_ids(api.me().id)
for follower in tweepy.Cursor(api.followers, id=twitter_handler).items():
if follower.id not in friends_ids:
api.destroy_friendship(follower)
I have tried many variations of the above script bit it does not work.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Unfollow users who are not following you back on instagram
Automate instagram with this python automation projectThis video is about how to automate instagram with python , basically we are going to ...
Read more >How to unfollow users that don't follow me on Instagram - Quora
You're going to have to go to your profile, click on your followers, and then go through the whole list and individually unfollow...
Read more >How to unfollow everyone on Instagram at once - Taplink
Go to the first section and unfollow from those accounts that you are not interested in.
Read more >tiktok unfollow tracker - Caseificio de Nicola
Tik-Followers is a 3rd party app that allows you to track your followers, those who have blocked you, and those who have unfollowed...
Read more >'Who Unfollowed Me on Instagram?': Here Are the Apps That ...
How to Check Unfollows Using an App; How to Check Who Isn't Following You Back Using an App. Recent Changes to Instagram. Instagram...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I saw you are using tweepy as a python lib. i spontanly wrote this using python 2.7 You don’t have to seperate the dict. key from the main file, just a matter style. I did a sleep method from lib “time” to prevent twitter from spotting you as a bot.
If you have any questions, just ask.
API.friends_ids
, now renamed toAPI.get_friend_ids
, returns the IDs of users being followed by the specified user, whereasAPI.followers
, now renamed toAPI.get_followers
returns the specified user’s followers.Also, the Twitter API endpoint that
API.friends_ids
, now renamed toAPI.get_friend_ids
, uses, GET friends/ids, only returns 5000 user IDs at a time.You’re iterating through all the followers of the specified user and checking to see if they’re one of your 5000 most recent followed users and if not, attempting to unfollow them.
It’s unclear what you’re attempting to try to do. If the specified user is the one you’re authenticated as, then there will be no users not following you when iterating through all your followers. If you’re attempting to go through the users you’re following and unfollow those not following you, as your title would suggest, then you’re iterating over the wrong set of users. Instead, you probably want to iterate over all the users you’re following and use
API.lookup_friendships
orAPI.get_friendship
to determine whether or not they’re following you. That or you can retrieve all your followers beforehand to check if each user is in that group, i.e. following you.@Peerdix @yogeshdmca @PvrpleBlvck CC @ChadLei That will only handle the most recent 5000 followers and following.
@PvrpleBlvck For code block usage, see https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks.