Skip to content

jermsmit/snare

Repository files navigation

Snare

Self-hosted media download manager with a web interface.

Snare wraps yt-dlp and gallery-dl with a clean dashboard UI. Submit URLs from your browser, track download progress in real-time, manage cookie profiles for authenticated downloads, and browse/stream/download your archived files — all without touching the command line.

Snare Dashboard


Features

  • Download queue — Submit any URL and track progress live with real-time log streaming
  • Auto tool detection — Automatically picks yt-dlp or gallery-dl based on the URL domain
  • Cookie authentication — Import browser cookies to download from authenticated sites (Patreon, YouTube memberships, Instagram, etc.)
  • File browser — Browse downloaded files by folder directly in the UI
  • Media preview — Stream video, audio, and images right in the browser
  • Direct download — Pull any archived file to your local machine with one click
  • Disk monitoring — Live disk usage in the sidebar
  • Settings panel — Configure download directory, concurrency, and request delays

Screenshots

Dashboard Queue
Dashboard Queue
Archive Browser Media Preview
Archive Preview
Cookie Profiles Settings
Cookies Settings

Supported Sites

Snare inherits full site support from its underlying tools:

Tool Examples
yt-dlp YouTube, Twitter/X, TikTok, Vimeo, Twitch, Reddit, Instagram, Facebook, SoundCloud, Bandcamp, Bilibili, and 1000+ more
gallery-dl DeviantArt, Flickr, Pixiv, ArtStation, Danbooru, Imgur, Tumblr, Patreon, and 300+ more

Installation

Requirements

  • Ubuntu 20.04, 22.04, or 24.04
  • 512 MB RAM minimum
  • sudo / root access
  • Internet access to reach package mirrors and GitHub

Step 1 — Download Snare

Either clone from GitHub:

git clone https://github.com/yourusername/snare.git
cd snare

Or download and extract the zip:

unzip snare.zip
cd snare

Step 2 — Run the installer

sudo bash installer/install.sh

The installer will:

  1. Install system dependencies (ffmpeg, python3, curl, p7zip, etc.)
  2. Download and install yt-dlp to /usr/local/bin
  3. Install gallery-dl via pip
  4. Create a dedicated snare system user
  5. Set up a Python virtual environment at /opt/snare/venv
  6. Copy all application files to /opt/snare
  7. Write a config file at /opt/snare/.env
  8. Install and start a systemd service

Step 3 — Open the web interface

When the installer completes, it will print your URL:

Web Interface:  http://YOUR-SERVER-IP:8080

Open that in your browser — Snare is ready to use.


Post-Install Configuration

Change the port

SNARE_PORT=9090 sudo bash installer/install.sh

Or edit /opt/snare/.env manually and restart:

sudo nano /opt/snare/.env
sudo systemctl restart snare

Change the download directory

Edit /opt/snare/.env:

SNARE_DOWNLOAD_DIR=/your/custom/path

Or use the Settings page in the web UI. Make sure the snare system user has write access to the directory:

sudo mkdir -p /your/custom/path
sudo chown snare:snare /your/custom/path

Then restart the service:

sudo systemctl restart snare

Adjust concurrency and sleep delay

In the web UI go to Settings and adjust:

  • Max Concurrent Downloads — how many jobs run in parallel (default: 3)
  • Sleep Between Requests — polite delay passed to yt-dlp/gallery-dl (default: 1s)

Service Management

# Check status
sudo systemctl status snare

# View live logs
sudo journalctl -u snare -f

# Restart
sudo systemctl restart snare

# Stop
sudo systemctl stop snare

# Start
sudo systemctl start snare

# Disable autostart
sudo systemctl disable snare

Cookie Authentication

Some sites require you to be logged in to download content (Patreon posts, YouTube memberships, Instagram private accounts, etc.). Snare handles this via cookie profiles.

Setup

  1. Install the Cookie-Editor extension in Chrome or Firefox
  2. Log into the target website in your browser
  3. Click the Cookie-Editor icon → click ExportExport as JSON → copy to clipboard
  4. In Snare, go to Cookie ProfilesNew Profile
  5. Enter a name (e.g. My YouTube) and the domain (e.g. youtube.com)
  6. Click Import Cookies on your new profile and paste the JSON
  7. When submitting a download job, select your cookie profile from the dropdown

Supported cookie formats

Snare accepts the standard JSON format exported by Cookie-Editor, which is compatible with both yt-dlp and gallery-dl.

⚠️ Security warning: Cookie files grant full access to your accounts. Only run Snare on a trusted private network. Never expose it to the public internet without a reverse proxy and authentication layer in front of it.


🔒 Reverse Proxy Setup (Recommended)

For access outside your local network, put Snare behind Nginx with HTTPS.

Nginx config

server {
    listen 80;
    server_name snare.yourdomain.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    server_name snare.yourdomain.com;

    ssl_certificate     /etc/letsencrypt/live/snare.yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/snare.yourdomain.com/privkey.pem;

    # Optional: basic auth to restrict access
    auth_basic "Snare";
    auth_basic_user_file /etc/nginx/.htpasswd;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_buffering off;
        proxy_read_timeout 300s;
    }
}

Get an SSL certificate with Certbot

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d snare.yourdomain.com

Add basic auth

sudo apt install apache2-utils
sudo htpasswd -c /etc/nginx/.htpasswd yourusername
sudo systemctl reload nginx

Updating Snare

cd snare
git pull
sudo bash installer/install.sh

The installer is fully idempotent — safe to re-run. It will update all files and restart the service.


Project Structure

snare/
├── backend/
│   ├── main.py                  # FastAPI app entry point + lifespan
│   ├── core/
│   │   ├── database.py          # SQLite schema & init
│   │   ├── downloader.py        # yt-dlp / gallery-dl subprocess wrapper
│   │   └── queue_manager.py     # Async job queue with semaphore concurrency
│   └── api/routes/
│       ├── jobs.py              # Job CRUD, cancel, log streaming
│       ├── cookies.py           # Cookie profile management
│       ├── archive.py           # File browser, streaming, download
│       └── system.py            # System info & settings
├── frontend/
│   ├── templates/index.html     # Single-page app shell
│   └── static/
│       ├── css/app.css          # Full UI stylesheet (IBM Plex, dark theme)
│       └── js/app.js            # SPA router, all page renderers, API client
├── installer/
│   └── install.sh               # Ubuntu installer script
├── docker/
│   ├── Dockerfile
│   └── docker-compose.yml
├── docs/
│   └── screenshots/             # UI screenshots (add your own here)
└── requirements.txt

Troubleshooting

Service won't start

sudo journalctl -u snare -n 50 --no-pager

Permission denied on downloads directory

sudo chown -R snare:snare /opt/snare/downloads

yt-dlp is outdated

sudo yt-dlp -U

gallery-dl is outdated

sudo pip3 install -U gallery-dl --break-system-packages

Port 8080 already in use

Edit /opt/snare/.env, change SNARE_PORT, then:

sudo systemctl restart snare

Reset everything and reinstall

sudo systemctl stop snare
sudo rm -rf /opt/snare
sudo userdel snare
sudo rm /etc/systemd/system/snare.service
sudo systemctl daemon-reload
# Then re-run the installer
sudo bash installer/install.sh

License

MIT — do whatever you want with it.


Credits

Snare is a frontend and orchestration layer built on top of:


⬆️ Upgrading Snare

Upgrading preserves your existing downloads, settings, database, and config file. Only application code and dependencies are updated.

From git

cd snare
git pull
sudo bash installer/install.sh --upgrade

From a zip download

unzip snare.zip
cd snare
sudo bash installer/install.sh --upgrade

The upgrade process:

  1. Updates system packages
  2. Updates yt-dlp to the latest release
  3. Updates gallery-dl to the latest release
  4. Updates Python packages in the venv
  5. Stops the running service
  6. Replaces application files
  7. Preserves your .env config
  8. Preserves all downloaded files
  9. Preserves your database (jobs, cookie profiles, settings)
  10. Restarts the service

What's new in each version

See CHANGELOG.md for full release notes.

About

Self-hosted media download manager with a web interface.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors