获取Facebook分享/喜欢/评论的URL数量 [英] Get Facebook share/like/comment count of URL

查看:117
本文介绍了获取Facebook分享/喜欢/评论的URL数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在今天之前,我使用以下网址获取网址的Facebook分享/评论/评论数:

  https://api.facebook.com/method/links.getStats?format=json&urls=http://stackoverflow.com/ 

今天,Facebook删除了这个功能。所以现在我使用这个:

  https://graph.facebook.com/v2.7?emc=rss& fields = og_object {engagement},share& access_token =< ACCESS_TOKEN_GOES_HERE>& id = http://stackoverflow.com/ 

哪些输出:

  {
og_object:{
:{
count:45267,
social_sentence:45K这样的人。
},
id:10150180465825637
},
share:{
comment_count:12,
share_count 45267
},
id:http://stackoverflow.com/
}

问题是, share_count 是喜欢+评论+共享(据我所知)的总和。



有没有办法分别获得喜欢,评论和分享的数量

解决方案

在fb-api中看起来像一个错误



我的解决方案: p>


  1. 收到您在问题中描述的股份/评论数量



    < blockquote>

    graph.facebook.com/?fields=og_object {id},share& id = https://stackoverflow.com/



  2. 保存共享/评论计数


  3. save fb object-id of url


    og_object-> id


    li>

  4. 获得喜欢的数量(最大限制为1000,那么您可以使用分页):


    UPD 2016-08-22



    我发现一个解决方案可以让您一步获得喜欢/转贴/评论的数量:


    https://graph.facebook.com/?fields=og_object {likes.limit(0).summary( true)},share& ids = http://google.com,http:// twitter。 com



    Prior to today, I used the following URL to get the Facebook share/like/comment count of a URL:

    https://api.facebook.com/method/links.getStats?format=json&urls=http://stackoverflow.com/
    

    Today, Facebook removed this feature. So now I'm using this:

    https://graph.facebook.com/v2.7?emc=rss&fields=og_object{engagement},share&access_token=<ACCESS_TOKEN_GOES_HERE>&id=http://stackoverflow.com/
    

    Which outputs:

    {
        "og_object": {
            "engagement": {
                "count": 45267,
                "social_sentence": "45K people like this."
            },
            "id": "10150180465825637"
        },
        "share": {
            "comment_count": 12,
            "share_count": 45267
        },
        "id": "http://stackoverflow.com/"
    }
    

    The problem is, share_count is the total of likes + comments + shares (as far as I know).

    Is there a way to get the number of likes, comments, and shares separately?

    解决方案

    Looks like a bug in fb-api.

    My solution:

    1. receive the number of shares/comments as you describe in your question with

      graph.facebook.com/?fields=og_object{id},share&id=https://stackoverflow.com/

    2. save shares/comments count

    3. save fb object-id of url

      og_object->id

    4. get likes count with (max limit is 1000, then you can use paging):

      graph.facebook.com/OBJECT_ID/likes?access_token=ACCESS_TOKEN&pretty=1&limit=1000

    UPD 2016-08-22

    I found a solution that allows you to get the number of likes/reposts/comments in one step:

    https://graph.facebook.com/?fields=og_object{likes.limit(0).summary(true)},share&ids=http://google.com,http://twitter.com

    这篇关于获取Facebook分享/喜欢/评论的URL数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆