A command-line tool that helps you analyze and track your Instagram followers and following relationships. Generate detailed reports of your Instagram network and monitor changes over time.
- 🔍 Track followers and following relationships
- 📊 Generate daily reports of your Instagram network
- 📈 Monitor follower/following changes over time
- 🤝 Identify mutual connections
- 💾 Store historical data in MongoDB
- 🔐 Secure session management for Instagram authentication
- 🎨 Beautiful terminal-based UI with color-coded output
- 📋 Interactive prompts and user choices
- ⚡ Fast data processing and analysis
- 🔧 Configuration options for testing and debugging
This project is a command-line tool (main.py) that analyzes Instagram follower relationships using the Instagram API and stores data in MongoDB.
- Python 3.7+
- MongoDB (local or remote)
- Instagram account credentials
- Clone and setup:
git clone https://github.com/akl773/instagramFollowers.git
cd instagramFollowers
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt- Create
.envfile:
INSTAGRAM_USERNAME=your_instagram_username
INSTAGRAM_PASSWORD=your_instagram_password
MONGO_URI=mongodb://localhost:27017
DATABASE_NAME=InstagramStat
DRY_RUN=false
FORCE_RUN=false
PRINT_QUERY_TIME=false- Run the analyzer:
python main.pyinstagramFollowers/
├── main.py # Command-line application entry point
├── db_manager.py # MongoDB connection and management
├── models/ # Data models
│ ├── base.py # Base model with MongoDB operations
│ ├── report.py # Report model for daily statistics
│ └── user.py # User model for Instagram users
├── utils/ # Utility functions
│ ├── decorators.py # Query timing decorators
│ └── time.py # Time-related utilities
├── session/ # Instagram session storage
├── setup.sh # Automated setup script
└── requirements.txt # Python dependencies
INSTAGRAM_USERNAME- Your Instagram usernameINSTAGRAM_PASSWORD- Your Instagram passwordMONGO_URI- MongoDB connection stringDATABASE_NAME- Database name for storing dataEXCEPTION_NOT_FOLLOWING_BACK- Comma-separated usernames to excludeDRY_RUN- Limit data fetching to 10 users for testingFORCE_RUN- Regenerate today's report even if it existsPRINT_QUERY_TIME- Show MongoDB query execution times
The script supports Instagram accounts with 2FA enabled. If 2FA is required:
- The script will prompt you to enter the verification code
- Enter the code from your authenticator app or SMS
- The script will continue automatically after successful authentication
Note: 2FA codes are not stored and must be entered interactively each time.
# Generate a daily report
python main.py
# Run in dry-run mode (limited data)
DRY_RUN=true python main.py
# Force regenerate today's report
FORCE_RUN=true python main.py- Instagram credentials are stored securely in environment variables
- Session data is stored locally in the
sessiondirectory - No sensitive data is exposed in error messages
To run the script in development mode:
python main.pyFor testing with limited data (dry run):
DRY_RUN=true python main.py- Daily automated reports
- Follower and following counts
- Mutual connection identification
- Change tracking between reports
- User relationship mapping
- Growth trend analysis
- Relationship distribution
- Net follower changes
- Historical data comparison
- User engagement insights
- Color-coded Output - Easy-to-read terminal interface
- Progress Indicators - Real-time status updates
- Formatted Tables - Clean data presentation
- Interactive Prompts - User-friendly choices
- Fork the repository
- Create a feature branch
- Make your changes
- Test the command-line interface
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues:
- Check that MongoDB is running
- Verify your Instagram credentials in the
.envfile - Ensure all dependencies are installed
- Check the console for error messages
- Run
python main.pyfor local testing - Use
DRY_RUN=truefor limited data testing
- Set up MongoDB (local or cloud)
- Configure environment variables securely
- Schedule the script to run daily using cron
Analyze your Instagram followers and following with this powerful command-line tool! 🎉📊