Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 36 lines (29 sloc) 0.645 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#!/opt/local/bin/ruby

require "rubygems"
require "twitter"

httpauth = Twitter::HTTPAuth.new(
ARGV[0],
ARGV[1]
)

base = Twitter::Base.new(httpauth)

i = 0
(base.follower_ids - base.friend_ids).each do |id|
  begin
    base.friendship_create id
    i += 1
  rescue Twitter::General => e
    puts "#{e.class}: #{e.message}"
  rescue Twitter::Unavailable
    sleep 2
    retry
  end
end
puts "#{i} new friendships."

i = 0
(base.friend_ids - base.follower_ids).each do |id|
  i += 1
  base.friendship_destroy id
end
puts "#{i} destroyed friendships."

puts "#{base.friend_ids.size} friends now."
puts "#{base.follower_ids.size} followers now."
Something went wrong with that request. Please try again.