0
votes

Is there any way to get the data from twitter api for any location?

var sanFrancisco = ['79.86','12.62','80.28','13.21']
var stream = T.stream('statuses/filter', { locations: sanFrancisco })

stream.on('tweet', function (tweet) {
  console.log(tweet)

It gives an error:

Error: Bad Twitter streaming request: 401
at Object.exports.makeTwitError (/home/file_upload/node_modules/twit/lib/helpers.js:74:13)
at IncomingMessage. (/home/file_upload/node_modules/twit/lib/streaming-api-connection.js:95:29) at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:943:16
at process._tickCallback (node.js:419:13)

1
Your question says browser, your code shows server-side code?Tobi

1 Answers

0
votes

I assume you followed the usage guide here https://github.com/ttezel/twit#usage and created the twit object with suitable OAuth keys?

Another possibility for this error is if your clock is out of sync, the twitter endpoint will reject requests if the time is out by a few minutes. Check your computers time is correct.