Skip to content

Instantly share code, notes, and snippets.

@hookdump
Created January 10, 2020 18:58
Show Gist options
  • Save hookdump/6487cd88b704f75a0fb9ce4490a9da0a to your computer and use it in GitHub Desktop.
Save hookdump/6487cd88b704f75a0fb9ce4490a9da0a to your computer and use it in GitHub Desktop.
Monitorear tuits
var Twit = require('twit')
var T = new Twit({
consumer_key: '***',
consumer_secret: '***',
access_token: '***',
access_token_secret: '***',
timeout_ms: 60*1000,
})
// El stream captura todos los tuits que contengan TODAS esas palabras. No hace un match textual.
// No importa el orden de las palabras ni las mayúsculas.
// No matchea mentions. (ej: este ejemplo no matchea @clave)
var stream = T.stream('statuses/filter', { track: 'palabras clave' })
stream.on('tweet', function (tweet) {
console.log(new Date(), tweet.user.screen_name)
// para ver el texto del tuit: tweet.text
// para ver otras propiedades, examinar: console.log(tweet)
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment