Instagram Graph API, get followers of followers

Instagram API was deprecated as April 4th 2018 (You can read all of the change log here https://www.instagram.com/developer/changelog/) and this is all because privacy issues landed on Instagram as so many developers misused the API to retrieve user data massively using user's private key.

Now, you can still use Instagram API but only limited to your own user (since Instagram only leave this endpoint available for you). If you want to get other user's data (for example Justin Bieber's follower, following, post count, etc.) you can use Instagram Private APIs made by developers by reverse engineering the Instagram app. If you choose to use Instagram private API, you need to be careful, because you will have bigger limitation of maximum request in some period of time (from my experience, about 100 request of pulling user data per-5 minutes or so).

You need to note that Facebook don't want you to you access other people's data by deprecating most of it's API endpoints.

Facebook currently is developing new Instagram API for awhile called Graph API. But if you don't have any products in a production state, your application might be rejected (read here at When To Submit section https://developers.facebook.com/docs/apps/review/). By using this API, you can get all of your demographics data (limited to your own user) by connecting your Instagram and Facebook account.

This is a reference to a good Instagram Private API I ever use:

  1. PHP (https://github.com/mgp25/Instagram-API) Taken down, explanation below.
  2. Python (https://github.com/LevPasha/Instagram-API-python) Also taken down.

If you just need basic data like:

  1. Simulating Instagram search bar
  2. Basic data such as name, Instagram handle, follower count

there is API endpoint for public use by Instagram. You can use this link format:

https://www.instagram.com/web/search/topsearch/?context=blended&query=put_instagram_username_here.

After gathering the desired data (e.g. follower_count) you can start processing the data and store it. I get the endpoint by debugging at network calls from the Instagram web.


***UPDATE (19th February 2020):***

PHP repository made by mg25 has been taken down by Facebook Inc. (github DMCA article here) because of data violation and prohibited usage behavior of Instagram API.


UPDATE (22nd March 2020):

Here is clone of Instagram-API by mgp25 uploaded to Launchpad (launchpad.net/instagram-api). Thank you Eugene for this info!

Disclaimer: Use the library on your own risk! Since the library is no longer maintained, some API might be deprecated. The usage might be dangerous and may result in permanent ban.


UPDATE (17th April 2021):

Just found new way to extract data from fb's graphql through web browser: https://www.instagram.com/{your_ig_username_here}/?__a=1

Example:

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