Created
September 18, 2012 22:51
-
-
Save russ/3746526 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'tweetstream' | |
hash_tag = '#vegastech' | |
useage = [] | |
def show_stats(stats) | |
# Aggregate Results | |
puts stats.inspect | |
end | |
TweetStream.configure do |config| | |
config.consumer_key = ENV['TWITTER_CONSUMER_KEY'] | |
config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET'] | |
config.oauth_token = ENV['TWITTER_OAUTH_TOKEN'] | |
config.oauth_token_secret = ENV['TWITTER_OAUTH_TOKEN_SECRET'] | |
config.auth_method = :oauth | |
end | |
TweetStream::Client.new.on_error do |message| | |
puts "Error from stream #{message}" | |
end.track(hash_tag) do |tweet| | |
useage << tweet.created_at.inspect | |
show_stats(useage) if useage.size % 100 == 0 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment