A web-based user interface for the gallery-dl command-line tool that allows users to download media from various online platforms through an intuitive web interface. The application provides real-time download status tracking, session management, and secure cookie handling for authenticated downloads.
- Web-based Interface: User-friendly web interface for gallery-dl with responsive design
- Real-time Status Tracking: Live progress updates for all active downloads
- Session Management: Isolated download sessions per user with automatic cleanup
- Cookie Support: Secure handling of authentication cookies for private content
- File Management: Browse and download completed media files
- Filtering: Filter downloads by status (in-progress, completed, failed)
- Retry Logic: Automatic retry mechanism for failed downloads due to network issues
- Security: Secure cookie encryption, path traversal protection, and input validation
- Multi-user Support: Session-based isolation to support multiple concurrent users
- Backend: Python Flask web framework
- Frontend: HTML5, CSS3, JavaScript (no external dependencies)
- Download Engine: gallery-dl - a command-line program to download image-galleries from several image hosting sites
- Task Management: Threading for concurrent download operations
- File Serving: Secure file serving with path traversal prevention
- Data Storage: In-memory storage for download status (with automatic cleanup)
- Python 3.7+
- Node.js/npm (for development scripts)
- gallery-dl - install with
pip install gallery-dl
-
Clone the repository:
git clone https://github.com/RenX86/GDL-Web.git cd GDL-Web -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Python dependencies:
pip install -r requirements.txt
-
Install gallery-dl (if not already installed):
pip install gallery-dl
-
Set up environment variables:
cp .env.example .env # Edit .env to add your secret keys and configuration -
Run the application:
python run.py
-
Open your browser and navigate to:
http://127.0.0.1:5000
The application is configured for deployment to Render.com:
-
Using Gunicorn:
gunicorn --bind 0.0.0.0:$PORT run:app -
Environment Variables Required for Production:
FLASK_ENV: Set toproductionSECRET_KEY: Secure random key for Flask sessionsCOOKIES_ENCRYPTION_KEY: Secure random key for cookie encryptionHOST: 0.0.0.0 (for Render deployment)- Other optional variables as defined in
render.yaml
- Enter the URL of the gallery or media you want to download
- Optionally upload a cookie file for authenticated content
- Click "Download Media"
- Monitor progress in real-time
For platforms requiring authentication:
- Extract cookies from your browser (using extensions like "Export Cookies" or "Cookie Editor")
- Save as a Netscape-format text file
- Upload the cookie file during download
- Cookies are encrypted and stored securely
- Filter downloads by status (All, In Progress, Completed, Failed)
- Delete individual downloads or clear all history
- View and download completed files
- Auto-refresh every 2 seconds for live status updates
The application follows a service-oriented architecture with the following components:
app/
βββ __init__.py # Application factory
βββ config.py # Configuration management
βββ exceptions.py # Custom exception classes
βββ logging_config.py # Logging setup
βββ models/ # Data models
β βββ config.py # Configuration model
β βββ download.py # Download data model
βββ routes/ # Flask route handlers
β βββ api.py # API endpoints
β βββ web.py # Web page routes
βββ services/ # Business logic services
β βββ download_service.py # Core download functionality
β βββ download_service_adapter.py # Session isolation layer
β βββ service_registry.py # Service dependency injection
β βββ cookie_manager.py # Cookie encryption/decryption
β βββ network_utils.py # Network connectivity checks
β βββ progress_parser.py # Download progress parsing
βββ utils.py # Helper functions
app/static/
βββ css/styles.css # Styling for the interface
βββ js/main.js # Client-side JavaScript functionality
βββ favicon.ico # Site favicon
app/templates/
βββ index.html # Main application page
- DownloadService: Core service that manages gallery-dl subprocesses, tracks progress, and handles errors
- DownloadServiceAdapter: Session isolation layer that ensures users only see their own downloads
- ServiceRegistry: Dependency injection container for application services
- CookieManager: Secure encryption/decryption of authentication cookies
- ProgressParser: Real-time parsing of gallery-dl output to extract progress information
- Cookie Encryption: All cookies are encrypted using Fernet (AES 128 in CBC mode) before storage
- Path Traversal Protection: Secure file serving with path validation to prevent directory traversal
- Input Validation: Comprehensive validation of URLs and other user inputs
- Session Isolation: Each user session is isolated with unique download directories
- Rate Limiting Preparation: Built-in structure for future rate limiting implementation
- CORS Handling: Default Flask security measures for cross-origin requests
POST /api/download- Start a new downloadGET /api/status/<download_id>- Get status of a specific downloadGET /api/downloads- List all downloads for current sessionDELETE /api/downloads/<download_id>- Delete a specific downloadPOST /api/cancel/<download_id>- Cancel an active downloadGET /api/stats- Get download statisticsGET /api/config- Get application configurationGET /api/files/<download_id>- List files for a specific downloadGET /api/download-file/<download_id>/<filename>- Download a specific file
Run the test suite:
npm test
# or
pytest- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for your changes
- Run the test suite (
pytest) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- gallery-dl - The powerful command-line tool that makes this project possible
- Flask - Web framework that powers the backend
- All contributors and users of this project
The project includes npm scripts for common development tasks:
npm run dev- Start development servernpm run test- Run testsnpm run lint- Run linternpm run format- Format codenpm run type-check- Run type checker
- gallery-dl not found: Ensure gallery-dl is installed with
pip install gallery-dl - Permission errors: Check file permissions for downloads and secure_cookies directories
- Network errors: Verify internet connectivity and firewall settings
- Cookie format issues: Ensure cookie files are in Netscape format
Enable debug mode by setting FLASK_ENV=development in your environment variables.
For more detailed logs, set LOG_LEVEL=DEBUG in your environment variables.