Created
October 26, 2011 04:12
-
-
Save rweald/1315413 to your computer and use it in GitHub Desktop.
A simple script that grabs some health related tweets and stores them in mongodb
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 'mongo' | |
require 'tweetstream' | |
db = Mongo::Connection.new("dbh13.mongolab.com", "27137").db("ch-diabetes-demo") | |
auth = db.authenticate("surfandcode", "irNwHfB3udTEpk9z") | |
collection = db.collection("diabetic_tweets") | |
stream = TweetStream::Client.new("commithealth", "SDSF202e") | |
stream.track("diabetes", "diabetic", "blood glucose", "endocrinologist", "#RunKeeper", "#FitnessAlerts") do |tweet| | |
puts 'inserting tweet into db' | |
collection.insert(tweet) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment