Skip to content

Instantly share code, notes, and snippets.

@efatsi
Created November 5, 2012 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save efatsi/4020408 to your computer and use it in GitHub Desktop.
Save efatsi/4020408 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'twitter/json_stream'
require 'json'
TWITTER = {
:username => "letitsnow1415",
:password => "",
:search_terms =>["viget"]
}
EventMachine::run {
stream = Twitter::JSONStream.connect(
:path => '/1/statuses/filter.json',
:auth => "#{TWITTER[:username]}:#{TWITTER[:password]}",
:method => 'POST',
:content => "track=#{TWITTER[:search_terms].join(',')}"
)
count = 0
stream.each_item do |item|
tweet = JSON.parse(item)
count += 1
puts "#{count}: #{tweet["user"]["screen_name"]} - #{tweet["text"]}"
# `say #{tweet["text"]}`
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment