Skip to content

Instantly share code, notes, and snippets.

@mortenjohs
Created December 28, 2013 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mortenjohs/8158604 to your computer and use it in GitHub Desktop.
Save mortenjohs/8158604 to your computer and use it in GitHub Desktop.
client = Instagram.client
my_followers = client.user_followed_by.map(&:id)
client.user_follows.each do |u|
unless my_followers.include?(u.id)
response = unfollow(u.id, ACCESS_TOKEN)
body = JSON.parse(response.raw_body)
if body["meta"]["code"] == 400
puts "Did not unfollow #{u.username} (#{u.id}) -- #{body["meta"]["error_message"]}."
else
puts "Success! Unfollowed #{u.username} (#{u.id})"
end
else
puts "Did not unfollow #{u.username} -- one of your followers..."
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment