Created
August 12, 2013 21:44
-
-
Save ashrithr/6215583 to your computer and use it in GitHub Desktop.
ruby program to pull data from twitter streaming api
This file contains hidden or 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
require 'tweetstream' | |
raise "Requires Argument(s) keyword to match from twitter firehose" if ARGV.length == 0 | |
TweetStream.configure do |config| | |
# Fill in the details from dev.twitter.com | |
config.consumer_key = '' | |
config.consumer_secret = '' | |
config.oauth_token = '' | |
config.oauth_token_secret = '' | |
config.auth_method = :oauth | |
end | |
# Twitter Firehose Data that matches keyword(s) from 'ARGV' | |
begin | |
TweetStream::Client.new.track(ARGV.join(',')) do |tweet| | |
# puts tweet.inspect | |
puts tweet.user['screen_name'] + " => " + tweet.text | |
end | |
rescue Interrupt | |
puts "Caught Interrupt ... Exiting!" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment