开发者

Getting mutual friends number FAST?

Let's say I have a user A who is using my facebook app, and A has a friend B who is not using the app. Can I get the number of mutual friends between A and B?

EDIT

Colm, correctly suggested to use friends.getMutualFriends, but unfortunately it's VERY VERY SLOW. So I was thinking, is there maybe any FQL code that can do the same but much faster?

I found FQL queries (after searching) like this:

SELECT uid1, uid2 FROM friend WHERE uid1 IN (SELECT uid2 FROM friend WHERE uid1=me()) AND uid2 IN (SELECT uid2 FROM friend WHERE uid1 = friend_id;

but they don't work, and throw the following error:

Can't lookup all friends of XXXXXXX. Can only lookup for the logged in user (XXXXXXX), or friends of the logged in user with the appropriate permission.

So, what is this appropriate permission?


This question is based on my previously asked question, but I need just the number of mutual friends, n开发者_Python百科ot the list of B friends. I couldn't find anything in graph api permissions list :(

Thanks!!


You can mutual_friend_count attribute in user table

SELECT uid, mutual_friend_count from user where uid=53638897


Facebook Graph API has just added mutual friend support according to their latest blog post via this type of url: https://graph.facebook.com/me/mutualfriends/FRIEND_ID.


No, you'd have to get both lists and diff them in your code if you wanted to use the Graph API. Or you could run a loop that calls /User_id1/friends/User_id2 and that will return true if User_id1 is friends with User_id2.

If you are ok with using the Rest API, you can use friends.getMutualFriends.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜