Created
October 11, 2016 01:12
-
-
Save shiffman/80b90d01948702900ce5f337b88531ca to your computer and use it in GitHub Desktop.
Twitter Location Stream
This file contains 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
// 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