InStream is a Flask-based web application for managing Instagram live streaming sessions. It provides a comprehensive dashboard and interactive control panel for uploading, selecting, and managing videos, as well as controlling live broadcasts with real-time analytics and engagement features.
This tool is designed for content creators who require full control over their Instagram Live broadcasts from a mobile-friendly interface. The application offers secure authentication, video management, live stream control, and real-time monitoring capabilities.
Authentication & Security
- Secure cookie-based authentication for Instagram sessions
- Session validation and management
- Secure storage of streaming credentials
Video Management
- Upload videos with drag and drop support
- Download videos from Instagram URLs
- Organize and manage video library
- Delete or clear videos from library
Live Stream Control
- Start and stop streams with custom titles
- Set custom stream duration with auto-stop capability
- Real-time stream management and monitoring
Real-Time Analytics & Monitoring
- Live viewer count tracking
- Comment monitoring and management
- Broadcast duration tracking
- Live comment feed with posting capability
Dashboard
- Analytics overview
- Stream status indicators
- Quick action controls
- Application health monitoring
- Dark mode support
- Python 3.8 or higher
- Flask web framework
- Virtual environment support
git clone https://github.com/iqbalmh18/instream.git
cd instreampython3 -m venv venv
source venv/bin/activateOn Windows:
python -m venv venv
venv\Scripts\activatepip install -r requirements.txtexport FLASK_HOST=0.0.0.0
export FLASK_PORT=5000
export FLASK_DEBUG=trueOn Windows (Command Prompt):
set FLASK_HOST=0.0.0.0
set FLASK_PORT=5000
set FLASK_DEBUG=trueAll application configuration is managed through the config.py file using the Config class. Key settings include:
Application Settings
LOG_FOLDER: Directory location for application logsLOG_LEVEL: Logging verbosity levelMAX_CONTENT_LENGTH: Maximum file upload size (default: 1GB)
Streaming Settings
- Instagram API configuration
- Streaming protocol settings
- Custom implementation via
utils.LiveStreamManager
For detailed configuration options, refer to the config.py file in the project root.
python3 app.pyAccess the application at http://localhost:5000
- Navigate to the Home page
- Enter your Instagram session cookies in the provided field
- Click Save and test to validate cookies
Select one of the following methods:
- Upload a video file from your computer
- Download a video from Instagram using its URL
- Select an existing video from your library
- Enter a custom title for your stream
- Set the stream duration
- Click Start to begin streaming
- Monitor live statistics in real-time
- Post comments to engage with viewers
- Stop the stream manually at any time
- Allow automatic stop after the specified duration
- Monitor viewer count and engagement metrics
| Method | Endpoint | Purpose |
|---|---|---|
| GET | / |
Home page and stream control interface |
| GET | /dashboard |
Dashboard with analytics and overview |
| POST | /api/start |
Start a new live stream |
| POST | /api/stop |
Stop the current live stream |
| GET | /api/info |
Retrieve current stream information |
| GET | /api/status |
Get current streaming status |
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /api/upload |
Upload video file |
| POST | /api/download |
Download video from Instagram URL |
| DELETE | /api/delete/<video_id> |
Delete specific video |
| GET | /videos |
Fetch complete video library |
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /api/validate-cookies |
Validate Instagram session cookies |
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /api/comment |
Post comment to live stream |
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /health |
Application health status |
Upload Fails with File Size Error
The upload was rejected due to file size limits. To resolve this:
- Increase
MAX_CONTENT_LENGTHvalue inconfig.py - Ensure your video file meets the size requirements
- Try uploading again
Invalid Cookies Error When Saving
Ensure your Instagram cookies are correctly extracted:
- Open Instagram in your browser
- Access Developer Tools (F12 or right-click > Inspect)
- Navigate to Application tab
- Select Cookies
- Copy the session cookie values
- Paste them into the application
Dashboard Shows Offline Status
If the dashboard indicates offline status despite active streaming:
- Check the browser console for error messages
- Verify the
/api/infoendpoint response - Confirm backend server is running
- Review application logs in the LOG_FOLDER directory
Video Upload Timeout
If video uploads are timing out:
- Check your network connection
- Try uploading a smaller file first
- Verify the Flask server is responsive
- Check available disk space
instream/
├── app.py # Main Flask application
├── config.py # Configuration settings
├── requirements.txt # Python dependencies
├── utils.py # Utility functions and LiveStreamManager
├── templates/ # HTML templates
├── static/ # CSS and JavaScript files
├── uploads/ # Video upload directory
└── logs/ # Application logs
export FLASK_DEBUG=true
python3 app.pyApplication logs are stored in the configured LOG_FOLDER. Check these logs for detailed error messages and system information.
Use tools like curl or Postman to test API endpoints:
curl -X POST http://localhost:5000/api/validate-cookies \
-H "Content-Type: application/json" \
-d '{"cookies": "your_cookie_string"}'To contribute to this project:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is licensed under the MIT License. See the LICENSE file for complete license information.
For issues, questions, or feature requests, please open an issue on the GitHub repository or contact the development team.
This tool is intended for personal use and educational purposes. Ensure compliance with Instagram's Terms of Service and community guidelines when using this application.