How to count likes on FB page?

前端 未结 6 1553
执念已碎
执念已碎 2021-01-15 01:05

I have to do a very simple operation but my programming skills are not enough. I have to count likes in Facebook page and print that number on my web-site. I have two script

6条回答
  •  無奈伤痛
    2021-01-15 01:37

    I was having same problem, just adding likes.summary(true),comments.summary(true) in parameter in against "fields" worked for me.

    e.g. I used https://graph.facebook.com/me/feed?access_token=ACCESS_TOKEN&fields=story,from,story_tags,likes.summary(true),comments.summary(true)

    instead of https://graph.facebook.com/me/feed?access_token=ACCESS_TOKEN

    Also you can add other parameters if you want; separated by a ,

    Also if you want count of single post you can use

    https://graph.facebook.com/POST_ID/likes?summary=true&access_token=ACCESS_TOKEN
    

    for likes count

    Or

        https://graph.facebook.com/POST_ID/comments?summary=true&access_token=ACCESS_TOKEN
    

    for comment count

提交回复
热议问题