我通过API获取Facebook新闻源。用户可以对网站上的帖子发表评论。但有些帖子不允许评论如 Like Stories,添加好友故事,更改个人资料图片等
如果帖子允许评论,我如何检查
答案 0 :(得分:3)
从API检索帖子时,actions
属性将显示当前(您正在使用其access_token)用户是否可以喜欢或评论帖子,例如
/20531316728_167191526758558
包含:
{
"id": "20531316728_167191526758558",
"from": {
"name": "Facebook",
"category": "Product/service",
"id": "20531316728"
},
"message": "Find your polling place on Facebook at http://bit.ly/Fbppl and then watch the nation vote in real time.",
"picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQCD6BNbTzxhmwEq&w=90&h=90&url=https%3A%2F%2Fs3.amazonaws.com%2FFacebookHackers-production%2Fissue4_data%2Fissue4_fb_og.png",
"link": "http://www.facebookstories.com/vote",
"name": "America Votes 2012",
"caption": "www.facebookstories.com",
"description": "Watch the nation vote in real time.",
"icon": "https://s-static.ak.facebook.com/rsrc.php/v2/yN/x/aS8ecmYRys0.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/20531316728/posts/167191526758558"
},
{
"name": "Like",
"link": "https://www.facebook.com/20531316728/posts/167191526758558"
}
],
// (and more properties which aren't relevant