1

如何获得 Facebook 帖子的“点赞”数?

我有一个链接graph.facebook.com/userid_postid说我可以做到这一点。但是如何找到用户或页面 ID 以及帖子的 ID?

例如,如果在粉丝页面上发布任何帖子:http: //www.facebook.com/TipsLearnings of site http://adityabajaj.com

如果我在上面的粉丝页面上发了一个帖子,并且人们喜欢这个帖子,我如何获得那个帖子的点赞数?我希望该号码可以显示在单独的网站上。

4

3 回答 3

4

您可以使用 FQL

SELECT like_info.like_count, share_info.share_count, comment_info.comment_count FROM stream WHERE post_id = 'your_post_id'
于 2013-12-19T12:33:07.967 回答
1

您可以使用有效的访问令牌获取粉丝页面的最新帖子列表/<PAGE_ID>/posts(您可以通过导航到您的页面找到该页面http://graph.facebook.com/myown.easytipsandtricks,或者仅使用用户名)。从那里,你得到一个看起来像这样的对象:

"data": [
{
    "id": "22092443056_115909438544849",
    "from": {
        "name": "Starbucks",
        "category": "Food/beverages",
        "id": "22092443056"
    },
    // ...
    "shares": {
        "count": 708
    },
    "likes": {
        "data": [
        {
            "name": "Shanna Gonzales",
            "id": "100000244536406"
        }
        ],
        "count": 17129
    },
    "comments": {
        "count": 759
    }
}
// ... and more posts

访问count每个字段的子字段应该分别告诉您分享、喜欢和评论。

于 2012-05-02T13:25:53.247 回答
0

您可以通过将 fields 参数与likes.limit(1).summary(true). 例如,下面的披萨搜索 api 查询将为您提供所有公开帖子及其喜欢计数汇总:

https://graph.facebook.com/search?q=pizza&type=post&fields=id,name,likes.limit(1).summary(true)

结果(截断):

{
  "data": [
    {
      "id": "47883936273_659693910762305", 
      "name": "Instagram", 
      "created_time": "2014-02-16T01:15:29+0000", 
      "likes": {
        "data": [
          {
            "id": "100002243084532", 
            "name": "Yvette Martin"
          }
        ], 
        "paging": {
          "cursors": {
            "after": "MTAwMDAyMjQzMDg0NTMy", 
            "before": "MTAwMDAyMjQzMDg0NTMy"
          }, 
          "next": "https://graph.facebook.com/47883936273_659693910762305/likes?limit=1&summary=1&after=MTAwMDAyMjQzMDg0NTMy"
        }, 
        "summary": {
          "total_count": 13682
        }
      }
    }, 
    {
      "id": "136336876521150_314001148754721", 
      "name": "Pizza Box Turns into Plates & Storage Unit!", 
      "created_time": "2014-02-15T21:20:00+0000", 
      "likes": {
        "data": [
          {
            "id": "100005373008864", 
            "name": "Liliana Campoli"
          }
        ], 
        "paging": {
          "cursors": {
            "after": "MTAwMDA1MzczMDA4ODY0", 
            "before": "MTAwMDA1MzczMDA4ODY0"
          }, 
          "next": "https://graph.facebook.com/136336876521150_314001148754721/likes?limit=1&summary=1&after=MTAwMDA1MzczMDA4ODY0"
        }, 
        "summary": {
          "total_count": 2792
        }
      }
    }
于 2014-02-20T20:08:20.900 回答