Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1 from kristiankristensen/master

Updated to use newest version of TwitterStream
  • Loading branch information...
commit 1652c48a52d2dfec2f57dc5337c11af2c9cdfe14 2 parents 384bfa8 + 66538e3
@jefflinwood jefflinwood authored
Showing with 26 additions and 12 deletions.
  1. +2 −1  Gemfile
  2. +8 −5 Gemfile.lock
  3. +3 −3 README
  4. +13 −3 tweeter-keeper.rb
View
3  Gemfile
@@ -1,5 +1,6 @@
source :gemcutter
-gem 'tweetstream'
+gem 'tweetstream', '>1.1'
gem 'mongo'
gem 'twitter'
gem 'bson_ext'
+gem 'yajl-ruby'
View
13 Gemfile.lock
@@ -13,7 +13,7 @@ GEM
faraday_middleware (0.6.5)
faraday (~> 0.6.0)
hashie (1.0.0)
- http_parser.rb (0.5.1)
+ http_parser.rb (0.5.3)
mongo (1.3.1)
bson (>= 1.3.1)
multi_json (1.0.3)
@@ -21,9 +21,10 @@ GEM
multipart-post (1.1.3)
rack (1.3.2)
simple_oauth (0.1.5)
- tweetstream (1.0.4)
- daemons
- twitter-stream
+ tweetstream (1.1.1)
+ daemons (~> 1.1.2)
+ multi_json (~> 1.0.3)
+ twitter-stream (~> 0.1.14)
twitter (1.6.0)
faraday (~> 0.6.1)
faraday_middleware (~> 0.6.3)
@@ -35,6 +36,7 @@ GEM
eventmachine (>= 0.12.8)
http_parser.rb (~> 0.5.1)
simple_oauth (~> 0.1.4)
+ yajl-ruby (1.0.0)
PLATFORMS
ruby
@@ -42,5 +44,6 @@ PLATFORMS
DEPENDENCIES
bson_ext
mongo
- tweetstream
+ tweetstream (> 1.1)
twitter
+ yajl-ruby
View
6 README
@@ -10,7 +10,7 @@ Mongo gem - Use the Mongo Ruby Driver directly, instead of an abstraction librar
Yaml gem - Used for basic configuration tasks
-Install
+# Install
=============
Environment - requires Ruby and MongoDB.
@@ -19,7 +19,7 @@ gem install bundle
bundle install
-Usage
+# Usage
==============
To run, open up config.yaml and change the USERNAME and PASSWORD to your Twitter account's username and password.
@@ -37,7 +37,7 @@ Open up a mongo shell and take a look at all the tweets you've collected! For sa
> db.tweets.count();
2156
-Future Plans
+# Future Plans
================
Get keywords directly from a MongoDB collection
Follow users from a MongoDB collection
View
16 tweeter-keeper.rb
@@ -6,7 +6,6 @@
require 'date'
require 'time'
-
config = YAML.load_file('config.yaml')
#set up a connection to a local MongoDB or MongoLab from Heroku
@@ -22,16 +21,27 @@
#all tweets will be stored in a collection
tweets = db.collection("tweets")
-tracking_keywords = Array['aplusk'];
+tracking_keywords = Array['bieber'];
follow_users = Twitter.friend_ids("jefflinwood").ids;
-client = TweetStream::Client.new(config['username'],config['password'])
+TweetStream.configure do |c|
+ c.username = config['username']
+ c.password = config['password']
+ c.auth_method = :basic
+ c.parser = :yajl
+end
+
+client = TweetStream::Client.new()
client.on_delete do |status_id, user_id|
puts "Removing #{status_id} from storage"
tweets.remove({"status" => status_id})
end
+client.on_error do |message|
+ puts "Error received #{message}"
+end
+
params = Hash.new;
params[:follow] = follow_users;
params[:track] = tracking_keywords;
Please sign in to comment.
Something went wrong with that request. Please try again.