12

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?

Forge
  • 6,538
  • 6
  • 44
  • 64
yogendrayaduvanshi
  • 209
  • 1
  • 2
  • 14
  • Check this out:
    https://stackoverflow.com/questions/17373886/how-can-i-get-a-users-media-from-instagram-without-authenticating-as-a-user/53423221#53423221
    – Ruan Barroso Nov 22 '18 at 02:59

4 Answers4

22

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)

Matej J
  • 615
  • 1
  • 9
  • 33
9

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.

hansmosh
  • 491
  • 5
  • 13
  • I was wondering then how does these guys do it? https://smashballoon.com/instagram-feed/demo/ – Raja Jan 11 '17 at 00:40
  • @Raja, upon looking at this again, it does look like you can get posts by tag, but only approved apps have access to all public posts. Otherwise, you only have access to up to 10 approved sandbox users. https://www.instagram.com/developer/review/ – hansmosh Jan 11 '17 at 01:13
  • I have a doubt. I have access to only sandbox users's post (After they login and agree) when I am in sandbox mode. Once Instagram reviews and approves my application can I just get access to public data without anybody having to login and approve? Or users of my application still have to login to instagram and allow access to my applicaiton? – Raja Jan 12 '17 at 21:50
  • @Raja, I don't work at Instagram so I don't know for sure, but that's what it sounds like to me. The docs talk about it here https://www.instagram.com/developer/sandbox/. If all you want to do is search public tags, then you would be good after approval. For some other api endpoints, you would need to get the public_content permission scope from the user. For example, get recent posts for that user, get user info, comment/like on behalf of the user, etc... – hansmosh Jan 12 '17 at 22:04
0

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
krisrak
  • 12,882
  • 3
  • 32
  • 46
0

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.

whizzzkid
  • 1,174
  • 12
  • 30