首页 > 解决方案 > 如何从我的网络应用程序共享的 facebook graph api 中获取喜欢计数?

问题描述

我能够获得分享数和评论数,但无法获得喜欢数。 https://graph.facebook.com/?ids=MY_URL这个 API 给出的响应是,

{
  "MY_URL": {
     "share": {
        "comment_count": 0,
        "share_count": 13,
     },
     "id": "MY_URL",
  }
}

同样,我只需要从 API 中获取点赞数/反应数。请帮忙。提前致谢

标签: facebookfacebook-graph-apifacebook-php-sdk

解决方案


查看该engagement字段 - https://developers.facebook.com/docs/graph-api/reference/v3.2/url

它返回四个不同的计数器——comment_count、comment_plugin_count、reaction_count 和 share_count。

反应计数将是所有反应的数量(例如,爱、悲伤……)——在这方面,您可以从外部 Open Graph 对象中获得尽可能多的“细节”。

Graph API Explorer 中的示例,对象http://example.com/

https://developers.facebook.com/tools/explorer?method=GET&path=%3Fids%3Dhttp%253A%252F%252Fexample.com%252F%26fields%3Dengagement&version=v3.2


推荐阅读