Extract lat/lng from an Instagram photo via API

允我心安 提交于 2021-02-15 06:51:05

问题


By default, Instagram saves geo tags for all submitted photos. You can then search by location using /media/search. However, when I try to extract the geo tags from a specific pic using /media/media-id, I always get "location": null in the json response and no lat/lng pairs.

Is this functionality simply blocked by Instagram? Is there another way to do it?


回答1:


The get /media/{media-id} endpoint does return location information if it is available. Users can chose not to make it available, so not every image will have it.

This example will return an image with location information. You'll need to supply your own access token:

https://api.instagram.com/v1/media/432039264888987277_4513750

The response looks something like this:

 {
  "meta":  {
    "code": 200
  },
  "data":  {
    "attribution": null,
    "tags":  [],
    "type": "image",
    "location":  {
      "latitude": 48.8635,
      "longitude": 2.301333333
    },
    "comments":  {
      "count": 0,
      "data":  []
    },
    ..........


来源:https://stackoverflow.com/questions/15945752/extract-lat-lng-from-an-instagram-photo-via-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!