Created
March 14, 2010 19:52
-
-
Save adriand/332181 to your computer and use it in GitHub Desktop.
This file contains 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 'ruby-debug' | |
abort("Supply a twitter screen name like: ruby twitter_info_via_curl.rb tomcreighton") unless ARGV.size > 0 | |
# the -s argument makes curl silent (it will no longer show a progress meter) | |
# don't forget to append m to your regular expressions if you want the . to match newline characters | |
user_info = `curl -s http://api.twitter.com/1/users/show.xml?screen_name=#{ARGV[0]}`.match( | |
/<followers_count>(\d*)<\/followers_count>.*<statuses_count>(\d*)<\/statuses_count>/m) | |
puts "Followers: #{user_info[1]}" | |
puts "Statuses: #{user_info[2]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment