twitter api v1.1 - exclude retweets from tweet count
I've got a simple function set up to get a users last 3 tweets excluding
retweets. The problem I've just noticed however is that if the users top 3
tweets contain a retweet the count that I send to twitter gets incremented
meaning that if say 2/3 of the last 3 are retweets, I only get back 1
tweet from twitter.
I'm using the following code to do this
<?php
$settings = array(
'oauth_access_token' => "xxx-xxx",
'oauth_access_token_secret' => "xxx",
'consumer_key' => "xxx",
'consumer_secret' => "xxx"
);
$url = "https://api.twitter.com/1.1/statuses/user_timeline.json";
$getField = '?username=USERNAME&include_rts=false&count=3';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
echo $twitter->setGetfield($getField)
->buildOauth($url, $requestMethod)
->performRequest();
Is there a simple work around that doesn't involve me making multiple
requests to the API until I know I've got 3 tweets? I do cache the tweets,
so making multiple calls wouldn't be an issue, however it's a horrible way
to solve the problem.
I'm pretty surprised this is how the API appears to work, seems to be
lacking common sense... Am I just missing a simple function/parameter that
rectifies this?
No comments:
Post a Comment