簡體   English   中英

Instagram API獲取帶有地理標記的照片的位置數據

[英]Instagram API get location data on geotagged photo

是否可以使用pythonInstagram 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM