Thursday, January 20, 2011

Use Ruby To Retrieve a User's Public Twitter Timeline

Install the twitter gem:
$ gem install Twitter

Write the code:
#!/usr/bin/env ruby
require 'rubygems'
require 'twitter'

screen_name =  String.new ARGV[0]

timeline = Twitter.user_timeline(screen_name)
timeline.each do |t|
  puts "#{t.text}"
end

Run the code:
ruby twitter.rb ryantremaine

1 comment: