如何获得页面帖子的喜欢和评论数量?

时间:2011-12-22 00:34:29

标签: facebook-graph-api facebook-fql facebook-insights

Facebook正在弃用“page_like_adds”和“page_comments_adds”。它们有助于了解在页面内容上发布了多少喜欢和/或评论。

现在,使用新的“page_stories_by_story_type”,您最多可以获得内容生成的“故事”数量(包括赞,评论和分享),但每个都没有数据。

你知道在页面上获取喜欢和评论的其他任何方式吗?

由于

2 个答案:

答案 0 :(得分:0)

好的我可能有这个错误,但我认为你只需要通过图形API在图表中获取对象。

例如

https://graph.facebook.com/cocacola

{
"id": "40796308305",
"name": "Coca-Cola",
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/276879_40796308305_1578420141_s.jpg",
"link": "http://www.facebook.com/coca-cola",
"likes": 36470992,
"category": "Food/beverages",
"website": "http://www.coca-cola.com",
"username": "coca-cola",
"founded": "1886",
"description": "On May 8, 2011, Coca-Cola marks its 125th anniversary. Created in 1886 in Atlanta, Georgia, by Dr. John S. Pemberton, Coca-Cola was first offered as a fountain beverage at Jacob's Pharmacy by mixing Coca-Cola syrup with carbonated water. \n\nCoca-Cola was patented in 1887, registered as a trademark in 1893 and by 1895 it was being sold in every state and territory in the United States. In 1899, The Coca-Cola Company began franchised bottling operations in the United States. \n\nCoca-Cola might owe its origins to the United States, but its popularity has made it truly universal. Today, you can find Coca-Cola in virtually every part of the world.",
"can_post": true,
"checkins": 77,
"talking_about_count": 193996
}

注意“喜欢”,“签到”和“talink_about_count”?页面对象的这些属性不能满足您的需求吗?如果您想要页面上各个帖子的“赞”和其他属性,您可以选择使用FQL或转到“帖子”连接并查看每个帖子的喜欢/评论。然而,后者可能需要很长时间才能完成,但我不知道项目的更广泛范围或目标,所以这一切都非常普遍。

答案 1 :(得分:0)

#this might help you

import facebook
token='add token here'
graph = facebook.GraphAPI(token)
#to get the page data
page = graph.get_object('6127898346')
#to get the post of the page add the post id 
page_post=graph.get_object('10155272237029571')
print(page_post)