脸书照片点赞数

Facebook photo likes count

我正在尝试通过照片 ID 获取 facebook 共享图片的点赞数。我将此 url 粘贴到我的浏览器,我获得了正确的 json 结果:

https://graph.facebook.com/10151255420886749/likes?summary=1

无论如何,这个 url 并不总是有效,如果我尝试用我在个人资料中分享的照片更改照片 ID,它 returns:

{
 "error": {
  "message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
  "type": "GraphMethodException",
  "code": 100
 }
}

为什么会出现这种行为?这是因为第一个是页面,第二个是用户配置文件?第二次也许我被迫登录到 facebook 并获得令牌?

如果照片在页面上,您至少需要添加一个 App Access Token 才能消除错误消息。如果这是用户照片,您需要具有 user_photos 权限的用户访问令牌。

  • To read a photo on a Page, use any valid access token
  • To read a photo for a User, you may read any photo with public privacy settings as long as the app accessing the photo has been granted the user_photos permission and you are using a valid access token