Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require 'optiflag'
- require 'twitter'
- Infinity = 1.0/0.0 unless defined? Infinity
- 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)
- 1.upto(Infinity) do |page|
- friends = twitter.friends(:page => page)
- break if friends.empty?
- friends.each do |friend|
- last_status_update = friend.status && DateTime.parse(friend.status.created_at)
- if (last_status_update.nil? or last_status_update <= cutoff_date)
- puts "Unfollow #{friend.screen_name} (#{friend.name})?"
- STDOUT.flush
- if gets.chomp.match(/^y(?:es)?$/i)
- twitter.friendship_destroy(friend.id)
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment