I am developing an application for a client which uses the Instagram graph to search for a specific hashtag. For this I use the following JavaScript:
let rawData, resuData;
$.ajax({
url: 'https://www.instagram.com/explore/tags/dogs/?__a=1',
type: "GET",
dataType: "json",
success: function(data) {
//console.log(data);
},
complete: function(data_response) {
rawData = (data_response.responseText);
resuData = JSON.parse(rawData);
console.log(resuData);
},
error: function (error) {
console.log("Error!");
}
});
This gives me a JSON with the data I want.
The problem comes when I want to obtain the data from the "elbaresotracosa" hashtag (https://www.instagram.com/explore/tags/elbaresotracosa/?__a=1) which shows me the message error 404 as shown in the following image.
error 404 instagram graph
But when I enter that URL from the browser itself, it shows me the JSON that I'm looking for.
instagram graph JSON
In the developer tools, from the Network tab, it says that the content-type is "application/json"
content-type: application/json
Do any of you have any idea how I can solve this problem?
I have a scraper using the same endpoint and it stopped working yesterday.
I guess Instagram just blocked access to the tags explorer for unauthenticated requests.
If you're logged in you can see the hashtags, but open the same link in an incognito window and you won't (for some reason it still works for some hashtags like the #dogs one)
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