Skip to content

Instantly share code, notes, and snippets.

@akoenig
Created March 4, 2012 18:58
Show Gist options
  • Save akoenig/1974360 to your computer and use it in GitHub Desktop.
Save akoenig/1974360 to your computer and use it in GitHub Desktop.
node.js talk - twitter stream reader
{
"author": "Malte Legenhausen (mlegenhausen@gmail.com), John Philip Schnake (philipschnake@gmail.com), André König (andre.koenig@gmail.com)",
"name": "twitter-streamer",
"description": "A little app which receives tweets in realtime!",
"version": "0.0.1",
"homepage": "http://bremen.gtugs.com",
"repository": {
"url": ""
},
"engines": {
"node": "~0.6.9"
},
"dependencies": {
"ntwitter": "0.2.x"
},
"devDependencies": {},
"optionalDependencies": {}
}
/*
* A little app which receives tweets in realtime!
*
* Author: André König (andre.koenig@gmail.com)
*
*/
"use strict";
var Twitter = require('ntwitter');
var twitter = new Twitter({
consumer_key: 'Place your consumer key here.',
consumer_secret: 'Place your consumer secret here.',
access_token_key: 'Place your access token here.',
access_token_secret: 'Place your access token secret here.'
});
twitter.stream('statuses/sample', function(stream) {
stream.on('data', function (data) {
var user = data.user.screen_name;
var tweet = data.text;
console.log('@' + user + ': ' + tweet);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment