10

I am using the Atom search API from Twitter. Now I present all (newest 5) tweets with a certain word. But unfortunately, many people retweet this one post and I get the same post 5 times.

Can I exclude retweets? If so, how?

Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
planIT
  • 241
  • 1
  • 2
  • 8

2 Answers2

17

I've been successfully excluding retweets by adding +exclude:retweets at the end of my search query.

peterkuterna
  • 474
  • 3
  • 6
  • 1
    This seems to have the same effect as "-rt". I tried a few search strings containing **RT** and with **+exclude:retweets** they never return anything. – Carcamano Apr 02 '12 at 23:53
6

I've done that and I'll share how you accomplish this. This would be your search query:

http://search.twitter.com/search.atom?lang=en&rpp=100&q=[yourpost-value]-filter:retweets

This will exclude the retweets 100% and it worked for me :). If you have a problem with this, here is the alternate way:

Concatenate -filter:retweets within the function you are calling, here is an example:

if(isset($_POST['q'])){
  $q = $_POST['q']."-filter:retweets";
} 

Now you just need to execute you search query:

http://search.twitter.com/search.atom?lang=en&rpp=100&q=[post-value]

I hope this helps, have fun with programming :)

Cosmin
  • 21,216
  • 5
  • 45
  • 60
waqar ahmed
  • 61
  • 1
  • 1