如何获得 Facebook 中随机用户的好友数?

How to get friends count of an random user in Facebook?

有没有办法获取 Facebook 中随机用户的好友数?

我正在尝试提出请求 在

1579961218908589/friends 

在 Graph API Explorer 上,它总是给我空数据。

我认为:不会。 您只能为使用您的应用程序的人获取 total_count 字段。

Only friends who installed this app are returned in API v2.0 and higher. total_count in summary represents the total number of friends, including those who haven't installed the app. Learn More

如果您阅读该端点的 Facebook API documentation,您将能够看到检索用户的朋友需要该人启用您的应用程序的权限。

所以答案是肯定的,如果你有用户的许可,或者否,否则。

如果您拥有所需的权限,则 JSON 响应看起来与 me/friends 的响应相同。

响应通常如下所示:

{
  "data": [
    {
      "name": "Friend Name", 
      "id": "1579961218908589"
    }, 
  ], 
  "paging": {
    "next": ""
  }, 
  "summary": {
    "total_count": 317
  }
}