How to resolve the issue with the route in Node.js?

Asked

Viewed 240 times

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:

Posição das Pastas

But running on the terminal displays this error: Erro de Execução

Can anyone help me correct that mistake? From now on, thank you very much!

  • 1

    This module is this -> https://github.com/AvianFlu/ntwitter? If it is abandoned.

  • But there is some other API I can install for the same application?

  • 1

    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

  • Thanks! It now displays no more errors but also does not display output..

  • 1

    Something appears in the Node console/window?

  • No, I know you ran because no error status appears, but it also does not display any output in the terminal

  • 1

    Mute console.log(tweet.text); for console.log('tweet:', tweet); something comes up?

  • No, nothing shows up...

Show 3 more comments

1 answer

0


As recorded in the comments of this question, modulus ntwitter was discontinued (DEPRECATED). An alternative to it is the module Twit. You need to see the documentation for this API, because some functions differ from the ones I tried previously.

In that repository, there is an example of using the module Twit.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.