Facebook评论与图像

时间:2015-02-22 20:31:30

标签: facebook facebook-graph-api

有没有办法推断Facebook上的评论是否附有照片/图片(使用图API)?例如,具有此ID的评论:

10153245215739574_10153245218744574

有一张照片,但在查询此对象时,如果评论附有照片,则没有任何字段可以放弃:

{ "id": "10153245215739574_10153245218744574", "from": { "id": "1377902372514543", "name": "Alecsander Ferreira" }, "message": "QUEEN <3", "can_remove": false, "created_time": "2015-02-22T05:21:16+0000", "like_count": 2037, "user_likes": false }

1 个答案:

答案 0 :(得分:1)

在没有明确说明字段的情况下查询对象只会提供默认字段。您需要申请所需的字段。

例如

10153245215739574_10153245218744574?fields=attachment

{
  "attachment": {
    "type": "photo", 
    "title": "", 
    "target": {
      "id": "1407980226173424", 
      "url": "https://www.facebook.com/photo.php?fbid=1407980226173424&set=p.1407980226173424&type=1"
    }, 
    "url": "https://www.facebook.com/photo.php?fbid=1407980226173424&set=p.1407980226173424&type=1", 
    "media": {
      "image": {
        "height": 720, 
        "src": "https://scontent.xx.fbcdn.net/hphotos-xpf1/v/t1.0-9/s720x720/11021095_1407980226173424_823555107490491827_n.jpg?oh=96e50bb93269d6e69067a8b3ebf98292&oe=558E78CF", 
        "width": 531
      }
    }
  }, 
  "id": "10153245215739574_10153245218744574"
}