Member-only story
Scraping Instagram Follower Information with Python
Disclaimer: This tutorial is only for demonstration purposes and does not encourage TOS violations through web scraping.
Recently I tried scraping Instagram follower information from public profiles for a personal project of mine. The project didn’t really amount for much but I did get a nice Python script out of it. Here are the implementation details.
Instagram Private API
The implementation relies on a pretty comprehensive Instagram library written in Python called Instagram Private API . In the words of the library’s author,
The library was written to access Instagram’s API when they clamped down on developer access. The goal of the project is to achieve parity with the official public API.
Feel free to check out the documentation, which in my opinion is quite well done and covers a lot of very useful functionality. Right now our focus will be on a small subset of functions that let us to interact with the Instagram API.
Initial Setup
Create a directory for your project and create ascrape.py
file. Next, clone this fork of the Instagram Private API into the root of your project folder. The fork has a fix for an authentication bug in the original repository.