Skip to content

Instantly share code, notes, and snippets.

@gnurag
Created January 5, 2010 08:40
Show Gist options
  • Save gnurag/269249 to your computer and use it in GitHub Desktop.
Save gnurag/269249 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'net/http'
require 'rss'
if ARGV.length.zero?
puts "Usage: twit.rb [twitter_handle]"
exit
end
nickname = ARGV[0]
rest_uri = "http://twitter.com/statuses/user_timeline/#{nickname}.rss"
tweet_rss = Net::HTTP.get URI.parse(rest_uri)
tweets = RSS::Parser.parse(tweet_rss, false)
puts "Channel: #{tweets.channel.description}"
puts "Profile: #{tweets.channel.link}\n\n"
tweets.items.each_with_index{|item, i|
puts "#{i+1}: #{item.description}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment