Skip to content

Instantly share code, notes, and snippets.

@shiffman
Created October 11, 2016 01:12
Show Gist options
  • Save shiffman/80b90d01948702900ce5f337b88531ca to your computer and use it in GitHub Desktop.
Save shiffman/80b90d01948702900ce5f337b88531ca to your computer and use it in GitHub Desktop.
Twitter Location Stream
// Using the Twit node package
// https://github.com/ttezel/twit
var Twit = require('twit');
var config = require('./config.js');
var T = new Twit(config);
// lat long bounding box
var newyork = '-74,40,-73,41';
var stream = T.stream('statuses/filter', { track: 'rainbow', locations: newyork });
stream.on('tweet', gotTweet);
function gotTweet(tweet) {
// Check if location is working
if (tweet.place != null) {
console.log('Location ' + tweet.place.name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment