skip to Main Content

I’m using Node.js package Twit to stream tweets and currently it’s including retweets as well but I don’t want it to. My code looks like this:

var stream = T.stream('statuses/filter', { track: '#myhashtag' });

and I’ve tried this but it didn’t work:

var stream = T.stream('statuses/filter', { track: '#myhashtag' }, '-filter:retweets'); 

3

Answers


  1. The filter should be concatenated to the end of your query as shown below.

    var stream = T.stream('statuses/filter', { track: '#myhashtag -filter:retweets' }); 
    
    Login or Signup to reply.
  2. After quite a research i think the ‘-filter:retweets’ operator for query parameter has been outdated what worked for me was ‘-RT’ operator.

    var stream = T.stream('statuses/filter', { track: '#myhashtag -RT' });
    
    Login or Signup to reply.
  3. when the tweet is a retweet, there is an existence of retweeted_status, otherwise it is undefined. maybe this will help:

    if (tweet.retweeted_status == undefined) {
    
    }
    

    alternatively, another user proposed a function that might help:
    https://github.com/ttezel/twit/issues/286#issuecomment-236315960

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search