Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

InstaHarvest 📊

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.

🎯 Overview

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.

✨ Features

  • 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

📁 Project Structure

InstaHarvest/
├── InstaHarvest.ipynb           # Main Jupyter notebook with analysis
├── data.txt                     # Raw Instagram profile data
├── README.md                    # Project documentation
└── anaconda_projects/
    └── db/                      # Database related files

🚀 Getting Started

Prerequisites

  • 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 (json module)
  • Basic understanding of Python

Installation

  1. Clone the repository

    git clone https://github.com/DSxManash/InstaHarvest.git
    cd InstaHarvest
  2. Install Jupyter (if not already installed)

    pip install jupyter

    Note: Jupyter is only needed to run the .ipynb notebook. The core Python code has zero dependencies.

  3. Launch Jupyter Notebook

    jupyter notebook
  4. Open the notebook

    • Navigate to InstaHarvest.ipynb in the Jupyter interface
    • Run cells sequentially from top to bottom

💻 Usage

Running the Analysis

  1. Load Data: The notebook reads Instagram profile data from data.txt
  2. Parse Profiles: Each profile chunk is parsed into structured dictionaries
  3. Analyze Metrics: Run queries to find:
    • Profile with maximum posts
    • Profile with maximum followers
    • Profile with maximum following
    • Category distribution statistics

Example Queries

# 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}")

📊 Data Structure

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

Sample Data Format

The data.txt file contains Instagram profiles in the following format:

username
1,449 posts
510M followers
357 following
Sportsperson
Profile biography text here...

🔧 Key Functions

parse_chunk(chunk)

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

📈 Analysis Examples

1. Profile with Maximum Posts

max_posts_profile = max(all_profiles, key=lambda x: x["posts"])
print(f"{max_posts_profile['username']}: {max_posts_profile['posts']} posts")

2. Profile with Maximum Followers

max_followers_profile = max(all_profiles, key=lambda x: x["followers"])
print(f"{max_followers_profile['username']}: {max_followers_profile['followers']:,} followers")

3. Category Distribution

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")

📚 Sample 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...

🎓 Learning Outcomes

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

🛠️ Future Enhancements

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

📝 License

This project is licensed under the MIT License - free to use for educational and personal purposes.

🙏 Acknowledgments

  • 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.

About

A pure Python project for collecting, parsing, and analyzing Instagram profile data.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages