A pure Python Instagram profile data analysis tool that parses and extracts insights from Instagram profile metrics. This project uses only Python's built-in libraries (no external dependencies required) and demonstrates data parsing, transformation, and analysis techniques using Jupyter notebooks.
InstaHarvest is a lightweight, pure Python project that processes raw Instagram profile data to extract structured information about popular accounts, including posts, followers, following counts, and profile categories. Built entirely with Python standard library features, this project showcases fundamental data manipulation and analysis techniques suitable for educational purposes and portfolio demonstrations.
- Pure Python Implementation: Uses only Python standard library - no external dependencies needed
- Data Parsing: Intelligent parsing of Instagram profile information from text format
- Number Conversion: Automatic conversion of abbreviated numbers (1K, 5M) to full integers
- Category Detection: Identifies and categorizes profiles (Sportsperson, Artist, Entrepreneur, etc.)
- Statistical Analysis: Find profiles with maximum posts, followers, and following counts
- Category Distribution: Analyze the distribution of profiles across different categories
- JSON Export: Convert parsed data to structured JSON format
InstaHarvest/
├── InstaHarvest.ipynb # Main Jupyter notebook with analysis
├── data.txt # Raw Instagram profile data
├── README.md # Project documentation
└── anaconda_projects/
└── db/ # Database related files
- Python 3.7 or higher - Only requirement!
- Jupyter Notebook or JupyterLab - For running the analysis notebook
- No external libraries needed - Uses only Python standard library (
jsonmodule) - Basic understanding of Python
-
Clone the repository
git clone https://github.com/DSxManash/InstaHarvest.git cd InstaHarvest -
Install Jupyter (if not already installed)
pip install jupyter
Note: Jupyter is only needed to run the
.ipynbnotebook. The core Python code has zero dependencies. -
Launch Jupyter Notebook
jupyter notebook
-
Open the notebook
- Navigate to
InstaHarvest.ipynbin the Jupyter interface - Run cells sequentially from top to bottom
- Navigate to
- Load Data: The notebook reads Instagram profile data from
data.txt - Parse Profiles: Each profile chunk is parsed into structured dictionaries
- Analyze Metrics: Run queries to find:
- Profile with maximum posts
- Profile with maximum followers
- Profile with maximum following
- Category distribution statistics
# Find profile with maximum followers
max_followers_profile = max(all_profiles, key=lambda x: x["followers"])
# Get unique categories
unique_categories = set(profile["category"] for profile in all_profiles if profile["category"])
# Count profiles per category
for cat in unique_categories:
count = sum(1 for p in all_profiles if p["category"] == cat)
print(f"{cat}: {count}")Each parsed profile contains the following fields:
| Field | Type | Description |
|---|---|---|
username |
string | Instagram username |
posts |
integer | Total number of posts |
followers |
integer | Number of followers (converted from K/M notation) |
following |
integer | Number of accounts followed |
category |
string | Profile category (e.g., Sportsperson, Artist) |
bio |
string | Profile biography/description |
The data.txt file contains Instagram profiles in the following format:
username
1,449 posts
510M followers
357 following
Sportsperson
Profile biography text here...
The main parsing function that converts raw text into structured data:
- Input: String containing a single Instagram profile's raw data
- Output: Dictionary with parsed profile information
- Features:
- Extracts username, posts, followers, and following counts
- Converts abbreviated numbers (K for thousands, M for millions)
- Detects and extracts profile category
- Captures biography text
max_posts_profile = max(all_profiles, key=lambda x: x["posts"])
print(f"{max_posts_profile['username']}: {max_posts_profile['posts']} posts")max_followers_profile = max(all_profiles, key=lambda x: x["followers"])
print(f"{max_followers_profile['username']}: {max_followers_profile['followers']:,} followers")categories = [p["category"] for p in all_profiles if p["category"]]
for cat in set(categories):
count = categories.count(cat)
print(f"{cat}: {count} profiles")The dataset includes profiles of world-famous football personalities:
- Leo Messi - 510M followers
- Neymar Jr - 231M followers
- Kylian Mbappé - 128M followers
- Ronaldinho - 78.1M followers
- Luis Suárez - 48.1M followers
- And more...
This project demonstrates:
- File I/O operations in Python
- String parsing and manipulation
- Data structure creation (dictionaries, lists)
- Lambda functions for data filtering
- JSON serialization
- Basic data analysis techniques
- Jupyter notebook workflow
Potential improvements for this project:
- Export results to CSV/Excel formats
- Create data visualizations (bar charts, pie charts)
- Add pandas DataFrame integration
- Implement database storage (SQLite/PostgreSQL)
- Build a web interface using Flask/Django
- Add engagement rate calculations
- Implement sentiment analysis on bios
- Create automated data collection (with API)
- Add data validation and error handling
- Generate HTML reports
This project is licensed under the MIT License - free to use for educational and personal purposes.
- Data parsing techniques inspired by real-world data engineering challenges
- Built for educational and portfolio demonstration purposes
- Not affiliated with Instagram/Meta
Note: This project uses sample data for educational purposes. Always respect platform terms of service and privacy policies when working with social media data.