0
Using Node.js, this application should populate the terminal with tweets (the file name is tweet_counter.js
):
var ntwitter = require('ntwitter'),
credentials = require('./credentials.json'),
twitter;
twitter = ntwitter(credentials);
twitter.stream(
'statuses/filter',
{"track" : ["awesome", "cool", "rad", "gnarly", "groovy"] },
function(stream){
stream.on('data', function(tweet){
console.log(tweet.text);
});
}
);
It’s a Twitter API, which uses the credentials provided by twitter, which were saved to the archive credentials.json
, saved in the project root folder along with the tweet_counter.js
:
But running on the terminal displays this error:
Can anyone help me correct that mistake? From now on, thank you very much!
This module is this -> https://github.com/AvianFlu/ntwitter? If it is abandoned.
– Sergio
But there is some other API I can install for the same application?
– Van Ribeiro
On the Mootools website we use this: https://www.npmjs.com/package/twitter, the stream part looks like the same API as yours: https://github.com/desmondmorris/node-twitter#streaming-api
– Sergio
Thanks! It now displays no more errors but also does not display output..
– Van Ribeiro
Something appears in the Node console/window?
– Sergio
No, I know you ran because no error status appears, but it also does not display any output in the terminal
– Van Ribeiro
Mute
console.log(tweet.text);
forconsole.log('tweet:', tweet);
something comes up?– Sergio
No, nothing shows up...
– Van Ribeiro