How to get ALL Instagram POSTs by hashtag with the API (not only the posts of my own account)
I am trying to get all the instagram pictures tagged with a precise hashtag but I only receive my own developer account posts tagged with the hashtag.
I am currently working in local development environment, maybe that's the problem?
Furthermore, what is Sandbox mode, and what should I do to go "Real" mode ?
In the platform policy, it's written "You cannot use the API Platform to crawl or store users' media without their express consent." .
Does it mean that what I am trying to do is simply not possible ?
Thanks for your help
The Hashtag Search API consists of the following nodes and edges: GET /ig_hashtag_search — to get a specific hashtag's node ID. GET /{ig-hashtag-id} — to get data about a hashtag. GET /{ig-hashtag-id}/top_media — to get the most popular photos and videos that have a specific hashtag.
Hashtag pages have an Instagram Story icon in the top left corner. Click on it and you'll see a collection of Stories posts tagged with the hashtag from people with public profiles.
Go to instagram.com. Click on the gear icon next to your Edit Profile option and select Privacy and Security. Scroll down to Data Download. Click Request Download.
You can get the posts in raw JSON by simply accessing this URL: https://www.instagram.com/explore/tags/summer/?__a=1
Then just use javascript/jquery to fetch the data an loop through the posts. You get 12 posts, and a variable to see if there are more pages.
Example of getting latest 6 posts:
$.get('https://www.instagram.com/explore/tags/summer/?__a=1', function (data, status) {
for(var i = 0; i < 6; i++) {
var $this = data.graphql.hashtag.edge_hashtag_to_media.edges[i].node;
$('#container').append('<img src="'+ $this.thumbnail_resources[2].src +'">');
}
});
When you register for API client, you will be sandbox mode (development/test mode), in this mode you will get only your and your sandbox user's data in API response.
Once you complete app, you have to submit for review to instagram, if approved then you can set app to Live mode, and then you will see all posts in API response.
P.S. Note that you have have public_content
permission in oauth scope to get all posts
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With