How to get mutual facebook likes between users who

2019-04-08 01:35发布

Let's say two users are using an application and have granted the application appropriate permissions to retrieve their likes. Is it possible using FQL or the graph api to find what likes they have in common? Similar to how you can find mutualfriends between two users using the graph api. I don't think such an api call exists as I went through the docs but I may have missed it. I'd like to know if this is possible and if so, how it can be done. I really stink with SQL and just started with FQL and can get all the likes from a single user, but how do you get only the common likes between two users (if at all possible)?

2条回答
Deceive 欺骗
2楼-- · 2019-04-08 01:58

FQL ain't available anymore. You can do it with the graph API from facebook. Something like this :

graph.setAccessToken(user.facebookToken);
  graph.get("/"+targetFacebookId+"?fields=context", null,  function(err, result) {
    if (err) {
      notDoStuff(err);
    } else {
      doStuff(result);
    }
  });
查看更多
兄弟一词,经得起流年.
3楼-- · 2019-04-08 02:00

This can be achieved via FQL.

1) Select the pages of user 1

SELECT page_id FROM page_fan WHERE uid = $user1

2) Select the pages of user 2, and use the page_id's from the previous query as another filter (aka - a sub query)

Which gives you a final complete query that accomplishes this:

SELECT page_id FROM page_fan WHERE uid= $user2 AND page_id IN (SELECT page_id FROM page_fan WHERE uid = $user1)
查看更多
登录 后发表回答