I'm starting with Instagram API and I notice that there is no way to search media for a certain area. API only lets me to search through lat/long. Is there anyway to get media from an area? For example Flickr's API lets to ask for regions/counties...
In other case, any idea to do this in a simple way?
Thanks in advance,
Regards
You have two ways of doing this with the Instagram api:
Use the get media/search endpoint to find media for an area defined by lat/lng and a radius. You can specify a radius up to 5000 meters to capture media for a large area.
api.instagram.com/v1/media/search?lat=48.858844&lng=2.294351&distance=5000
Use the /locations/location-id/media/recent endpoint to find media assigned to locations. Some cities, towns, regions, etc are set up as locations. These aren't very reliable and there are often duplicates. You would need to use the /locations/search endpoint to find the location id's first.
api.instagram.com/v1/locations/514276/media/recent
Related
Using the Instagram API, would it be possible to write software that does a search of all public Instagram posts for a specific radius around a latitude/longitude location for a specific time/date period?
I understand that the API currently allows one to do a request for "recent" posts, but I am more interested in finding all historical posts between a given set of dates.
Many thanks.
I am trying to fetch the instagram feeds to my site using tag name.
https://api.instagram.com/v1/tags/{tag-name}?access_token=ACCESS-TOKEN
above is the api which I am using to get the feeds.
Now the feeds are displaying from all the users who use the tag. I need to restrict the feeds for the particular user who use the tag name.
Anyone come across this?
Thanks,
The current version of the Instagram Api does not have an endpoint that will allow you to get media by tag-name AND user-id. Your best bet is to use 1 of the following endpoints, and then loop through the results and filter out the media that matches the 2nd condition.
Search for posts by given hashtag's name using GET /tags/{tag-name}/media/recent API endpoint request and then filter the response list of media to match the user-id for the particular user in question.
or
Search for posts by the particular user using GET /users/{user-id}/media/recent API endpoint request and then manually check every post if its tags array contains the specific hashtag you are looking for.
I recommend you go with option 2 as that will be faster, since an individual user feed is a much smaller data set than media from 1000s of Instagram users tagged with a hashtag.
I've searched through the topics but it seems that exactly this questions hadn't been asked yet.
Could anyone, please, share their opinion on how to retrieve an Instagram account followers' posts locations in order to map them after that on one map?
On the account there are around 2000-2100 followers.
Thank you in advance!
To get detailed user information from instagram you have to use the GET /users/user-id endpoint.
So to get the location information for all an accounts followers you have to use
GET/users/user-id/followed-by and iterate through the results.
Be careful. Instagram api limit is currently 5000 requests per hour. Accounts with more followers than that you will have to use some form of queue
Edit: just seen you want the post locations:
Similar method, excite instead of GET /users/user-id user GET /users/user-id/recent and grab the locations of the media. Note in my experience the location function is used very little by instagram users. I once pulled 3000 media that had only 20 media with a location
You cannot just location of a user using APIs, there are couple ways you can guess the location, by looking for bio information and check if they have any location specified or you can check location of all the photos posted by a user and kind of guess the location by analyzing where most of the photos are being posted at.
you can use the API /users/user-id/recent to get all the photos from a user and look for location property in API response and map it on google map.
you can use http://gramfeed.com to see user photos with a map of photo locations, you will have to do this for each user and determine the location.
is there a way to grab instagram users based on a specific hashtag ?
I run contests based on re posting photos with specified hashtag then randomly pick a winner, i need a tool that can grab the usernames of those who reposted that photo and used that hashtag.
You can query instagram using the API. There are official clients for both python and ruby.
You didn't specify what language/platform you are using, so I'll give you the generic approach.
Query instagram using the Tag Recent Media endpoint.
In the response, you will receive a user object that has the user's username, id, profile url, and so on. This should be enough to do what you are describing.
As far as tools, there aren't great options to probably do things exactly how you want. If you just want a simple contest, you could use statigram, but it's not free.
If you roll your own solution, I highly recommend you also do the following:
Implement a rate limiting mechanism such as a task queue so you don't exceed your API calls (5000 per hour for most calls). Also useful for failures/network hicups, etc.
Have users authenticate so you can use OAuth to extend your API calls to 5000/per user/hour to get around #1.
Try the subscribe API if there won't be many items. You can subscribe to a specific tag as well, and you will get a change notification. At that point though you need to retrieve the actual media item(s), and this can cost a lot of API calls depending on how frequent and what volume these changes occur.
If your users don't have much photos/relatively small/known in advance, you can actually query the user's recent media instead and filter in your own code by hash tag.
Im new to foursquare api. I would like to know whether foursquare api will return the latitude and longitude of the user location(when GPS enabled), or should we use another method to get current user location.
Thanks in advance
You should get current user location reading GPS data from user device and use it when requesting Foursquare API endpoints. For an example, see https://developer.foursquare.com/docs/venues/search
As far as I know, a server API (such as Foursquare) has no means to get your current location except for Geo-IP services (not always accurate).
I have found that when using venue/search, etc. to find information, the response back to the api web call is filled with all sorts of information, including a "field" called location, that on android systems had to cast to JSONobject then you can get the lat and long of that place and distance from you if used with radius. Like above, use your gps and the development language to get that information.