问题
So I can get how many posts have "SOMETAG":
https://api.instagram.com/v1/tags/SOMETAG
I can get images by tag:
https://api.instagram.com/v1/tags/SOMETAG/media/recent
But it returns only my user photos.
How I can get All photos from all users with some tag (not one request)?
回答1:
Your client is in Sandbox Mode and can only search for tags of photos posted by invited users. You have to login into https://www.instagram.com/developer, edit your client and click on the "GO LIVE" button.
If the "GO LIVE" button is disabled, you have get your app reviewed by Instagram first: Click on the Permissions tab and submit for review. (Company Name, Contact Email and Privacy Policy URL are required to start a submission.) Once approved, u will be able to click Go Live.
回答2:
I think you are in Sandbox mode, so it will return only media from your sandbox authorized user, here is information about this:
As another example, let's consider an endpoint that returns a list of media: /tags/{tag-name}/media/recent. The response returned by this endpoint will contain only media with the given tag, as expected. But instead of returning media from any public Instagram user, it will return only media that belongs to your sandbox users, restricted to the last 20 for each user.
Here is the link to more details about Sandbox mode: https://www.instagram.com/developer/sandbox/
回答3:
Sandbox Mode will affect the number of pull requests/hour, but it shouldn't be causing you to be unable to pull the data from within the tag set.
In my Instagram Hashtag App - (not sandboxed) I was able to achieve this by using the Recent Tags GET request that you mentioned in your question. The key is pagination
in the returned 'responseDict'.
When your request returns with the results of your first pull, it will include the key and another dictionary that contains the next URL (you want this) to continue pulling data at the correct time/tagID.
This should do the trick:
~
NSString *nextSetURL = [responseDict valueForKeyPath:@"pagination.next_url"];
~
What's important to understand is that a large number of posts WILL return, if you run this in a loop and have it waiting for the nextSetURL
to return empty.
Instagram's /tags/<tag>/media/recent
is set to return 20 results at default (there are ways to change the count).
It's important to consider 2 more things
- Rate Limit
- Requests Left
Good luck and I am looking forward to see what you're building using recent Instagram Hashtags!
来源:https://stackoverflow.com/questions/34265229/instagram-how-to-get-all-photos-by-tag