How to Exclude retweets and replies in a search api?
I am trying to fetch the feeds from twitter using search api, in the result I am getting replies and retweets also.
So I want to exclude replies and retweets.
How to do it anybody help me.
This is my url:
https://api.twitter.com/1.1/search/tweets.json?q=from:rioferdy5&count=20&result_type=recent
If you fetch tweets using the tweepy library of python then you can achieve filtering retweets by appending “ -filter:retweets” to the search query. The code will look something like this: for status in tweepy. Cursor(api.search,q=query+" -filter:retweets",lang='en',result_type='recent').
There is no way to filter from the web UI all retweets. What you will need to do is go to each profile you follow, then: Click the gear icon. Select Turn off Retweets.
What is a Retweet? A Tweet that you share publicly with your followers is known as a Retweet. This is a great way to pass along news and interesting discoveries on Twitter. You have the option to add your own comments and/or media before Retweeting.
I beleive the above is incorrect, you can use filters in the search API but the documentation is very poor (non-existent?).
Your query would become:
?q=from:rioferdy AND -filter:retweets AND -filter:replies&count=20&result_type=recent
More tips for filtering were obtained here: How to Master Twitter Search: Basic Boolean Operators and Filters
Old post, but people might still stumble upon it.
Most query operators are documented here: https://dev.twitter.com/rest/public/search
But for the search/tweets method, you can also specify exclude:replies
and/or exclude:retweets
to filter out replies and retweets from the result.
Just test it in the API Console Tool and see for yourself.
Bonus: Another undocumented query operator is filter:verified
to get tweets from verified users.
Example query: cats filter:vine filter:verified exclude:replies exclude:retweets
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With