如何在 Facebook Graph API 中获取好友详细信息?
如何获取两个人的友谊详细信息?例如,在网络中它将是:
http://www.facebook.com/<my_id>?and=<friend_id>
有什么方法可以在 Graph API 中做到这一点吗?此外,我可以获取特定物品,例如在一起的照片、我们之间的墙贴等吗? (据我所知,没有记录,但许多 Graph API 功能无论如何都不是......)
编辑:我认为 Graph API 应该可以实现。例如,获取家庭详细信息(兄弟、姐妹、父母等)没有记录在案,但我仍然能够做到。
How can I get a friendship detail for two people? So for example in the web it will be:
http://www.facebook.com/<my_id>?and=<friend_id>
Is there any way I can do this in Graph API? Furthermore can I get specific items such as photos together, wall posts between us, etc? (Not documented AFAIK, but many Graph API features aren't anyway...)
EDIT: I think it should be possible with Graph API. For example getting family details (brother, sister, parents, etc) is not documented yet I still able to do it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您可以通过执行多个 FQL 查询来模拟友谊查询。例如,要获取两个好友 A 和 B 之间的所有照片,可以:
重复,这次选择 B 中的照片。
您可以将相同的概念应用于其他事物,例如帖子、点赞、视频等。
You can simulate a friendship query by doing multiple FQL queries. For example, to get all the photos between two friends A and B, you can:
Repeat, this time selecting photos from B.
You can apply the same concept on other things such as posts, likes, videos etc.
是的,我认为您也可以使用 Graph API 而不是 FQL 做同样的事情
phillee
回答:https://graph.facebook.com/USERID/photos
https://graph.facebook.com/PHOTOID/tags
https ://graph.facebook.com/PHOTOID/comments
https://graph.facebook.com/USERID/feed
https://graph.facebook.com/USERID/posts
http://developers.facebook.com/docs/reference/api/user/
对于兴趣、电影、活动等,只需对两者进行 API 调用(
https:// /graph.facebook.com/ONEUSER/music
和https://graph.facebook.com/OTHERUSER/music
)并找到两组数据的交集(循环遍历每组数据)列出所有匹配项并将其保存到单独的相互喜欢列表中)不过,没有针对友谊的特定 API 调用,因此您将必须构建自己的 API。我的猜测是 Facebook 在他们的友谊页面上正是这样做的:)
使用 FQL 应该和使用 REST API 一样简单...使用 FQL 甚至更容易,因为您可以添加 WHERE 条件并只返回您需要的数据(
SELECT * FROM comments WHERE fromid = FRIENDID
),而不是对 API 返回的大列表进行排序(除非有办法向 API 请求 URL 添加条件?)。Yes, I think you can also do the same thing
phillee
answered with the Graph API instead of FQL:https://graph.facebook.com/USERID/photos
https://graph.facebook.com/PHOTOID/tags
https://graph.facebook.com/PHOTOID/comments
https://graph.facebook.com/USERID/feed
https://graph.facebook.com/USERID/posts
http://developers.facebook.com/docs/reference/api/user/
For the interests, movies, activities, etc just make an API call for both (
https://graph.facebook.com/ONEUSER/music
andhttps://graph.facebook.com/OTHERUSER/music
) and find the intersection of the two sets of data (loop through each list and save all matches to a separate list of mutual Likes)There are no specific API calls for friendships though, so you will have to build your own. My guess is that Facebook is doing exactly this on their Friendship pages :)
It should be just as easy with FQL as with the REST API... maybe even easier with FQL since you can add WHERE conditions and get back just the data you need (
SELECT * FROM comments WHERE fromid = FRIENDID
), instead of sorting through the big list returned by the API (unless there is a way to add conditions to API request URLs?).如果我理解正确的话,您想要“查看友谊”
这种类型的查询不能直接使用图形 API(目前)。您需要从每个资源端点收集信息,然后自行执行一些与“查看友谊”相关的操作
If I understand properly you want to "View Friendship"
This type of query is not directly possible using the Graph API (at the moment). You would need to gather the information from each resource endpoint and then do some relating on your own part to "View Friendship"
这就是我一直在使用的:
调用main()!
This is what I have been using:
Call main()!
获取两个(或更多)用户被标记的照片:
Getting the photos where two (or more) users are tagged in:
http://bighnarajsahu.blogspot.in /2013/03/facebook-graph-api-to-get-user-details.html
这是获取 Facebook 好友列表的完整代码。
http://bighnarajsahu.blogspot.in/2013/03/facebook-graph-api-to-get-user-details.html
This is the complete code to get the friendlist in Fb.