Facebook Graph API fql查询类似于计数与直接对象查找

时间:2012-11-20 05:40:19

标签: facebook facebook-graph-api facebook-like facebook-fql

为什么这两个查询会返回不同的计数?

1)fql?q ...查询返回0赞

https://graph.facebook.com/fql?q=SELECT+url%2C+normalized_url%2C+share_count%2C+like_count%2C+comment_count%2C+total_count%2C+commentsbox_count%2C+comments_fbid%2C+click_count+FROM+link_stat+WHERE+url%3D%27http%3A%2F%2Fwww.facebook.com%2Fpages%2FLine-And-Circle%2F49561759728%27

返回:

{
  "data": [
    {
       "url": "http://www.facebook.com/pages/Line-And-Circle/49561759728",
       "normalized_url": "http://www.facebook.com/pages/Line-And-Circle/49561759728",
       "share_count": 0,
       "like_count": 0,
       "comment_count": 0,
       "total_count": 0,
       "commentsbox_count": 0,
       "comments_fbid": null,
       "click_count": 0
    }
 ]
}

2)直接对象查询返回436喜欢

https://graph.facebook.com/49561759728

返回:

{
    "name": "Line & Circle",
    "is_published": true,
    "website": "http://lineandcirclemusic.tumblr.com/",
    "description": "follow \u0040LineAndCircle",
    "about": "Echo Park, Los Angeles via the Midwest, USA. http://lineandcirclemusic.tumblr.com/",
    "genre": "Indie/Alternative",
    "hometown": "Los Angeles, California",
    "current_location": "Los Angeles, California",
    "record_label": "White Iris",
    "press_contact": "lineandcirclemusic\u0040gmail.com",
    "influences": "Richard Neutra, Erik Satie, Lord Byron, Richard Yates, Grace Kelly, Phil Hartman, Bobby Briggs, Denard Robinson, etc.",
    "band_interests": "Ice cream, ice fishing, etc.",
    "category": "Musician/band",
    "id": "49561759728",
    "link": "https://www.facebook.com/pages/Line-Circle/49561759728",
    "likes": 436,
    "cover": {
       "cover_id": "10151094140979729",
       "source": "http://sphotos-a.xx.fbcdn.net/hphotos-ash4/s720x720/391388_10151094140979729_1992918206_n.jpg",
       "offset_y": 31
    }
}

在其他情况下,例如用户名“newfoundglory”,fql查询会返回类似于count的内容,但它仍然与直接查询不同。

为什么这两个查询会返回不同的结果?

2 个答案:

答案 0 :(得分:0)

第一个图形调用返回0个喜欢,正如预期的那样,因为该表用于跟踪外部网址的喜欢和评论,而不是Facebook上的内部页面。
要获取该数据,您应该使用页面表并查询fan_count -

select page_id, name, page_url, fan_count from page where name = 'Line & Circle'

返回预期结果 -

"data": [
{
  "page_id": 49561759728, 
  "name": "Line & Circle", 
  "page_url": "https://www.facebook.com/pages/Line-Circle/49561759728", 
  "fan_count": 436
}
]

答案 1 :(得分:0)

graph.facebook.com/49561759728?fields=likes

{    “喜欢”:637,    “id”:“49561759728” }

我使用此链接生成https://developers.facebook.com/tools/explorer/?method=GET&path=agenciadac%3Ffields%3Dlikes