Reputation: 235
I am looking to pull the total number of retweets a particular user has ever received. Is that possible?
Right now, I am able to pull the total tweet count, the number of followers and the number of friends.
The code I am working with is:
$username = "username";
$url = "https://api.twitter.com/1.1/users/show.json";
$requestMethod = "GET";
$getfield = "?screen_name=".$username."&include_entities=true";
$twitter = new TwitterAPIExchange($settings);
$string = json_decode($twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest(),$assoc = TRUE);
Upvotes: 3
Views: 7192
Reputation: 1819
The total number of retweets is not a property associated to the Users. Each individual Tweet has the number of retweets it received in the field retweet_count.
You will need to get all the tweets of a user and add up the retweets to get the total retweets a user received. The problem you will find is that you are limited on the number of tweets you can get of a user to the last 3200 tweets https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline.html .
Upvotes: 5