Created
November 14, 2009 20:09
-
-
Save madebymany/234730 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'rubygems' | |
require 'optiflag' | |
require 'twitter' | |
module DBChecker extend OptiFlagSet | |
flag "password" | |
flag "user" | |
flag "days" | |
and_process! | |
end | |
username = ARGV.flags.user | |
password = ARGV.flags.password | |
days = ARGV.flags.days | |
#clear ARGV for gets to work | |
ARGV.clear | |
cutoff_date = DateTime.now - days.to_i | |
httpauth = Twitter::HTTPAuth.new(username, password) | |
twitter = Twitter::Base.new(httpauth) | |
page = 1 | |
begin | |
friends = twitter.friends(:page => page) | |
friends.each do |friend| | |
last_status_update = DateTime.parse(friend.status.created_at) unless friend.status.nil? | |
if (last_status_update.nil? or last_status_update <= cutoff_date) | |
puts "Unfollow #{friend.name}?" | |
STDOUT.flush | |
des = gets.chomp | |
if (des.eql?("Y") or des.eql?("y") or des.eql?("yes") or des.eql?("Yes") or des.eql?("YES")) | |
twitter.friendship_destroy(friend.id) | |
end | |
end | |
end | |
page = page + 1 | |
end until friends.length ==0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment