简体   繁体   English

Twitter API - 获取帐户的转推计数

[英]Twitter API - Getting the retweet count of an account

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);

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. 每个Tweet都具有在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 . 你会发现的问题是,你可以获得用户推送的最新3200条推文的推文数量受到限制https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get- statuses-user_timeline.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM