是否可以使用Instagram
和python
在Instagram API
上检索照片被标记的商家或地点的位置数据?
我一直在为自己的帐户使用access token
并安装了Python Instagram
。
答案 0 :(得分:0)
您应该使用get_media
请求查询图片以获取其位置详细信息。
如果图片是地理标记的,则响应将包含位置详细信息,如下所示:
"location": {
"latitude": 40.417044464,
"name": "Puerta del Sol Madrid",
"longitude": -3.703540741,
"id": 3002373
}
要使用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))