Skip to content

Instantly share code, notes, and snippets.

@matipan
Created June 27, 2015 01:52
Show Gist options
  • Save matipan/4fbe164898d84de3a8bc to your computer and use it in GitHub Desktop.
Save matipan/4fbe164898d84de3a8bc to your computer and use it in GitHub Desktop.
require 'jumpstart_auth'
class FedeFollowers
attr_reader :client
def initialize
@client = JumpstartAuth.twitter
end
def followers_list
followers = @client.follower_ids
begin
followers.to_a
rescue Twitter::Error::TooManyRequests => error
sleep error.rate_limit.reset_in + 1
retry
end
return followers
end
def following_list
friends = @client.friend_ids
begin
friends.to_a
rescue Twitter::Error::TooManyRequests => error
sleep error.rate_limit.reset_in + 1
retry
end
return friends
end
def no_friendship(followers, friends)
to_remove = friends.select { |friend| !followers.include?(friend) }
end
def unfollow_friends(friends)
friends.each do |friend|
@client.unfollow(friend)
end
end
def print_s(user)
puts "#{@client.user(user).screen_name} no te sigue..."
end
end
fede = FedeFollowers.new
friends = fede.following_list
followers = fede.followers_list
no_friendship = fede.no_friendship(followers, friends)
p no_friendship
no_friendship.each do |friend|
fede.print_s(friend)
end
# to_remove = [385047045, 533702071, 3304375666, 158559997, 11016382, 55931842, 1003294555, 293217249,480730546, 2261129285, 341967327, 3318094841, 617346002, 3316800244, 3333579915, 2426425099, 899955858, 3324943329, 3135571769, 2811133433, 542985635, 3333177593, 2892260908, 3325861875, 3333785206, 3317557270, 2770211354, 3318134735, 3333745049, 3029736821, 3320816182, 3188712814, 3325240479, 874597189, 2430876613, 2795952129, 3220038483, 3329810927, 3013248251, 243459434, 3149891775, 222821839, 705329208, 2157931502, 1869337381, 2316088712, 3022563310, 3303380854, 3332060020, 3333815339, 3332518713, 3130782641, 3307264413, 2181287646, 3327971278, 3309444765, 154927348, 594827790, 3300657976, 3234517783, 166284360, 774487656, 2649051764, 3225927737, 2393199853, 2290590384, 2892165377, 3097569814, 1031010818, 2910753717, 464010686, 2759747930, 2693728776, 2219798239, 1592102148, 1727092328, 227157193, 914681048, 2646507271, 1899546764, 1347388932, 163605295, 874453615, 2433867118, 527667526, 2189187547, 189232144, 247393390, 1625989286, 1604304571, 1551730046, 1320900259, 168754147, 466590070, 969058315, 729235284, 1197342973, 1621572799, 337953994, 495688402, 332987793, 303786827, 1158506731, 266787533, 156694605, 923994728, 1661497290, 1692574765, 930597602]
fede.unfollow_friends(no_friendship)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment