获取 Facebook 上好友的好友列表
我最近开始研究 Facebook API,并试图找出如何检索另一个用户的朋友列表(在本例中,该用户是我的朋友)。
到目前为止,我只知道如何找到我也是朋友的人的朋友。然而,Friends Wheel 应用程序可以做到这一点,因为您可以为您的一位朋友生成轴距,所以我猜这是可能的。
有人知道该怎么做吗?
I've recently started looking into the Facebook API and am trying to work out how to retrieve the list of friends of another user (in this case the user is someone I'm friends with).
So far I've only worked out how to find out the friends of a person who I am also friends with. However the Friends Wheel application can do it as you can generate a wheel base on one of your friends, so I'm guessing it is possible.
Anyone know how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您只能访问登录用户的好友列表(即您的好友列表)或登录用户的好友是您应用的用户。即,只有当您的朋友是您的应用程序的用户时,您才能访问朋友的好友列表。
You Can only access friends list of logged in user(i.e, your friend list) or the logged in user's friends that are users of your app. i.e, You can access friends friend list only if your friends are the users of your app.
您可以使用
friends.are_friends
检查您的两个朋友是否是朋友。You can check if two of your friends are friends using
friends.are_friends
.获得用户的有效访问令牌后,您可以使用该令牌查询 Graph API 并查询用户对象的“friends”连接 (/me/friends)。因此,如果您的用户 ID 是“123”:
https://graph.facebook.com/123 /friends?access_token=USERS_ACCESS_TOKEN
您还可以使用 /me 引用当前用户:
https://graph.facebook.com/me/friends?access_token=USERS_ACCESS_TOKEN
如果没有有效的访问令牌,您将无法查询有关用户的信息,并且对朋友的朋友的访问权限由每个用户决定。例如,我看不到我朋友的一些朋友:
...但对于我的其他一些朋友来说,我可以。可能有一个权限或标志,您可以检查它们是否允许访问,但我目前没有看到它。
Once you've got a valid access token for a user, you can query the Graph API with said token and query the "friends" connection of the user object (/me/friends). So if your user ID is "123":
https://graph.facebook.com/123/friends?access_token=USERS_ACCESS_TOKEN
You can also use /me to reference the current user:
https://graph.facebook.com/me/friends?access_token=USERS_ACCESS_TOKEN
Without a valid access token, you cannot query information about users and access to friends of friends is determined by each user. For example, I cannot see some of my friend's friends:
...but for some of my other friends, I can. There's probably a permission or flag you can check to see if they allow access, but I'm not currently seeing it.
我明白了这一点。
1) 你能做的最好的事情就是找到共同的朋友
2) 尝试使用 Facebook Graph API v1.0。 v2.0 没有
/mutualfriends
。3)由于我只对自己的社交网络感兴趣,因此我从图形浏览器中获取了访问令牌并编写了一个Python脚本来下载我的整个社交网络。代码在github上
I figured this out.
1) The best you can do is find mutual friends
2) Try using the v1.0 of the Facebook Graph API. v2.0 doesn't have
/mutualfriends
.3) Since I was only interested in my own social network, I grabbed the access token from the graph explorer and wrote a python script to download my whole social network. The code is on github
是的,可以获取朋友的朋友列表,但唯一的条件是该朋友应该是该应用程序的用户。
假设有一个应用程序“APP”被“A”使用,那么该APP可以获取他的好友列表,现在你想要“B”的好友列表,他是“A”的好友,只有“B”也使用时才有可能“应用程序”
Yes, its possible to get List of Friends of a friend but only condition is that friend should be user of that application.
Suppose there is an application "APP" used by "A" then the APP can get his friends List , now you want friends List of "B" who is friend of "A" , it will be possible only if "B" also uses the "APP"
Facebook 正在弃用 REST API,并为此方法添加了对 Graph API 的等效支持。您可以使用 Graph API - User 对象和 Get /User_id1/friends/User_id2 来检查 User_id1 是否是 User_id2 的好友。
Facebook are in the process of deprecating the REST API, and have added equivalent support to the Graph API for this method. You can use Graph API - User object and Get /User_id1/friends/User_id2 to check if User_id1 is friends with User_id2 .