Created
December 28, 2013 11:45
-
-
Save mortenjohs/8158604 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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