twit icon indicating copy to clipboard operation
twit copied to clipboard

how to exclude retweets from the streaming api

Open jgamedev opened this issue 8 years ago • 4 comments

I know there has been a similar question for the REST api.

Seems to be same solution proposed in this stackoverflow answer: http://stackoverflow.com/questions/38208493/twitter-api-exclude-retweets-in-stream

However, like the user who posted the question says in the comments, it doesn't seem to work as I don't receive any tweets after applying it.

I made sure I was using very popular track terms

NOTE: because this is sort of a trivial need, it would be great if the actual solution was added to the Read.ME

jgamedev avatar Jul 20 '16 19:07 jgamedev

@jgamedev I was looking for a similar solution, and wrote a simple function to help out. Basically, if the tweet picked up in the stream is anything other than a basic tweet (i.e. a retweet, reply, etc), it returns true.

function isReply(tweet) {
  if ( tweet.retweeted_status
    || tweet.in_reply_to_status_id
    || tweet.in_reply_to_status_id_str
    || tweet.in_reply_to_user_id
    || tweet.in_reply_to_user_id_str
    || tweet.in_reply_to_screen_name )
    return true
}

hoodsy avatar Jul 29 '16 23:07 hoodsy

So there is still no better solution? twitter is providing no filter for the stream? why? this creates tons of useless traffic and data.

a1xon avatar Dec 05 '16 18:12 a1xon

I also wish Twitter would allow filtering of the Stream API, specifically for exclude re-tweets and replies... at least re-tweets. If I am trying to do a live feed of CNN or god forbid Justin Bieber / anyone with millions of followers my server gets bombarded with 20-100 retweets per second... You can filter out in the search API, so I don't understand why it's not a trivial matter to include it in Stream API as well. It seems to be a common request and would lower overhead considerably.

Fizion101 avatar Jul 03 '17 18:07 Fizion101

So there is still no better solution? twitter is providing no filter for the stream? why? this creates tons of useless traffic and data.

Checking by 4 years later, is it known if there's a better way to filter tweets or is this solution still the only up-to-date?

Anatoly03 avatar Apr 28 '21 10:04 Anatoly03