问题
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?
回答1:
I've been successfully excluding retweets by adding +exclude:retweets at the end of my search query.
回答2:
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 :)
来源:https://stackoverflow.com/questions/7400656/twitter-search-atom-api-exclude-retweets