![](/img/trans.png)
[英]How to get the location geotag from an Instagram post using the API
[英]Instagram API get location data on geotagged photo
是否可以使用python
和Instagram API
檢索有關在Instagram
標記照片的商家或場所的位置數據?
我一直在為自己的帳戶使用access token
並安裝了Python Instagram
。
您應該使用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))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.