#! /usr/bin/env ruby require 'rubygems' require 'twhois' if ARGV.size > 0 ARGV.each do |username| begin user = Twhois.lookup(username) if user puts "@#{user.screen_name}:" puts " Name: #{user.name}" puts " URL: #{user.url}" if user.respond_to?(:url) puts " Profile: http://twitter.com/#{user.screen_name}" puts " Location: #{user.location}" if user.respond_to?(:location) puts " Description: #{user.description}" if user.respond_to?(:description) puts " Followers: #{user.followers_count}" puts " Following: #{user.friends_count}" puts " Tweets: #{user.statuses_count}" if user.respond_to?(:status) puts " Last Tweet (#{user.status['created_at']}):" puts " #{user.status['text']}" end puts " Timezone: #{user.time_zone}" if user.respond_to?(:time_zone) puts " Joined On: #{user.created_at}" puts " Profile Picture: #{user.profile_image_url}" puts " Private Account: #{user.protected ? "Yes" : "No"}" else puts "@#{username}:" puts " Error: Not Found" end rescue Twhois::InvalidUsername => e puts "@#{username}:" puts " Error: Invalid Username" end end else puts "Usage: twhois username [another_user] [yet_another]" end