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
?
I have been using access token
for my own account and have Python Instagram
installed.
You should query the image using the get_media
request to get its location details.
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
:
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))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.