Instagram API receiving unrelated media for specified hashtag - instagram

I'm currently making requests to the Instagram API. Specifically, the endpoint https://api.instagram.com/v1/tags/{tag-name}/media/recent?access_token=ACCESS-TOKEN (specified here).
Using the example tag doggo, I'm receiving mostly responses whose JSON tags contain doggo; however, I also receive media with empty tags entries:
Would anybody happen to know why this sort of situation might occur? The range of untagged media that appears to slip in varies wildly in relevance to the specified tag, so I'm curious if this is a bug or some sort of Instagram algorithm to infer a media item's relevance to the specified tag.
Thanks!

Related

Instagram feeds using tag name of particular user

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.

How to grab instagram users based on a hashtag?

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.

Instagram realtime API does not return content IDs?

Current scenario
I have build an application that harvest Instagram images from a specific hashtag.
I use the pagination to fetch all images, and store the data (not the images) locally in a database. The first invocation of the app harvest all images. Subsequent invocations only harvest those newer than the newest image in the local database. Otherwise I would need to make thousands of request to page through all images on popular tags. And that would need to be done every few minutes, if images where to appear without too much delay in the app.
The problem that arises is that when users put tags on old images, these images are then not fetched by my app - because of the only-fetch-new-images performance construct.
Attempt at solution
I looked at the realtime API, but is seems to me it is constructed in a way that makes it unsuable. This is what it sends in a realtime update for a tag:
{
"subscription_id": "2",
"object": "tag",
"object_id": "nofilter",
"changed_aspect": "media",
"time": 1297286541
}
I would have thought that there would be a list of media IDs, representing the new/changed content, from which I could fetch the actual content - but there is not.
My current solution is to fetch new content every few minutes, and then doing full rescans every hour. This is suboptimal both from a user, and a performance perspective.
Question
Is it really not possible to do in a more elegant way? I appreciate that Instagram does not send the full content in the realtime update, but sending the IDs should not be a problem in terms of payload-size. It seems like the API is pretty useless in this regards - the only use-case I can think of, where it would be of any use, is for a "There is new content on you hashtag watch" nofications.
Best,
Torben
What I do with geography search is that everytime I get a update package I query the recent geography endpoint. This works quite well. Im guessing thats the idea with tag subscription aswell, have you tried querying the recent instagrams tag endpoint?
/tags/[tag-name]/media/recent
Paginate the recent media for a tag with the min_tag_id parameter to sort the result based on when it was tagged and not when the photo was taken. We use this in combination with the realtime api at silarapp.com and it works fine.
From the Instagram Api Documenation (my emphasis):
Get a list of recently tagged media. Note that this media is ordered by when the media was tagged with this tag, rather than the order it was posted. Use the max_tag_id and min_tag_id parameters in the pagination response to paginate through these objects. Can return a mix of image and video types.

foursquare api venue details specialsnearby not being returned

When making a Foursquare venue details API call, the specialsNearby field does not exist in the json response. I have tried hundreds of different venues, and none of them contain this field (they do contain the 'specials' field though).
I'm using v2 of the foursquare API, and giving it a version string of v=20120417.
Any assistance in obtaining the nearby specials would be much appreciated!
It does look like we've stopped sending down the specialsNearby field -- once I can confirm with a few of the other dev's, we'll update the docs accordingly.
Edit: We have indeed deprecated this field in favor of the Explore endpoint below.
But, no need to worry -- there's an easy way to get the same info!
Check out our Explore endpoint -- https://developer.foursquare.com/docs/venues/explore
Pass "intent=specials" to that endpoint, and you'll get all the nearby specials.

How would one utilise Twitter's Streaming API to retrieve Tweets from a specified country?

My goal is to retrieve all Tweets, or as significant a proportion as I can, that originate from certain small countries such as Ireland,New Zealand,Lithuania etc.
Twitter's Search API allows the searching of statuses in a radius around a given lat/long. Twitter decides which results to return by the geotag data included in a user's profile, or by reverse-geocoding the user's Hometown location in their profile.
The public status stream in the Streaming API can be filtered by geobox, but Twitter does not perform reverse-geocoding when returning these results. Research so far has indicated that not very many people at all in these countries use geo-tagging.
Obviously, if I had access to the firehose stream, then using the Streaming API would be the way to go, as I could perform the reverse-geocoding myself. At the default access level, however, the random sample stream does not provide enough relevant users to me.
What, then, if any benefit could I get from using the Streaming API? Should I simply stick to the Search API, as I am unlikely to get any unique data from the Streaming API?
You can pass locations parameter to specify the area of geotagged tweets.
http://dev.twitter.com/pages/streaming_api_methods#locations
With Twitter4J, use FilterQuery#locations().
http://twitter4j.org/en/javadoc/twitter4j/FilterQuery.html#locations(double[][])

Resources