Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Add Comment
Please, Sign In to add comment