metube README

The project's README from github.com/alexta69/metube. As one markdown file: README.md.

MeTube

Build Status Docker Pulls

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:

screenshot1

🐳 Run using Docker

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

🐳 Run using Docker Compose

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

⬇️ Download Behavior

📁 Storage & Directories

📝 File Naming & yt-dlp

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

🎛️ 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 example, the command-line flag --write-subs becomes "writesubtitles": true in JSON.

Tip: Some command-line flags don't have a direct single-key equivalent — for instance, --embed-thumbnail and --recode-video must be expressed via "postprocessors". A full list of available API options can be found in the yt-dlp source, and this conversion script can help translate command-line flags to their API equivalents.

Global options

Global options form the baseline for every download. There are two ways to define them, and you can use either or both:

Inline via environment variable (YTDL_OPTIONS) — pass a JSON object directly:

environment:
  - 'YTDL_OPTIONS={"writesubtitles": true, "subtitleslangs": ["en", "de"], "updatetime": false, "writethumbnail": true}'

Via a JSON file (YTDL_OPTIONS_FILE) — mount a file into the container and point to it:

volumes:
  - /path/to/ytdl-options.json:/config/ytdl-options.json
environment:
  - YTDL_OPTIONS_FILE=/config/ytdl-options.json

where ytdl-options.json contains:

{
  "writesubtitles": true,
  "subtitleslangs": ["en", "de"],
  "updatetime": false,
  "writethumbnail": true
}

The file is monitored for changes and reloaded automatically — no container restart needed. If you use both methods and they define the same key, the file takes precedence.

Presets

Presets let you define named bundles of options that appear in the web UI under Advanced Options as "Option Presets". Users can select one or more presets per download, making it easy to apply common option combinations without editing global settings.

Like global options, presets can be set inline or via a file:

If both are used and they define a preset with the same name, the file's version takes precedence.

Example — a presets file defining three presets:

{
  "sponsorblock": {
    "postprocessors": [
      { "key": "SponsorBlock", "categories": ["sponsor", "selfpromo", "interaction"] },
      { "key": "ModifyChapters", "remove_sponsor_segments": ["sponsor", "selfpromo", "interaction"] }
    ]
  },
  "embed-subs": {
    "writesubtitles": true,
    "writeautomaticsub": true,
    "subtitleslangs": ["en", "de"],
    "postprocessors": [{ "key": "FFmpegEmbedSubtitle" }]
  },
  "limit-rate": {
    "ratelimit": 5000000
  }
}

This makes three presets available in the UI:

When multiple presets are selected for a download, they are applied in order. If two presets set the same option, the later one wins.

Per-download overrides

For one-off tweaks, MeTube can expose a free-text JSON field in the UI ("Custom yt-dlp Options") where users type yt-dlp options that apply only to that single download. This is disabled by default:

environment:
  - ALLOW_YTDL_OPTIONS_OVERRIDES=true

Once enabled, the field appears under Advanced Options. Any options entered there take the highest priority, overriding both global options and selected presets.

⚠️ Security note: Enabling this allows arbitrary yt-dlp API options to be supplied by anyone with access to the UI. Depending on the options used, this may enable arbitrary command execution inside the container. Enable only in trusted environments.

How the layers combine

When a download starts, the final set of yt-dlp options is built in this order:

  1. Start with global options (YTDL_OPTIONS / YTDL_OPTIONS_FILE).
  2. Apply each selected preset in order (later presets overwrite earlier ones for conflicting keys).
  3. Apply any per-download overrides on top (overwrite everything else for conflicting keys).

MeTube always forces its own flat-extract behaviour during the initial metadata fetch (extract_flat, noplaylist, etc.); presets cannot override those keys for that phase.

Example: Suppose your global options set "writesubtitles": false, but you select a preset that sets "writesubtitles": true. Subtitles will be written for that download because the preset overrides the global setting. If you additionally enter {"writesubtitles": false} in the per-download overrides field, that value wins and subtitles will not be written.

Configuration cookbooks

The project's Wiki contains examples of useful configurations contributed by users of MeTube:

🍪 Using browser cookies

In case you need to use your browser's cookies with MeTube, for example to download restricted or private videos:

Several integrations let you send URLs to MeTube from wherever you are, instead of pasting them into the UI. The browser-based ones make cross-origin requests, so they require CORS_ALLOWED_ORIGINS to be set; and if you're on an HTTPS page, your MeTube instance must be served over HTTPS too (with HTTPS=true or behind an HTTPS reverse proxy — see below).

Browser extensions allow right-clicking videos and sending them directly to MeTube. Since extensions request from their own origin, set CORS_ALLOWED_ORIGINS=*.

Bookmarklets send the currently open page to MeTube with one click. Add the origins of the sites where you use them to CORS_ALLOWED_ORIGINS, e.g. https://www.youtube.com,https://www.vimeo.com. If your instance sits behind authentication, list the origins individually rather than using * — only named origins are allowed to send credentials. The code (Chrome and Firefox variants, contributed by kushfest and shoonya75) is in the Bookmarklets wiki page.

iOS Shortcut: rithask created an iOS shortcut for sending URLs to MeTube from Safari's share menu; it prompts for your instance address on first use.

Raycast: dotvhs h

metube (alexta69/metube)

Searching Database…

15K ·GitHub
Что это такое?MeTube — это веб-интерфейс для yt-dlp, который можно развернуть на своём сервере. Через браузер вы скачиваете видео, аудио, субтитры и миниатюры с YouTube и десятков других сайтов.
Это расширение для браузера или полноценный сервер, который я запускаю сам?Это небольшое серверное приложение, которое вы запускаете через Docker. Оно отдаёт веб-интерфейс, который открывается в браузере. Это не расширение для браузера и не настольное приложение.
Как его запустить?Запустите официальный Docker-образ (или docker-compose), подключив том для загрузок и порт 8081, затем откройте веб-интерфейс в браузере.
Нужно ли мне самому устанавливать yt-dlp или Python?Нет, yt-dlp и его среда выполнения Python уже входят в состав Docker-образа. Для запуска нужен только Docker.
Безопасно ли разрешать ему загружать ссылки с любых адресов?По умолчанию MeTube блокирует загрузки с частных, локальных (loopback) и других внутренних адресов, чтобы предотвратить SSRF-атаки. Эту защиту можно отключить, но только в доверенных сетях, которыми вы управляете.
Работает ли он на ARM-устройствах, например на Raspberry Pi?Да, Docker-образы мультиархитектурные и поддерживают как amd64, так и arm64.
Открывает ли он мою папку с загрузками в сети?Каталоги загрузок по умолчанию не индексируются. Межсайтовые API-запросы запрещены, пока вы явно не добавите источники в белый список. Это также не даёт другим сайтам перехватить вашу сессию через cookie.
Может ли MeTube следить за YouTube-каналом и автоматически скачивать новые видео?Да, можно подписаться на каналы и плейлисты. MeTube периодически проверяет появление новых элементов и автоматически ставит их в очередь на загрузку.
Можно ли настраивать поведение yt-dlp для каждой загрузки отдельно?MeTube поддерживает три уровня параметров yt-dlp: глобальные значения по умолчанию, именованные пресеты, которые выбираются в интерфейсе, и необязательные произвольные параметры для отдельной загрузки. При конфликте побеждает самый конкретный уровень.
Можно ли задавать, куда сохраняются файлы и как они называются?Да, можно настраивать шаблоны имён выходных файлов и собственные подкаталоги внутри папки загрузок. Для плейлистов и каналов правила могут быть отдельными.
Не сломается ли всё, если обновление yt-dlp что-то изменит?Можно включить ночные сборки yt-dlp с ежедневным обновлением в заданное время. По умолчанию используются стабильные релизы, которые входят в образ.
What are similar projects?linksift, ytDownloader, ytdlnis, reclip, cobalt, Seal, ISpotify, downvid
Creator
alexta69
Size
9.3 MB
Stars
15K
Age
6y
Commits · 90 Days