yogendrayaduvanshi
yogendrayaduvanshi

Reputation: 219

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?

Upvotes: 13

Views: 61852

Answers (4)

Matej J
Matej J

Reputation: 643

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)

Upvotes: 21

whizzzkid
whizzzkid

Reputation: 1295

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.

Upvotes: 0

hansmosh
hansmosh

Reputation: 511

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.

Upvotes: 9

krisrak
krisrak

Reputation: 12952

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

Upvotes: 1

Related Questions