Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require 'highline/import'
- require 'twitter'
- def login_on_twitter
- screen_name = ask("enter your screen name: ") {|q| q.echo = true}
- password = ask("enter your password: ") {|q| q.echo = false }
- httpauth = Twitter::HTTPAuth.new(screen_name,password,:ssl => true)
- @client = Twitter::Base.new(httpauth)
- begin
- @client.verify_credentials
- rescue Twitter::Unauthorized
- puts "login failed! wrong credentials..."
- exit
- end
- end
- def block_users
- friends = @client.friend_ids
- followers = @client.follower_ids
- to_be_blocked = followers - friends
- if to_be_blocked.empty?
- puts "no bots detected, exiting..."
- exit
- end
- to_be_blocked.each do |id|
- user = @client.user id
- puts "#{user.name} (#{user.screen_name})"
- end
- puts "block all listed followers? [ALL|N]"
- confirmation = gets.chomp
- if confirmation == "ALL"
- to_be_blocked.each do |id|
- @client.block(id)
- end
- else
- to_be_blocked.each do |id|
- user = @client.user id
- puts "block #{user.name} (#{user.screen_name})? [Yn]"
- confirmation = gets.chomp
- @client.block(id) if confirmation == "Y"
- end
- end
- end
- login_on_twitter
- block_users
Add Comment
Please, Sign In to add comment