A small Flask app for managing MEGA downloads from a browser.
It queues public MEGA links into approved local folders, shows live job status, can extract common archive formats, and can remux decrypted Blu-ray folder backups into MKV files.
For an existing Debian or Ubuntu Proxmox LXC:
bash -c "$(curl -H 'Cache-Control: no-cache' -fsSL https://raw.githubusercontent.com/dashdogy/FlaskMegaDownloader/master/install/proxmox-helper.sh)"The helper script is safe to run again. On first run it installs the app under
/opt/flask-mega-downloader; later runs update the checkout, refresh the
virtualenv, reinstall the systemd unit, and restart the service.
It also handles the usual host setup:
- Creates
/etc/flask-mega-downloader/config.pyonce and preserves it on update - Generates a one-time admin password if auth has not been configured
- Installs MEGAcmd and prompts for
mega-loginwhen needed - Installs
mediainfo - Tries to build and install the MakeMKV CLI for Blu-ray remux jobs
- Offers to enable the systemd service at boot
Supported LXC guest versions:
- Debian 11, 12, 13
- Ubuntu 20.04, 22.04, 24.04
- Queues one or more public MEGA links
- Resolves supported public
filecrypt.cccontainer pages - Uses MEGAcmd for real downloads
- Shows live download, archive, media, and log state in the UI
- Restricts browsing and output paths to configured roots
- Extracts ZIP, RAR, and 7Z archives
- Supports password-protected ZIP files
- Can auto-sort extracted video files into saved
MoviesandTvShowsmove favorites - Remuxes decrypted Blu-ray
BDMVfolder backups with MakeMKV - Grants Plex read/write ACLs for completed outputs when enabled
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -r requirements.txt
python app.pyBy default the app binds to 0.0.0.0:8090 and built-in auth is enabled.
For local UI work, either set AUTH_ENABLED = False in your config or set
ADMIN_PASSWORD_HASH to a Werkzeug password hash.
The fake backend is available for UI testing:
MEGA_DOWNLOADER_BACKEND=fake python app.pyExample fake URLs:
https://example.local/sample.ziphttps://example.local/encrypted.zip?pw=secret123https://example.local/archive.7z
The app only writes inside saved destination roots. A minimal config looks like:
from pathlib import Path
ALLOWED_DESTINATIONS = {
"downloads": {"label": "Downloads", "path": Path("/srv/mega-downloads")},
"media": {"label": "Media", "path": Path("/srv/media/incoming")},
}Common settings:
MEGA_DOWNLOADER_CONFIG: path to a config fileMEGA_DOWNLOADER_BACKEND:auto,mega, orfakeMEGA_DOWNLOADER_HOST/MEGA_DOWNLOADER_PORT: bind addressMEGA_DOWNLOADER_AUTH_ENABLED: enable or disable built-in authMEGA_DOWNLOADER_ADMIN_USERNAME: admin usernameMEGA_DOWNLOADER_ADMIN_PASSWORD_HASH: admin password hashMEGACMD_BINARY: overridemega-getMAKEMKVCON_BINARY: overridemakemkvconMEDIAINFO_BINARY: overridemediainfoSEVEN_ZIP_BINARY: override7z
Runtime state is stored in SQLite. If an old jobs.json file exists, the app
imports it on first boot after upgrade and then renames it so the migration is
not repeated.
The Proxmox install runs the service as www-data with HOME=/var/www, so
MEGAcmd keeps its session across restarts.
Check login state:
runuser -u www-data -- env HOME=/var/www mega-whoamiLog in manually:
runuser -u www-data -- env HOME=/var/www mega-login your@email.example 'your-password'In auto mode, missing MEGAcmd causes submissions to fail with a clear error.
Use MEGA_DOWNLOADER_BACKEND=fake only when you want the simulator.
Blu-ray jobs are submitted from the explorer by selecting decrypted Blu-ray
folders and using Compile Selected Blu-rays.
Current behavior:
- Source must be a
BDMVfolder backup - The app picks the main feature by duration and size
- Output is a lossless MKV remux with all tracks kept
- Existing output files are not overwritten
- MediaInfo is used for verification and Dolby Vision / Atmos signals
MediaInfo verification is useful, but it is not a playback guarantee for every Plex client, display, AVR, or soundbar.
The included service runs Waitress as www-data:
- Working directory:
/opt/flask-mega-downloader - Config:
/etc/flask-mega-downloader/config.py - Home:
/var/www - Launcher:
server.py
Useful checks:
systemctl status flask-mega-downloader
runuser -u www-data -- env HOME=/var/www mega-whoami
makemkvcon --help
mediainfo --Version- Built-in auth is enabled by default
- POST routes require CSRF tokens
- Explorer access is restricted to configured roots
- Routine actions use relative paths inside saved roots
- Archive extraction validates output paths before writing
- Download commands are run with argument lists, not shell expansion
- Plex access uses
setfaclfor the configured Plex user instead of broad world-writable permissions