Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

metube

> 编程语言
Open source

Self-hosted video downloader for YouTube and other sites (web UI for yt-dlp)

14.3K stars0 likes10 views
WebsiteGitHub

About

Self-hosted video downloader for YouTube and other sites (web UI for yt-dlp)

MeTube

MeTube is a self-hosted web UI for yt-dlp, for downloading media from YouTube and dozens of other sites. Docker images are multi-arch (amd64/arm64).

Key capabilities:

  • Download videos, audio, captions, and thumbnails from a browser UI.
  • Download playlists and channels, with configurable output and download options.
  • Subscribe to channels and playlists, periodically check for new items, and queue new uploads automatically.

🐳 Run using Docker

bash
docker run -d -p 8081:8081 -v /path/to/downloads:/downloads ghcr.io/alexta69/metube

🐳 Run using Docker Compose

yaml
services:
  metube:
    image: ghcr.io/alexta69/metube
    container_name: metube
    restart: unless-stopped
    ports:
      - "8081:8081"
    volumes:
      - /path/to/downloads:/downloads

⚙️ Configuration via environment variables

Certain values can be set via environment variables, using the -e parameter on the docker command line, or the environment: section in Docker Compose.

🏠 Runtime & Permissions

  • PUID: User under which MeTube will run. Defaults to 1000 (legacy UID also supported).
  • PGID: Group under which MeTube will run. Defaults to 1000 (legacy GID also supported).
  • UMASK: Umask value used by MeTube. Defaults to 022.
  • DEFAULT_THEME: Default theme to use for the UI, can be set to light, dark, or auto. Defaults to auto.
  • LOGLEVEL: Log level, can be set to DEBUG, INFO, WARNING, ERROR, CRITICAL, or NONE. Defaults to INFO.
  • ENABLE_ACCESSLOG: Whether to enable access log. Defaults to false.

⬇️ Download Behavior

  • MAX_CONCURRENT_DOWNLOADS: Maximum number of simultaneous downloads allowed. For example, if set to 5, then at most five downloads will run concurrently, and any additional downloads will wait until one of the active downloads completes. Defaults to 3.
  • DELETE_FILE_ON_TRASHCAN: if true, downloaded files are deleted on the server, when they are trashed from the "Completed" section of the UI. Defaults to false.
  • DEFAULT_OPTION_PLAYLIST_ITEM_LIMIT: Maximum number of playlist items that can be downloaded. Defaults to 0 (no limit).
  • SUBSCRIPTION_DEFAULT_CHECK_INTERVAL: Default minutes between automatic checks for each subscription. Defaults to 60.
  • SUBSCRIPTION_SCAN_PLAYLIST_END: Maximum playlist/channel entries to fetch per subscription check (newest-first). Defaults to 50.
  • SUBSCRIPTION_MAX_SEEN_IDS: Cap on stored video IDs per subscription to limit state file growth. Defaults to 50000.
  • CLEAR_COMPLETED_AFTER: Number of seconds after which completed (and failed) downloads are automatically removed from the "Completed" list. Defaults to 0 (disabled).

📁 Storage & Directories

  • DOWNLOAD_DIR: Path to where the downloads will be saved. Defaults to /downloads in the Docker image, and . otherwise.
  • AUDIO_DOWNLOAD_DIR: Path to where audio-only downloads will be saved, if you wish to separate them from the video downloads. Defaults to the value of DOWNLOAD_DIR.
  • CUSTOM_DIRS: Whether to enable downloading videos into custom directories within the DOWNLOAD_DIR (or AUDIO_DOWNLOAD_DIR). When enabled, a Download Folder field appears under Advanced Options, where the directory for each download can be specified. Defaults to true.
  • CREATE_CUSTOM_DIRS: Whether to support automatically creating directories within the DOWNLOAD_DIR (or AUDIO_DOWNLOAD_DIR) if they do not exist. When enabled, the download directory selector supports free-text input, and the specified directory will be created recursively. Defaults to true.
  • CUSTOM_DIRS_EXCLUDE_REGEX: Regular expression to exclude some custom directories from the folder field's suggestions. Empty regex disables exclusion. Defaults to (^|/)[.@].*$, which means directories starting with . or @.
  • DEFAULT_FOLDER: Custom directory to pre-select in the download folder field, relative to DOWNLOAD_DIR (or AUDIO_DOWNLOAD_DIR), for when most downloads go to the same place. It is only a starting value — the field stays editable, so any other folder can still be picked per download. Requires CUSTOM_DIRS; ignored with a warning otherwise. Defaults to empty, i.e. the base download directory.
  • DOWNLOAD_DIRS_INDEXABLE: If true, the download directories (DOWNLOAD_DIR and AUDIO_DOWNLOAD_DIR) are indexable on the web server. Defaults to false.
  • STATE_DIR: Path to where MeTube will store its persistent state files (queue.json, pending.json, completed.json, subscriptions.json). Defaults to /downloads/.metube in the Docker image, and . otherwise.
  • TEMP_DIR: Path where intermediary download files will be saved. Defaults to /downloads in the Docker image, and . otherwise.
    • Set this to an SSD or RAM filesystem (e.g., tmpfs) for better performance.
    • Note: Using a RAM filesystem may prevent downloads from being resumed.
  • CHOWN_DIRS: If false, ownership of DOWNLOAD_DIR, STATE_DIR, and TEMP_DIR (and their contents) will not be set on container start. Ensure user under which MeTube runs has necessary access to these directories already. Defaults to true.

📝 File Naming & yt-dlp

  • OUTPUT_TEMPLATE: The template for the filenames of the downloaded videos, formatted according to this spec. Defaults to %(title)s.%(ext)s.
  • OUTPUT_TEMPLATE_CHAPTER: The template for the filenames of the downloaded videos when split into chapters via postprocessors. Defaults to %(title)s - %(section_number)s %(section_title)s.%(ext)s.
  • OUTPUT_TEMPLATE_PLAYLIST: The template for the filenames of the downloaded videos when downloaded as a playlist. Defaults to %(playlist_title)s/%(title)s.%(ext)s. Set to empty to use OUTPUT_TEMPLATE instead.
  • OUTPUT_TEMPLATE_CHANNEL: The template for the filenames of the downloaded videos when downloaded as a channel. Defaults to %(channel)s/%(title)s.%(ext)s. Set to empty to use OUTPUT_TEMPLATE instead.
  • YTDL_OPTIONS: Additional options to pass to yt-dlp, as a JSON object. See Configuring yt-dlp options for details, examples, and available options reference.
  • YTDL_OPTIONS_FILE: Path to a JSON file containing yt-dlp options. Monitored and reloaded automatically on changes. See Configuring yt-dlp options.
  • YTDL_OPTIONS_PRESETS: Named bundles of yt-dlp options, selectable per download in the UI. See Configuring yt-dlp options for format and examples.
  • YTDL_OPTIONS_PRESETS_FILE: Path to a JSON file containing presets. Monitored and reloaded automatically on changes. See Configuring yt-dlp options.
  • ALLOW_YTDL_OPTIONS_OVERRIDES: Whether to show a free-text field in the UI for per-download yt-dlp option overrides. Defaults to false. See Configuring yt-dlp options for details and security considerations.
  • ALLOW_PRIVATE_ADDRESSES: Whether to allow downloads from private, loopback, link-local and other non-global addresses. Defaults to false, which protects against SSRF by refusing URLs that resolve to internal hosts. Set to true only in trusted environments — for example when routing traffic through a proxy/VPN client in Fake-IP mode (sing-box, Clash, Mihomo), which resolves hosts to the 198.18.0.0/15 range. Enabling this disables the SSRF protection entirely, so only use it when you control the network. You do not need this to use a proxy on an internal address: a proxy configured through the proxy option in YTDL_OPTIONS (or the *_proxy environment variables) is always reachable at its own host and port, wherever it lives.
  • YTDL_NIGHTLY_UPDATE_TIME: If set, will cause MeTube to use nightly yt-dlp builds instead of the stable releases. Set to the time (HH:MM, 24-hour) when you want the daily upgrades and MeTube restart to happen. Defaults to empty (disabled).

A filename that would exceed the limit the filesystem accepts is shortened to fit, keeping its extension, with room left for the suffixes yt-dlp adds while downloading. Sites that put a long description in the title would otherwise fail the download outright with File name too long. Use trim_file_name in YTDL_OPTIONS if you want names shorter than the filesystem's own limit, or restrictfilenames to strip non-ASCII characters.

Enabling writeinfojson or writethumbnail in YTDL_OPTIONS also writes a feed-level .info.json and thumbnail when you add a playlist or channel. These reuse the template of the items they belong to — OUTPUT_TEMPLATE_CHANNEL or OUTPUT_TEMPLATE_PLAYLIST — evaluated against the feed itself, so with the defaults they land in the same folder as the videos, named after the feed. Set allow_playlist_files to false in YTDL_OPTIONS to skip them.

🌐 Web Server & URLs

  • HOST: The host address the web server will bind to. Defaults to 0.0.0.0, which is every IPv4 interface but no IPv6 one. Set it to * (or leave it empty) to listen on both stacks, or to :: for IPv6 only — :: does not also accept IPv4, whatever the host's bindv6only setting says.
  • PORT: The port number the web server will listen on. Defaults to 8081.
  • URL_PREFIX: Base path for the web server (for use when hosting behind a reverse proxy). Defaults to /.
  • PUBLIC_HOST_URL: Base URL for the download links shown in the UI for completed files. By default, MeTube serves them under its own URL. If your download directory is accessible on another URL and you want the download links to be based there, use this variable to set it.
  • PUBLIC_HOST_AUDIO_URL: Same as PUBLIC_HOST_URL but for audio downloads.
  • HTTPS: Use https instead of http (CERTFILE and KEYFILE required). Defaults to false.
  • CERTFILE: HTTPS certificate file path.
  • KEYFILE: HTTPS key file path.
  • CORS_ALLOWED_ORIGINS: Comma-separated list of origins permitted to make cross-origin requests to the MeTube API; * allows all. When unset or empty, all cross-origin requests are denied. Required for browser extensions and bookmarklets — see Sending links to MeTube. Naming origins explicitly also lets them send credentials (a login cookie, or the Authorization header a reverse proxy checks), which * deliberately does not: it would let any site you visit drive your instance with your own session.
  • ROBOTS_TXT: A path to a robots.txt file mounted in the container.

🎛️ Configuring yt-dlp options

MeTube lets you customize how yt-dlp behaves at three levels, from broadest to most specific:

  1. Global options — apply to every download by default.
  2. Presets — named bundles of options that users can pick per download from the UI.
  3. Per-download overrides — free-form options entered in the UI for a single download.

When a download starts, these layers are combined in order. If the same option appears in more than one layer, the more specific one wins: per-download overrides beat presets, and presets beat global options.

In JSON presets and overrides, setting an option to null clears that option for that download (for example, "download_archive": null overrides a global archive path so the archive is not used). This follows yt-dlp’s usual meaning of None for that option.

Option format

yt-dlp options in MeTube are expressed as JSON objects. The keys are yt-dlp API option names, which roughly correspond to command-line flags with dashes replaced by underscores. For exam

Issues· 10 open

View all issuesOpen on GitHub
  • #1092

    [Bug]: Clip start produces black/empty video track (needs force_keyframes_at_cuts)

    Updated Oct 1, 2026
  • #1085

    Bookmarklet stopped working after 2026.09.25? Add your sites to CORS_ALLOWED_ORIGINS

    Updated Oct 1, 2026
  • #1030

    Scope check: pre-download playlist browser (pick items before queuing)

    enhancementhelp wantedUpdated Sep 29, 2026
  • #1012

    [Feature]: Prompt when deleting file

    enhancementUpdated Sep 27, 2026
  • #914

    [Feature]: Multiple Format download

    enhancementUpdated Sep 15, 2026
  • #980

    [Bug]: Periodical hiccup

    bugUpdated Sep 9, 2026
  • #1032

    Pre-download probe: format, quality and audio-track picker

    enhancementhelp wantedUpdated Jul 18, 2026
  • #994

    [Feature]: USE OUTPUT_TEMPLATE for file name in download queue

    enhancementhelp wantedUpdated Jul 18, 2026
  • #987

    [Feature]: Browser extension: mark clip times on video pages and send to MeTube

    enhancementUpdated May 24, 2026
  • #962

    [Feature]: Subscribe to channels besides Youtube

    enhancementUpdated Apr 20, 2026

> Tags

Pythonself-hostedyoutubeyoutube-dlyt-dlp

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言