10

Until recently there were several ways to retrieve Instagram user media without the need for API authentication. But apparently, the website stopped all of them.

Some of the old methods:

And some old related questions are:

I was able to retrieve the first twenty items by crawling the webpage of the user, but this is not a good or standard method especially when Instagram is not supporting it officially.

I was wondering If you know any method that currently works?

Moradnejad
  • 3,466
  • 2
  • 30
  • 52
  • 1
    Check out this answer, it does not require any authentication: https://stackoverflow.com/a/49906525/278840. However, for me its not feasible as it requires two separate requests: one to get the "rhx_gis" secret from the page's source code and another one to get the actual JSON data... – Louis B. Apr 19 '18 at 11:07
  • Check my latest working solution here https://stackoverflow.com/a/33783840/819764 I've updated my old method with new CORS proxy by Google. – 350D Feb 03 '19 at 17:44

1 Answers1

11

Unfortunately, Instagram stopped many of its APIs, including the ones that require authentication. It states in https://www.instagram.com/developer/:

To continuously improve Instagram users' privacy and security, we are accelerating the deprecation of Instagram API Platform, making the following changes effective immediately.

Some links explaining the details and causes of these changes:

Some unofficial crawling methods have been proposed in (suggested by @Louis B.) https://stackoverflow.com/a/49906525/278840. You should take into consideration that these methods are being transformed each week. Therefore, I definitely prefer to use the private API.

Update 2018:

The old public API (without auth) is working again. We can access by adding ?__a=1 to the end of a profile url, like this:

https://www.instagram.com/leomessi/?__a=1

Update June 2022

The old API '?__a=1' has stopped working again. It seems to be due to an error. The page redirects to the login page as a guest. If you open it after logging in, it shows a weird error:

for (;;);{"__ar":1,"error":1357004,"errorSummary":"Sorry, something went wrong","errorDescription":"Please try closing and re-opening your browser window.","payload":null,"hsrp":{"hblp":{"consistency":{"rev":1005648797}}},"lid":"7106751273377983967"}

Moradnejad
  • 3,466
  • 2
  • 30
  • 52
  • can you link to Instagram's "private" API? I wasn't aware such a thing existed. – marked-down Apr 28 '18 at 07:52
  • @ReactingToAngularVues Start here: https://www.instagram.com/developer/ example: https://www.instagram.com/developer/endpoints/users/ – Moradnejad Apr 29 '18 at 05:31
  • I don't believe that's a "private API". That's Instagram's now deprecated public API. – marked-down Apr 29 '18 at 06:59
  • 2
    "A private API is an interface that opens parts of an organization’s backend data and application functionality for use by developers working within (or contractors working for) that organization." — again, with more emphasis, what you are linking to is Instagram's _deprecated_, _public_ API. – marked-down Apr 29 '18 at 21:06
  • 1
    The private-ness/public-ness of an “API” is not determined by which data it can access, but by _who_ can access it. It doesn’t matter if the API can perform mass updates on entire user data, if it’s a publicly accessible, documented API, it’s called a “public API”. A private API is an internal or undocumented set of access points designed for the company who developed the API only. – marked-down Nov 22 '18 at 08:40
  • Check my latest working solution here https://stackoverflow.com/a/33783840/819764 I've updated my old method with new CORS proxy by Google. – 350D Feb 03 '19 at 17:44
  • something happen with this method, after 300 requests pear day to that url , instagram block you – Fernando Torres Dec 30 '19 at 19:03
  • Hi, does anyone know how to deal with the issue that the images returned from https://www.instagram.com/leomessi/?__a=1 is not loading due to CORS. – Khushbu Raval May 14 '21 at 11:28
  • @KhushiRaval Did you find any way to deal with CORS issue? – Caeculus Nov 21 '21 at 14:39
  • 1
    @Caeculus - I have replaced mentioned API with Instagram basic display API with authentication to resolve issues and get proper data. Refer - https://developers.facebook.com/docs/instagram-basic-display-api/ – Khushbu Raval Nov 23 '21 at 11:42