如何让用户朋友数谁也喜欢facebook页面


How could get user friends count who also like a facebook page?

我只需要计算喜欢facebook页面的用户朋友数。我已经为此制作了一个脸书应用程序。用户应该访问该应用程序,这样我们才能收到用户的详细信息。

然后使用FQL运行查询

SELECT uid FROM page_fan WHERE page_id = 'Page Id' AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me())

但它只显示访问该应用程序并喜欢该页面的朋友列表。我还需要那些喜欢这个页面但不使用该应用程序的朋友。

这可能吗?

如果您使用的应用程序具有Graph API v2.0或更高版本,则无法再通过FQl获取。

您可以使用新的Social Context API,它应该提供您想要的信息(普通用户数)。看看https://developers.facebook.com/docs/graph-api/reference/v2.0/page.context/friends_who_like

样品请求:

GET /{Page_ID}?fields=context{friends_who_like}

将生成这样的输出:

{
  "context": {
    "friends_who_like": {
      "data": [
        {
          "id": "8490902464564645645", 
          "name": "Friend 1"
        }
      ], 
      "paging": {
        "cursors": {
          "before": "ODQ5MDkwMjQ2", 
          "after": "ODQ5MDkwMjQ2"
        }
      }, 
      "summary": {
        "social_sentence": "4 of your friends like this.", 
        "total_count": 4
      }
    }
  }, 
  "id": "40796308305"
}

属性context.friends_who_like.summary.total_count将包含喜欢示例CocaCola页面的朋友的总数(ID 40796308305)。