This script allows you to scrape Instagram posts from a specified account and generate statistics about the likes each post has received. It provides insights into your top likers and overall engagement on your posts.
- annotated-types
- certifi
- charset-normalizer
- idna
- instagrapi
- instaloader
- pillow
- pycryptodomex
- pydantic
- pydantic_core
- PySocks
- requests
- tqdm
- typing_extensions
- urllib3
- fpdf
Using this script excessively might lead to your Instagram account being banned. Use it responsibly and at your own risk.
Instagram recently changes their API, resulting in the following error being displayed durring runtime:
ERROR:public_request:Status 201: JSONDecodeError in public_request (url=https://www.instagram.com/username/?__a=1&__d=dis) >>>
β 2024-03-14 16:29:46,618 - ERROR - Status 201: JSONDecodeError in public_request (url=https://www.instagram.com/username/?__a=1&__d=dis) >>>
ERROR:public_request:Status 201: JSONDecodeError in public_request (url=https://www.instagram.com/username/?__a=1&__d=dis) >>>
β 2024-03-14 16:29:49,701 - ERROR - Status 201: JSONDecodeError in public_request (url=https://www.instagram.com/username/?__a=1&__d=dis) >>>
ERROR:public_request:Status 201: JSONDecodeError in public_request (url=https://www.instagram.com/username/?__a=1&__d=dis) >>>
β 2024-03-14 16:29:52,794 - ERROR - Status 201: JSONDecodeError in public_request (url=https://www.instagram.com/username/?__a=1&__d=dis) >>>
The script will continue running regardless. Someone smarter than me has to fix this one though because it's way above my paygrade. If you know how to resolve it, please create a pull request.
- Clone the repository:
git clone https://github.com/jordanlambrecht/instagram-post-likes-scraper.git
- Navigate to the project directory:
cd instagram-post-likes-scraper
- Create a virtual environment:
python3 -m venv venv
- Activate the virtual environment:
- On macOS/Linux:
source myenv/bin/activate
- On Windows:
.\venv\Scripts\activate
- On macOS/Linux:
- Install the requirements:
pip install -r requirements.txt
Run the script:
python main.py
Follow the prompts to enter your Instagram credentials and the account you wish to scrape.
You can configure the script's behavior through the config.json
file, where you can set your Instagram credentials and enable or disable PDF generation.
The script generates an output
directory containing:
- A
Posts
directory with text files for each post. - A
Statistics
directory with CSV and optional PDF files containing likes statistics.
-
Clone the repository:
bashCopy code
git clone https://github.com/yourusername/instagram-post-likes-scraper.git cd instagram-post-likes-scraper
-
Create a virtual environment:
bashCopy code
python3 -m venv myenv
-
Activate the virtual environment:
-
On macOS/Linux:
bashCopy code
source myenv/bin/activate
-
On Windows (using Command Prompt):
cmdCopy code
myenv\Scripts\activate.bat
-
-
Install required packages:
bashCopy code
pip install -r requirements.txt
The following packages are required for this project:
instagrapi
tqdm
pydantic
This project is open source and available under the MIT License.