Facebook图形API,访问照片和帖子中的位置标签

时间:2011-11-19 20:25:11

标签: facebook-graph-api geolocation location

在照片和帖子上,我经常看到指向代表某个地方的Facebook页面的位置标签。它们通常以“near”,“at”或“in”为前缀。有没有人知道通过图形API或任何其他方式访问这些数据的方法?

这是一个例子: 网页,我公开了这张照片,所以每个人都可以看到http://www.facebook.com/photo.php?pid=11671735&id=506482094 api call https://graph.facebook.com/10150601497547095?access_token= *

{
   "id": "10150601497547095",
   "from": {
      "name": "Edouard Tabet",
      "id": "506482094"
   },
   "name": "Alcohol grows on trees in Isabela, Galapagos",
   "picture": "http://photos-a.ak.fbcdn.net/hphotos-ak-snc7/381095_10150601497547095_506482094_11671735_110244218_s.jpg",
   "source": "http://a1.sphotos.ak.fbcdn.net/hphotos-ak-snc7/s720x720/381095_10150601497547095_506482094_11671735_110244218_n.jpg",
   "height": 720,
   "width": 479,
   "images": [
      {
         "height": 2048,
         "width": 1365,
         "source": "http://a1.sphotos.ak.fbcdn.net/hphotos-ak-snc7/329294_10150601497547095_506482094_11671735_110244218_o.jpg"
      },
      {
         "height": 720,
         "width": 479,
         "source": "http://a1.sphotos.ak.fbcdn.net/hphotos-ak-snc7/s720x720/381095_10150601497547095_506482094_11671735_110244218_n.jpg"
      },
      {
         "height": 270,
         "width": 180,
         "source": "http://photos-a.ak.fbcdn.net/hphotos-ak-snc7/381095_10150601497547095_506482094_11671735_110244218_a.jpg"
      },
      {
         "height": 130,
         "width": 86,
         "source": "http://photos-a.ak.fbcdn.net/hphotos-ak-snc7/381095_10150601497547095_506482094_11671735_110244218_s.jpg"
      },
      {
         "height": 112,
         "width": 75,
         "source": "http://photos-a.ak.fbcdn.net/hphotos-ak-snc7/381095_10150601497547095_506482094_11671735_110244218_t.jpg"
      }
   ],
   "link": "http://www.facebook.com/photo.php?pid=11671735&id=506482094",
   "icon": "http://static.ak.fbcdn.net/rsrc.php/v1/yz/r/StEh3RhPvjk.gif",
   "created_time": "2012-01-16T23:34:54+0000",
   "position": 1,
   "updated_time": "2012-01-21T02:16:55+0000",
   "comments": {
      "data": [
         {
            "id": "10150601497547095_7207114",
            "from": {
               "name": "Tom LeNoble",
               "id": "218686"
            },
            "message": "hope you are having fun!",
            "can_remove": true,
            "created_time": "2012-01-16T23:36:33+0000"
         },
         {
            "id": "10150601497547095_7207963",
            "from": {
               "name": "Sol McKinney",
               "id": "1021642751"
            },
            "message": "How come Darwin didn't write about that?!",
            "can_remove": true,
            "created_time": "2012-01-17T01:31:39+0000"
         },
         {
            "id": "10150601497547095_7212820",
            "from": {
               "name": "Romain BL",
               "id": "556337447"
            },
            "message": "Des bisous mr Tabet! J'esp\u00e8re que tu vas bien depuis tout ce temps!",
            "can_remove": true,
            "created_time": "2012-01-17T18:19:13+0000"
         }
      ],
      "paging": {
         "next": "https://graph.facebook.com/10150601497547095/comments?access_token="
      }
   },
   "likes": {
      "data": [
         {
            "id": "1404245",
            "name": "Hannah Russin"
         },
         {
            "id": "1278210658",
            "name": "Seth Long"
         },
         {
            "id": "218686",
            "name": "Tom LeNoble"
         }
      ],
      "paging": {
         "next": "https://graph.facebook.com/10150601497547095/likes?access_token=&limit=25&offset=25&__after_id=218686"
      }
   }
}

1 个答案:

答案 0 :(得分:3)

我想通了......当使用“照片ID”访问照片时,结果中没有地点属性...当通过“帖子ID”访问同一张照片时,地方属性会出现在GRAPH API调用的JSON结果。不太方便......