Facebook graph api comment count

后端 未结 9 797

seems Facebook changed the result of posts, few weeks ago it was possible to read the comment count from the post directly

https://graph.facebook.com/125909647492772_502

9条回答
  •  梦毁少年i
    2021-02-01 20:23

    Try the following:

    {
        "data": [
            {
                "id": "447235535389660_1226199",
                "from": {
                    "name": "Harjeet Walia",
                    "id": "100004980601083"
                },
                "message": "Price",
                "can_remove": false,
                "created_time": "2013-09-06T10:39:01+0000",
                "like_count": 0,
                "user_likes": false
            },
            {
                "id": "447235535389660_1226152",
                "from": {
                    "name": "Shoba Dhyani Jakhmola",
                    "id": "100000906896060"
                },
                "message": "baap re kitna mehnga !",
                "can_remove": false,
                "created_time": "2013-09-06T10:05:09+0000",
                "like_count": 0,
                "user_likes": false
            }
        ],
        "paging": {
            "cursors": {
                "after": "MQ==",
                "before": "NA=="
            }
        }
    }
    

    then

    int commentCount = .path("comments").path("data").size();
    

    Here commentCount will give the number of comments.

提交回复
热议问题