从facebook graph-api获取好友列表

时间:2015-02-03 16:48:03

标签: python json facebook facebook-graph-api

我想从facebook Graph-api获取用户的好友列表。所以当我尝试通过你的urlopen打开获取访问令牌时

https://graph.facebook.com/facebook_id/friends?access_token=authentic_accesstoken

即使我直接在浏览器上打开它,也不会给人员(facebook_id)的friend_list,至少不是整个列表。这就是它在浏览器上显示的内容

{
   "data": [
      {
         "name": "Face_id_name",
         "id": "facebook_numeric_id"
      }
   ],
   "paging": {
      "next": "https://graph.facebook.com/v2.2/facebook_id/friends?access_token=authentic_accesstoken&limit=25&offset=25&__after_id=enc_Some_encrypted_code"
   },
   "summary": {
      "total_count": 263
   }
}

在数据中,它不会显示整个列表,当我使用paging: next:的链接时,它不再给我任何重新计算的总数。
我不完全确定我的网址是否正确。

1 个答案:

答案 0 :(得分:1)

您无法获得任何用户的朋友,出于隐私原因,您只能获得授权用户的朋友和仅授权应用的用户。所以这是唯一正确的电话:

https://graph.facebook.com/me/friends?access_token=authentic_accesstoken

无需使用该ID,因为您无论如何都只能使用授权用户的ID。所以你可以改用“我”。

有关有限朋友结果的更多信息可以在无数其他线程中找到,例如:Facebook Graph Api v2.0+ - /me/friends returns empty, or only friends who also use my app