Facebook API:获得页面/群组帖子点赞、分享、评论数的最佳方式?

Facebook API: best way to get like, share, comment count for a page/group post?(Facebook API:获得页面/群组帖子点赞、分享、评论数的最佳方式?)
本文介绍了Facebook API:获得页面/群组帖子点赞、分享、评论数的最佳方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

获得帖子点赞、分享和评论数的最佳方式是什么?

What's the best way to get the like, share, comment count for a post?

我正在尝试通过 FQL,但当 URL 是 FB 帖子 URL 时,它似乎没有提供任何数据:

I'm trying via FQL but it doesn't seem to give any data when the URL is a FB post URL:

SELECT like_count、comment_count、share_count FROM link_stat WHEREurl="https://www.facebook.com/Macklemore/posts/10153256675935268"

SELECT like_count, comment_count, share_count FROM link_stat WHERE url="https://www.facebook.com/Macklemore/posts/10153256675935268"

当我通过 Graph API Explorer 获取帖子信息时:

When I get the post info via the Graph API Explorer:

386050065267_10153256675935268

386050065267_10153256675935268

它给我点赞数和分享数,我可以通过386050065267_10153256675935268/comments?summary=true

It gives me the like count and share count and I can get the comment count via 386050065267_10153256675935268/comments?summary=true

{
  "id": "386050065267_10153256675935268", 
  "from": {
    "category": "Musician/band", 
    "name": "Macklemore", 
    "id": "386050065267"
  }, 
  "message": "We’re playing a FREE show in November to celebrate the new Microsoft Store opening in Jacksonville, Florida. Come see us! Info here: http://msft.it/STJevent

Thursday, November 21, 2013
10:00 p.m.
Start lining up for your chance to attend the show on Saturday.
Location: Outdoors behind Oakley, near Dick’s Sporting Goods.", 
  "actions": [
    {
      "name": "Comment", 
      "link": "https://www.facebook.com/386050065267/posts/10153256675935268"
    }, 
    {
      "name": "Like", 
      "link": "https://www.facebook.com/386050065267/posts/10153256675935268"
    }
  ], 
  "privacy": {
    "value": ""
  }, 
  "type": "status", 
  "status_type": "mobile_status_update", 
  "created_time": "2013-09-26T16:30:23+0000", 
  "updated_time": "2013-09-27T20:39:45+0000", 
  **"shares": {
    "count": 274
  },** 
  "likes": {
    "data": [
      {
        "name": "Jabson Ramos", 
        "id": "100005418486411"
      }, 
      {
        "name": "Sophia Belen Parada Andrades", 
        "id": "100002552653152"
      }, 
      {
        "name": "Oli Barrera", 
        "id": "100001718791443"
      }, 
      {
        "name": "Viktoria Martinez", 
        "id": "1697663024"
      }
    ], 
    **"count": 3345**
  }, 
  "comments": {
    "data": [
      {
        "id": "10153256675935268_43537841", 
        "from": {
          "name": "Vu Thai", 
          "id": "1338690172"
        }, 
        "message": "Sean Viray Matt Win Soo... about my birthday weekend...", 
        "message_tags": [
          {
            "id": "75311036", 
            "name": "Sean Viray", 
            "type": "user", 
            "offset": 0, 
            "length": 10
          }, 
          {
            "id": "25113189", 
            "name": "Matt Win", 
            "type": "user", 
            "offset": 11, 
            "length": 8
          }
        ], 
        "can_remove": false, 
        "created_time": "2013-09-26T16:31:03+0000", 
        "like_count": 4, 
        "user_likes": false
      }, 
      .....
    ], 
    "paging": {
      "cursors": {
        "after": "MjY=", 
        "before": "MQ=="
      }, 
      "next": "https://graph.facebook.com/386050065267_10153256675935268/comments?limit=25&after=MjY="
    }
  }
}

奇怪的是,当我在我的应用程序中运行该查询时,我没有得到共享计数或喜欢计数.难道我做错了什么?资源管理器中的数据与应用程序有权访问的数据不同吗?

Weird thing is when I run that query in my app I don't get the share count or like count. Am I doing something wrong? Is the data in the explorer different from what apps have access to?

我知道我可以通过 386050065267_10153256675935268/likes?summary=true 获得点赞数

I know I can get the like count via 386050065267_10153256675935268/likes?summary=true

最大的问题是缺少份额数.

Biggest thing would be the missing share count.

总结一下,

你能通过 FQL 获得这些统计数据吗?如果没有,如何通过Graph API获取份额数?

Can you get these stats via FQL? If not, how can you obtain the share count via the graph API?

推荐答案

POST_ID?fields=likes.summary(true),comments.summary(true),shares

结果:

{
  "shares": {
    "count": 272            //share count
  }, 
  "likes": {
    "data": [

    ], 
    "paging": {

    }, 
    "summary": {
      "total_count": 3453   //like count
    }
  }, 
  "comments": {
    "data": [

    ], 
    "paging": {

    }, 
    "summary": {
      "total_count": 255    //comment count
    }
  }
}

这篇关于Facebook API:获得页面/群组帖子点赞、分享、评论数的最佳方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)