It was my goal - to look for Instagram materials for the keyword (the Eiffel Tower example) and return results in lat, long form.
After research, it seems that there are two ways to do this: using media search, but you must specify a location, and you are tied to the radius of the search. I would like to return the lat, for a long time not limited to the place, but rather, wherever they occur. Or you can search by tags, which I'm not sure is the same as searching for a caption.
Tags in the application are designed to tag people. Assuming that a search by tag will actually return results based on a search term not tagged by people. I get an error in my script when trying to return lat / longs.
where = raw_input('Where would you like a map of?')
what = raw_input('What would you like to search Instagram for?')
search= api.tag_recent_media(tag_name=what)
map1 = folium.Map(location=geo(where), tiles='Stamen Toner', zoom_start=6)
if ['location'] is not None:
for media in search:
lat_in=(media.location.point.latitude)
long_in=(media.location.point.longitude)
print lat_in +", " + long_in
folium.Marker([lat_in, long_in], popup=content, icon=folium.Icon(icon='info-sign')).add_to(map1)
map1.save('map_instagram.html')
Traceback (most recent call last):
File "C:/Users/dana/Desktop/free_instagram.py", line 16, in <module>
lat_in=(media.location.point.latitude)
AttributeError: 'list' object has no attribute 'location'
This combination works very well using media search, but not using a tag name/media/recent. Is there a better call I could possibly make in Media ID?
source
share