'How to get all public posts using Instagram API?

I'm trying to get all public posts using Instagram API.
There are some existing apps like Geofeedia, COEverywhere and TrackinU which can get public posts of social networking sites.

Is there any way to get public posts just like in Twitter Stream API?



Solution 1:[1]

You can easily get all posts in json by appending ?__a=1 to url.

For example for hashtags: https://www.instagram.com/explore/tags/italy/?__a=1

Edit: This also applies for everything else (users, posts)

Solution 2:[2]

Instagram has removed the ability to get all public posts with a given hashtag. The api you would have used is deprecated: https://www.instagram.com/developer/deprecated/endpoints/tags/

I was sad to learn this today, as I have been doing this for years but just made a new dev account, only to find that it can not access the deprecated endpoints.

Solution 3:[3]

There is no API to get all the Instagram photos as they are posted. These are the options you can get using API:

  • photo feed by a hashtag
  • photo feed by geolocation
  • photo feed by one user

Solution 4:[4]

I wrote a proxy API for this exact purpose: https://github.com/whizzzkid/instagram-proxy-api

Let's take an example of #nyc: Instagram's tag explorer: https://www.instagram.com/explore/tags/nyc

Getting the same results as JSON: https://igpi.ga/explore/tags/nyc/media

You can find more examples in the repo. Here is the code that does all this: https://github.com/whizzzkid/instagram-reverse-proxy/blob/master/app.js

A demo application using jquery will be:

$.ajax({
  url: "https://igpi.ga/explore/tags/yyc/media",
  dataType: "jsonp",
  data: { count: 3 },
  success: function (json){
    for(var i in json.posts) {
      var img = document.createElement("IMG");
      img.src = json.posts[i].display_url;
      document.body.appendChild(img);
    }
  }
});

Demo: http://plnkr.co/edit/4oCwpbMm6p9cyJb1UWld?p=preview

hope this helps.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 hansmosh
Solution 3 krisrak
Solution 4