Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NodeJS nTwitter Demo

Is there any sample Demo for Streaming Tweets from Twitter using nTwitter?

I have configured my access and secret keys from dev.twitter.com.

But still a fully guided Tutorial would Help I referred to http://blog.semmy.me/post/17390049513/streaming-twitter-with-ntwitter-and-node-js This Tutorial, But couldn't figure out the client side.

Also tried using socket.io but to no avail.

like image 287
bombayquant Avatar asked Jul 19 '26 10:07

bombayquant


1 Answers

What are you having trouble with? Setting up a stream is super easy - the blog you posted even has the code samples all ready:

var t = new twitter({
  consumer_key: 'your',
  consumer_secret: 'twitter',
  access_token_key: 'keys',
  access_token_secret: 'here'
});

t.stream(
  'statuses/filter',
  { track: ['awesome', 'cool', 'rad', 'gnarly', 'groovy'] },
  function(stream) {
    stream.on('data', function(tweet) {
      console.log(tweet.text);
    });
  }
);

However, you should check out other forks of ntwitter like mtwitter, as ntwitter hasn't been updated in a long time. If streaming is the only thing you need, you can check out my fork https://github.com/mileszim/twat that handles all the reconnection and backoff guidelines.

like image 177
Miles Zimmerman Avatar answered Jul 21 '26 22:07

Miles Zimmerman