Skip to content

Instantly share code, notes, and snippets.

@rubenfonseca
Created December 27, 2009 23:40
Show Gist options
  • Save rubenfonseca/264450 to your computer and use it in GitHub Desktop.
Save rubenfonseca/264450 to your computer and use it in GitHub Desktop.
require 'mq'
require 'twitter/json_stream'
username = ARGV.shift
password = ARGV.shift
raise "need username and password" if !username or !password
AMQP.start(:host => 'localhost') do
twitter = MQ.new.fanout('twitter')
stream = Twitter::JSONStream.connect(
:path => '/1/statuses/filter.json?track=iphone',
:auth => "#{username}:#{password}"
)
stream.each_item do |status|
twitter.publish(status)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment