Created
August 23, 2011 22:38
-
-
Save spolu/1166800 to your computer and use it in GitHub Desktop.
Twitter Streaming
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
var TwitterNode = require('twitter-node').TwitterNode; | |
var twit = new TwitterNode({ user: /*TWITTER-USER*/, | |
password: /*TWITTER-PASSWORD*/, | |
track: ['code', 'coding'], | |
headers: { "User-Agent": 'my user agent' } | |
}); | |
twit.on('error', function(error) { | |
console.log(error.message); | |
}); | |
twit | |
.on('tweet', function(tweet) { | |
/* DO SOMETHING */ | |
}) | |
.on('limit', function(limit) { | |
sys.puts("TWIT-LIMIT: " + sys.inspect(limit)); | |
}) | |
.on('delete', function(del) { | |
sys.puts("TWIT-DELETE: " + sys.inspect(del)); | |
}) | |
.on('end', function(resp) { | |
sys.puts("TWIT-END: " + resp.statusCode); | |
}) | |
.stream(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment