Skip to content

Instantly share code, notes, and snippets.

@axolx
Created November 10, 2013 02:07
Show Gist options
  • Save axolx/7392708 to your computer and use it in GitHub Desktop.
Save axolx/7392708 to your computer and use it in GitHub Desktop.
My Instagram account got hacked and next time I logged in I was following >500 spammers. Instead of using the UI to unfollow them (painfully slow) I put together this little script.
from instagram.client import InstagramAPI
from instagram.bind import InstagramAPIError, InstagramClientError
from time import sleep
access_token = "SETMET"
api = InstagramAPI(access_token=access_token)
follows = api.user_follows(MY_USERID)
for user in follows[0]:
print "Unfollowing: " + user.username
api.unfollow_user(user_id=user.id)
sleep(2) # be nice or get blocked from the API endpoint
@davidnbr
Copy link

How does this works? Excuse me I'm new with this and want to unfollow masively. I speak spanish so, sorry for my bad english

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment