I've been doing a lot of things with the Twitter API lately. More on that another time though. I started messing around with their stream API last night. It's pretty fun to play with and I wanted to put the code up somewhere so I can use it later. Right now it works, but it clearly isn't very robust. It needs retry logic and better error handling. Right now, it's just a toy :)
You'll need the json gem installed. Once you have that you can run the script like...
./twitter_stream.rb <username> <password>
2 comments:
or you could just do it the easy way ;P
----
require 'tweetstream'
TweetStream::Client.new('username','password').track('awesome') do |status|
puts "#{status.text}"
end
----
http://github.com/intridea/tweetstream
I could have, I saw the library of course. I wanted to write it by hand without any additional magic. It was a purely academic exercise :)
Post a Comment