Skip to content

Instantly share code, notes, and snippets.

@rweald
Created October 26, 2011 04:12
Show Gist options
  • Save rweald/1315413 to your computer and use it in GitHub Desktop.
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
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