简体   繁体   English

Instagram API获取带有地理标记的照片的位置数据

[英]Instagram API get location data on geotagged photo

Is it possible to retrieve location data about a business or a venue a photo was tagged at on Instagram using python and the Instagram API ? 是否可以使用pythonInstagram API检索有关在Instagram标记照片的商家或场所的位置数据?

I have been using access token for my own account and have Python Instagram installed. 我一直在为自己的帐户使用access token并安装了Python Instagram

You should query the image using the get_media request to get its location details. 您应该使用get_media请求查询图像以获取其位置详细信息。

If the image was geo-tagged, the response will include the location details like this: 如果图像是地理标记的,则响应将包含位置详细信息,如下所示:

"location":  {
    "latitude": 40.417044464,
    "name": "Puerta del Sol Madrid",
    "longitude": -3.703540741,
    "id": 3002373
}

To get this data with python use the Python-Instagram package and call api.media : 要使用python获取此数据,请使用Python-Instagram软件包并调用api.media

import instagram

# Fill in access token here and image id
access_token = ''
media_id = ''
api = instagram.client.InstagramAPI(access_token=access_token)
res = api.media(media_id)
print res.location

# You should get a Location object with a latitude and a longitude point
>> Location: 3002373 (Point: (40.417044464, -3.703540741))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM