问题描述
我需要检索给定Facebook应用程序的粉丝数量.使用 GraffitiWall应用程序示例在Facebook Graph API 中,该页面显示的粉丝总数接近120万.但是,Graph API 不返回粉丝数:
I need to retrieve the number of fans for a given Facebook application. Using the GraffitiWall application example in the Facebook Graph API, that page displays a fan total numbering somewhere near 1.2 million. The Graph API, however, returns no fan_count:
{
"id": "2439131959",
"name": "Graffiti",
"description": "Graffiti lets you draw on your friends' profiles.",
"category": "Just For Fun",
"link": "http://www.facebook.com/graffitiwall"
}
在graffitiwall应用程序上的喜欢是在页面上还是在该应用程序上?如果是页面,在给定应用程序ID的情况下,如何以编程方式确定页面ID?如果是应用程序,如何获得风扇数?我需要成为该应用程序的管理员吗?这只能通过Facebook Insights使用吗?
Are the likes on the graffitiwall application likes for the page or for the application? If for the page, how do I programmatically determine the page ID given the application ID? If for the application, how do I get that fan count? Do I need to be an admin for that application? Is this only available using Facebook Insights?
为便于记录,我也尝试指定了应用程序ID ,但该操作还返回了上面的块. 使用应用程序页面URL ,返回股份值:
For the record, I've also tried specifying the application ID, but that also returns the above block. Using the application page URL, a shares value is returned:
{
"id": "http://www.facebook.com/graffitiwall",
"shares": 19
}
也许我在API文档或图形API论坛中缺少某些内容,但我在任何一个位置都找不到答案.
Perhaps I'm missing something in the API documentation or the Graph API forum, but I couldn't find the answer in either location.
推荐答案
通过在page
表上运行FQL,可以获得风扇数量:
You can get number of fans by running FQL on page
table:
FB.Data.query("select fan_count from page where page_id = 2439131959");
(fan_count
是未记录的字段,请不要使用它,或者他们只是忘记在文档中提及它,这不会让我感到惊讶)
(fan_count
is undocumented field btw, either it is deprecated or they just forgot to mention it in their docs which wouldn't surprise me much)
不知道您是否也在询问喜欢,但以防万一,这是一个示例,如何通过url获取喜欢的次数:
Not sure if you were asking about likes as well, but just in case here is an example how to get number of likes by url:
FB.Data.query('select like_count from link_stat where url="http://www.facebook.com/graffitiwall"');
这篇关于如何使用Graph API检索Facebook应用程序页面的fan_count?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!