Created
January 10, 2020 18:58
-
-
Save hookdump/6487cd88b704f75a0fb9ce4490a9da0a to your computer and use it in GitHub Desktop.
Monitorear tuits
This file contains hidden or 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
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