Skip to content
Projects

About

Lightweight authenticated yt-dlp queue for NAS: video, audio, subtitles, mobile sharing, restart-safe downloads, and Docker.

Design & Media

How these counts are measured

What you can do

  • Queue video, audio, or subtitle downloads from a browser.
  • Connect an AI client to research, preview, and approve topic collections on the same NAS address, with paginated library lookup and no embedded LLM service.
  • Search saved subtitle text locally, jump to matching playback times, or give an AI client revocable read-only access to selected collections.
  • Choose an explicit Compatible MP4 profile when a client requires H.264 video and AAC audio; existing Best and resolution profiles keep their current behavior.

Measured star growth

in 24h
0
in 7 days
0
in 15 days
+2
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

youtube-dl-nas

Mentioned in Awesome Selfhosted License CI Docker Build Release Docker Pulls Docker Stars

youtube-dl-nas is a small NAS-friendly download queue for videos, audio, and subtitles. It wraps yt-dlp with an authenticated web dashboard, real-time progress updates, download history, file actions, and a REST API for automation.

youtube-dl-nas dashboard demo

From your phone. Saved on your NAS. Watch the 25-second Android sharing demo.

Docker Hub: https://hub.docker.com/r/modenaf360/youtube-dl-nas/

Current release: 26.1105 (2026-11-05)

This release: a wider, quieter library with on-demand details, local subtitle search with playable timestamps, and read-only AI connections that can be limited to a collection. No LLM API key, database, or new container is required. Keep both existing volumes; mobile sharing and existing tokens continue to work. Changelog

Start Here

Goal Go to
Install the app for the first time Docker Compose Quick Start
Choose a NAS or Docker deployment path Deployment paths
Upgrade an existing container or diagnose a problem Operations guide
Send links from Android, iPhone, or iPad Mobile sharing guide
Organize researched URLs and connect an AI client MCP Collections guide
Find a phrase in saved subtitles Content search · 한국어 사용법
Review the newest changes Latest release
Report a reproducible problem Issue form

Need scheduled full-channel backups too? youtube-dl-nas and Channel Vault NAS are complementary sibling tools from the same author that pair cleanly on one NAS: keep youtube-dl-nas for one-off URLs, mobile sharing, and topic collections, and use Channel Vault NAS for long-lived channel vaults.

Dimension youtube-dl-nas Channel Vault NAS
Primary workflow Single-URL & playlist download queue Scheduled full-channel incremental archival
Capture & sharing Android PWA/HTTP Shortcut, iOS Smart Share v2, bookmarklet Register channels once; bounded automatic backup schedules
State & recovery File-backed JSON state + mounted /downfolder scan (no DB) Disk-first NAS folders + archive.txt reuse + rebuildable SQLite index
Source tracking Duplicate checks & download history Preservation Watch for source-absent videos + CSV/NDJSON manifest
Subtitle search & MCP Built-in mounted subtitle phrase search + built-in HTTP MCP collections Opt-in local Whisper/MLX SQLite FTS5 + read-only stdio MCP add-on

Highlights

  • Queue video, audio, or subtitle downloads from a browser.
  • Connect an AI client to research, preview, and approve topic collections on the same NAS address, with paginated library lookup and no embedded LLM service.
  • Search saved subtitle text locally, jump to matching playback times, or give an AI client revocable read-only access to selected collections.
  • Choose an explicit Compatible MP4 profile when a client requires H.264 video and AAC audio; existing Best and resolution profiles keep their current behavior.
  • Keep the last successfully queued dashboard profile ready on each device without auto-submitting the next URL.
  • Use the login, terms, and dashboard flows in English, Korean, Simplified Chinese, or Polish, with browser-language detection and a saved language preference.
  • Keep the lightweight queue safe across container restarts with JSON state, partial-download continuation, duplicate guards, and removable waiting jobs.
  • Submit once and let Smart Preflight inspect metadata and existing NAS files during a three-second undo window before transfer starts.
  • Share a URL from an installed Android PWA, configurable Android HTTP Shortcut, or signed Smart Share v2 iOS Shortcut without a relay service.
  • Send the current desktop page to the composer with a credential-free bookmarklet.
  • Get a Discord, Slack, ntfy, Telegram, or JSON webhook message when downloads finish or fail.
  • Guard playlist and channel URLs with explicit Current video, First 10, or All items scope before they reach the queue.
  • Optionally save a JPG thumbnail beside each downloaded video or audio file.
  • Track current activity with ordered queued jobs, progress, transfer speed, ETA, title, channel, and thumbnail.
  • See free download-volume capacity, stop an active job without deleting compatible partial data, and get a concrete recovery action when a download fails.
  • Review download history and mounted folder files in compact list or thumbnail grid views with search, filters, newest-first sorting, and 20-item numbered pages, then open Library Overview for stored totals, recent activity, media mix, and recorded failures.
  • Surface pre-existing files in /downfolder even when they do not have saved download metadata.
  • Preview saved video and audio in the dashboard, retry failed items, download files, delete history rows, or delete physical files.
  • Compare SRT, VTT, ASS, and SSA files with a verified transcript using nlptutti character/word error metrics and keyword preservation checks.
  • Persist the queue, history, terms acceptance, and the signed-session secret under ./metadata.
  • Automate downloads through a simple REST API.
  • Keep yt-dlp current at startup and every hour by default without stopping the app when an update check fails.
  • Install or upgrade nlptutti when each new container starts so Subtitle QA uses the current package release.
  • Include Deno and the matching yt-dlp-ejs components required for current YouTube JavaScript challenges.
  • Run cleanly on NAS or home-server Docker setups.

Screenshots

Release 26.1105 layout, using synthetic demo media. The GIF above was recorded on 26.1012 and demonstrates the unchanged naming and recovery workflow.

Full-width library with compact download form Mobile library with compact cards and visible search

Languages

The web app supports English, Korean (ko-KR), Simplified Chinese (zh-CN), and Polish (pl-PL). It uses the first supported browser language on a new device, falls back to English, and remembers an explicit selection for one year. The language selector is available before sign-in and from the authenticated dashboard.

Dashboard Workflow

  1. Paste a URL, choose Video, Audio, or Subtitle mode, then submit it to the queue. Playlist and channel URLs open a scope selector before bulk work can start.
  2. Watch Current Activity check the source and count down to an automatic start. Use the remove control during this three-second Smart Preflight window to undo the request without adding a history row. Once transfer starts, the control changes to Stop and retains compatible partial data for retry. Existing media is not downloaded twice: an Already on NAS receipt links directly to preview, file download, and details. Jobs restored after a container restart remain labeled in the queue.
  3. Use Files & History to switch between compact list and thumbnail grid views. The default sort is newest downloaded first.
  4. Search with the Search button or Enter, then move through results with 20-item page buttons.
  5. Preview video or audio directly, or select an item to open its source URL, metadata state, file details, and actions.
  6. For a subtitle file, open More → Subtitle QA, paste a verified reference transcript, optionally add comma-separated keywords, and run the comparison.

Local Content Search

Choose Subtitles beside the library search box to find a word or phrase in saved SRT, VTT, ASS or SSA files. Results show the matching text and time. When a matching video/audio file is unambiguous, select the time to play that moment; otherwise, read the subtitle without guessing a video. Read transcript loads more context in bounded pages. Files without subtitles are not content-searchable.

Search runs locally, with no AI account, API key, transcription or vector service. The same search and transcript tools are available through an optional search-only MCP connection.

Start with a saved subtitle file: Files & History → Subtitles → type a phrase → Search. Use Files again to search titles and filenames. This is literal phrase search, not semantic search or automatic transcription. Read transcript shows context; a timestamp plays only a uniquely associated video/audio file. If a file has no subtitles, download its subtitles first or place an authorized SRT/VTT/ASS/SSA sidecar beside it, then refresh the library. Search reports files it cannot read rather than silently claiming complete coverage.

For an AI client, open AI Connect, keep Search and read only, choose the whole library or one collection, and copy the one-time token into that client's private configuration. Ask it to search a short phrase, read the matching context, and cite the file and time. Collection access includes only explicit members, so add the subtitle as well as the video. Use Search and queue downloads only when you also want that client to submit downloads. Step-by-step guide That client can receive the results you authorize. Existing download/share flows do not depend on an AI client. These changes are on the development branch, not in the current published image.

Open Options to save thumbnail sidecars, choose the profile used when this device shares a URL to the installed PWA, or manage a bounded Netscape cookies file for restricted sources. Compatible MP4 requests H.264/AAC without silently falling back to another codec; Ask every time returns the shared URL to the composer instead of queueing it immediately. The share setting is stored in a signed, HTTP-only preference cookie on that device.

For a new download, Options → Filename offers original title, channel + title, or request date + title, with an optional custom title. Media IDs and extensions are always retained. The date is the NAS queue-request date, preserved on retry, not the video's publication date. Existing files are never renamed by this setting, and choosing a different name does not bypass duplicate detection.

On phones, search stays visible while Filters expands the less-used controls. Preview and download remain direct actions; More contains named deletion actions with confirmation. Idle activity takes less space. Failed items can open cookies settings or retry a different profile without pasting the URL again. Copy safe diagnostics includes only app/yt-dlp versions, status, failure category, profile, and storage state, never the source URL, filename, cookies, or raw logs.

Playlist Guard defaults a normal video URL containing a playlist parameter to Current video only. Pure playlist and channel URLs require an explicit First 10 or All items choice. Every completed output receives its own Files & History row.

Collections And AI Connect

Release 26.0906 adds Downloads, Collections, and AI Connect to the same authenticated dashboard. Existing download and metadata volumes remain compatible; keep both mounted when upgrading.

Open Collections → Collect URLs to preview a bounded set of direct media URLs, optionally filter by publication date, and approve the selected items once. Known out-of-range items cannot be included; unknown dates require an explicit selection. Previews expire after 30 minutes. Repeating an approved commit returns the same batch rather than queueing it twice.

New collection downloads go under /downfolder/collections/<immutable-slug--short-id>/. Existing files stay where they are and can be linked to several collections without copying. Collections show their purpose, date policy, folder, stored size, batch progress, and missing files. Renaming or removing a collection changes only organization metadata. Clearing history preserves files, collections, memberships, and batches.

Open AI Connect to create a named connection, copy its one-time token, and select client setup instructions. The MCP endpoint is https://YOUR_NAS/youtube-dl/mcp, on the same address and port as the dashboard. The normal image includes the official Python MCP SDK and an nginx front end; there is no extra container, published port, or MCP feature flag.

The AI client searches the web and proposes URLs; the NAS validates candidates, checks duplicates, and queues approved work. MCP exposes no file-deletion tool or arbitrary filesystem path. Use HTTPS or a VPN for remote access. See the MCP setup, API, and release-gate guide for client-specific configuration and the distinction between protocol coverage and native-client QA.

Library tools now return next_cursor and has_more so a client can inspect more than 500 stored files. Sorting uses recorded download time, not publication date; mounted-only files retain their filesystem modification time. AI Connect shows the last successful client authentication separately from server health, with usage timestamps recorded at most once per minute. See the 26.0922 validation record for tested clients and remaining coverage.

MCP connection, candidate preview, approval, and collection workflow

The short demonstration uses labelled synthetic local media, not real web research or a claim of native-client verification.

Subtitle QA

Subtitle QA reads the selected subtitle file directly from /downfolder and compares its spoken text with the reference transcript you provide. The result includes character accuracy (CRR), character error rate (CER), word error rate (WER), edit counts, and optional keyword preservation. Lower CER/WER and higher character accuracy are better.

The feature supports downloaded or mounted .srt, .vtt, .ass, and .ssa files. Reference text is processed only inside your NAS container and is not sent to an external service.

Mounted Files And Metadata

Files already present in /downfolder, including safe nested paths, are scanned into Files & History even if they were not downloaded by this app version. Those rows show Mounted folder and No metadata because source URL, channel, and quality details are not available.

Clearing history rows does not delete files. Kept files are reloaded from /downfolder and shown again as mounted files. Use the file delete action only when you want to remove the physical file.

Safe Queue And Restart Recovery

The active request and waiting jobs are written atomically to queue_state.json in the metadata volume. After a container restart, the interrupted active request is restored first, followed by the remaining queue in its original order. yt-dlp --continue reuses compatible partial files from /downfolder/.incomplete; whether a remote source can resume the exact byte range depends on that source.

Equivalent URLs with share-tracking parameters removed are not queued twice with the same download profile and options. After metadata extraction, the stable extractor and media ID provide a second duplicate check against files already on the NAS. A repeated completion for the same physical file reuses its existing history row and original download timestamp. Failed and canceled history items remain retryable. Safe failure categories appear only in item details; private URLs, credentials, cookie contents, and mounted paths are not persisted as diagnostics. Send "force": true through the REST API only when overwriting an existing download is intentional.

When a request becomes active, Smart Preflight starts metadata inspection and a three-second minimum start window at the same time. A slow metadata response does not add another three-second delay. Undo during this phase removes the request without creating a canceled history row. If the extracted media identity matches an existing file, transfer is skipped and the dashboard keeps an actionable receipt for one minute. When metadata cannot be read, the dashboard shows a warning and still lets yt-dlp attempt the requested download.

The dashboard warns when the download volume has 10 GiB or less free and pauses new queue additions at 2 GiB or less by default. Existing and active jobs are not deleted. Adjust these thresholds with YDLNAS_STORAGE_WARNING_GB and YDLNAS_STORAGE_CRITICAL_GB, or set either value to 0 to disable that threshold.

Mount /usr/src/app/metadata persistently to retain the safe queue across container replacement. The queue remains intentionally file-backed and does not require a database.

Quick Start

Docker Compose is the recommended installation because it preserves both downloads and application state:

cp .env.example .env
docker compose up -d

Edit .env before starting and set at least MY_ID and MY_PW. Downloads are stored in ./downloads; queue state, history, terms acceptance, and the session secret are stored in ./config.

The equivalent docker run command is:

docker run -d \
  --name youtube-dl-nas \
  --restart unless-stopped \
  -e MY_ID=nas-user \
  -e MY_PW=change-this-password \
  -v /volume2/youtube-dl:/downfolder \
  -v /volume2/docker/youtube-dl-nas:/usr/src/app/metadata \
  -p 8080:8080 \
  modenaf360/youtube-dl-nas

Open http://localhost:8080, sign in with MY_ID / MY_PW, accept the Terms of Use on first launch, and submit a URL.

Time Zone

docker run -d \
  --name youtube-dl-nas \
  --restart unless-stopped \
  -e TZ=Asia/Seoul \
  -e MY_ID=nas-user \
  -e MY_PW=change-this-password \
  -v /volume2/youtube-dl:/downfolder \
  -v /volume2/docker/youtube-dl-nas:/usr/src/app/metadata \
  -p 8080:8080 \
  modenaf360/youtube-dl-nas

Host Network With Custom App Port

docker run -d \
  --name youtube-dl-nas \
  --restart unless-stopped \
  --net=host \
  -e APP_PORT=9999 \
  -e MY_ID=nas-user \
  -e MY_PW=change-this-password \
  -v /volume2/youtube-dl:/downfolder \
  -v /volume2/docker/youtube-dl-nas:/usr/src/app/metadata \
  modenaf360/youtube-dl-nas

Docker Options

Option Description
-v host:/downfolder Required persistent download volume. Keep the guest path as /downfolder.
-v host:/usr/src/app/metadata Recommended persistent state volume for the restart-safe queue, history, terms acceptance, and signed sessions.
-p host:guest Port forwarding. The app defaults to 8080.
-e MY_ID Required login ID. Avoid values starting with !, $, or &.
-e MY_PW Required login password. Avoid values starting with !, $, or &.
-e MY_ID_FILE Advanced alternative: read the login ID from one mounted secret file. MY_ID wins when both are set.
-e MY_PW_FILE Advanced alternative: read the login password from one mounted secret file. MY_PW wins when both are set.
-e TZ Optional container time zone, for example Asia/Seoul.
-e APP_PORT Optional app port. Defaults to 8080.
-e PROXY Optional proxy value passed to yt-dlp. Defaults to empty.
-e PUID, -e PGID Optional numeric owner for new download and state files. Defaults to 0.
-e UMASK Optional file creation mask. Defaults to 022.
-e YTDLP_AUTO_UPDATE Keep the startup and scheduled yt-dlp updater enabled. Defaults to true.
-e YTDLP_UPDATE_INTERVAL Updater interval in seconds. Defaults to 3600, with a minimum of 300.
-e NLPTUTTI_AUTO_UPDATE Install or upgrade nlptutti once whenever a new container starts. Defaults to true.
-e NLPTUTTI_UPDATE_TIMEOUT Maximum runtime package-update duration in seconds. Defaults to 180.
-e YTDLP_COOKIES_FILE Optional path to a mounted Netscape-format cookies file.
-e YTDLP_EXTRA_ARGS Optional administrator-controlled extra arguments parsed with shell-style quoting.
-e YDLNAS_ALLOW_PRIVATE_SOURCES Advanced opt-in for downloads from private or local network addresses. Defaults to false.
-e YDLNAS_STORAGE_WARNING_GB Free-space warning threshold in GiB. Defaults to 10; set 0 to disable.
-e YDLNAS_STORAGE_CRITICAL_GB Free-space threshold that pauses new queue additions. Defaults to 2; set 0 to disable.
-e YDLNAS_MCP_BATCH_LIMIT Maximum candidates per MCP or dashboard collection preview. Defaults to 25, clamped to 1–100.
-e YDLNAS_API_TOKEN Optional Bearer token for integrations. Normal ID/password API authentication remains available.
-e YDLNAS_API_TOKEN_FILE Advanced alternative: read the optional Bearer token from one mounted secret file. The direct variable wins when both are set.
-e YDLNAS_WEBHOOK_URL Optional webhook URLs, separated by commas or spaces, notified when downloads finish. See Notifications.
-e YDLNAS_WEBHOOK_URL_FILE Advanced alternative: read the webhook URLs from one mounted secret file. The direct variable wins when both are set.
-e YDLNAS_WEBHOOK_EVENTS Outcomes that notify: any of completed, failed, canceled (a running download stopped from the dashboard), skipped (a collection item outside its date range). Defaults to completed,failed.
-e COOKIE_SECURE Set to true when the dashboard is served exclusively over HTTPS.
-e YDLNAS_SESSION_MAX_AGE_DAYS Days a signed-in dashboard session stays valid; active devices renew automatically and any ID or password change signs every device out. Defaults to 30; set 0 to keep sessions until the secret rotates.
-e YDLNAS_TRUSTED_PROXIES Comma-separated IPs or CIDRs of reverse proxies in front of the container, for example the Synology reverse proxy. Sign-in throttling then keys on the real client address behind them instead of sharing one limit for everyone. Empty by default.
-e YDLNAS_TRUSTED_ORIGINS Comma-separated public origins such as https://nas.example.com that may submit dashboard actions when a reverse proxy does not forward Host, X-Forwarded-Host, or X-Forwarded-Proto. Empty by default.

Docker Compose Secrets

Environment variables remain the simplest choice for Synology and other NAS interfaces. Advanced Compose deployments can mount one secret per file and point the matching _FILE variable at /run/secrets/...:

services:
  youtube-dl-nas:
    environment:
      MY_ID_FILE: /run/secrets/ydlnas_id
      MY_PW_FILE: /run/secrets/ydlnas_password
      YDLNAS_API_TOKEN_FILE: /run/secrets/ydlnas_api_token
    secrets:
      - ydlnas_id
      - ydlnas_password
      - ydlnas_api_token

secrets:
  ydlnas_id:
    file: ./secrets/id.txt
  ydlnas_password:
    file: ./secrets/password.txt
  ydlnas_api_token:
    file: ./secrets/api-token.txt

Leave the corresponding direct variable empty when using its file form. A non-empty direct variable always takes precedence. Startup stops with a concise error when a requested file is missing, unreadable, not a regular file, or empty; secret values are never printed.

Cookies For Restricted Sources

Signed-in administrators can open dashboard Options to upload, replace, or remove an app-managed Netscape cookies file. The file is limited to 1 MiB, validated before replacement, stored as 0600 in the persistent metadata volume, and never returned by the API or printed in diagnostics. Cookies can grant account access, so export them only for sites and accounts you are authorized to use.

YTDLP_COOKIES_FILE remains supported for an externally mounted file. When it is set, the dashboard reports only whether that file is readable and treats it as read-only; the external setting takes precedence over the app-managed file.

Mobile Sharing

Watch a real Galaxy Z Flip share a YouTube link to the NAS, then play the saved file

Watch the 25-second demo · MP4 · GIF

Real Galaxy Z Flip footage: YouTube Share → HTTP Shortcuts → a completed NAS download with its timestamp → playback in the mobile browser. The shortcut was configured beforehand; the recording is edited for brevity and personal details are hidden. Recorded on 26.0922, not a new release or an HTTPS PWA demonstration. Demo footage: Big Buck Bunny, Blender Foundation, CC BY 3.0; cropped excerpts. (c) copyright 2008, Blender Foundation / www.bigbuckbunny.org.

  • Android over HTTPS: install the dashboard as a PWA, choose a Mobile share default under Options, then select youtube-dl NAS from the Android share sheet.
  • Android over local HTTP: import the provided HTTP Shortcuts template, run 1. Configure NAS once, and enter the normal dashboard URL, ID, password, and default profile.
  • iPhone/iPad: install the signed Download to NAS Shortcut and answer its one-time NAS URL, login, and default-profile questions. No action editing is required.

See the mobile sharing guide or the source in docs/mobile. No relay server is used; the phone sends URLs directly to the NAS. GitHub Pages only hosts the manual and import files.

Immediate mobile profiles keep the one-share workflow: the NAS queues the URL, runs Smart Preflight, and starts automatically. No second confirmation screen is added. Playlist Guard and Ask every time continue to open the composer only when an explicit choice is required.

Desktop Bookmarklet

Open Options in the dashboard and drag Send to youtube-dl-nas to the browser's bookmarks bar. Clicking that bookmark on any page opens the dashboard in a small window with the page URL already in the composer. Choose a profile and submit it as usual.

  • The bookmarklet stores only the dashboard address. It holds no ID, password, or token; the browser's normal dashboard session signs the request in, and an expired session goes through the usual login first.
  • Opening the bookmarklet address never queues anything by itself, because any site could open that address too. The URL waits in a signed ten-minute cookie and is queued only when you submit it from the dashboard.
  • Drag it from the address you normally use, such as https://nas.example.com or http://192.168.1.10:8080. The page URL travels in the query string, so it can appear in your own NAS or reverse-proxy access log. The #fragment is never sent, because it can hold access tokens or share-link keys.
  • Page URLs longer than 2 KB are refused with a message instead of being prefilled.

Notifications

Set YDLNAS_WEBHOOK_URL to get a message when a download finishes or fails. Several URLs can be separated by commas or spaces. The format follows the host:

URL Message
https://discord.com/api/webhooks/... Discord content message, mentions disabled
https://hooks.slack.com/services/... Slack text message
https://ntfy.sh/<topic> ntfy push with a title and tag
https://api.telegram.org/bot<token>/sendMessage?chat_id=<id> Telegram message; chat_id is required
anything else JSON document with event, text, count, items, app, version, sent_at

A self-hosted service takes a format prefix, for example ntfy+http://192.168.1.20:8090/nas or slack+https://chat.example.com/hooks/.... The JSON document's text field already suits Mattermost, Rocket.Chat, and similar Slack-compatible servers, and Home Assistant or n8n can read its items. A protected ntfy topic can use ntfy+https://user:[email protected]/topic; the credentials are sent as HTTP Basic authentication.

  • A playlist download sends one message for the whole job. The chat text names the first five titles, and the JSON items array lists up to 20. Each collection item is its own job, so it sends its own message.
  • canceled means a running download stopped from the dashboard. skipped means a collection item outside its date range, or one whose upload date could not be read. Removing a waiting job or undoing during Smart Preflight writes no history row and sends nothing.
  • Each URL has its own background queue. Network errors, HTTP 429, and 5xx get two retries, and 429 waits for Retry-After up to 60 seconds. A slow or offline webhook never delays downloads or the other webhooks.
  • Redirects are not followed, because a redirected POST would arrive as an empty GET. Use the final https:// address; the log names the redirect status.
  • Webhook URLs often contain tokens. Logs show only the host, and the URL is withheld from the MCP, nginx, and updater processes and from yt-dlp. YDLNAS_WEBHOOK_URL_FILE reads it from a mounted secret file instead; like the other secret files, a missing or empty file stops startup.
  • Unknown names in YDLNAS_WEBHOOK_EVENTS are ignored with a [webhook] warning, and the default applies when no valid name remains.
  • Requests go out directly or through the standard HTTPS_PROXY/HTTP_PROXY variables, not the yt-dlp PROXY setting.

Send a test message after changing the setting:

docker exec <container> python /usr/src/app/webhooks.py --test

REST API

Queue a Download

curl -X POST http://localhost:8080/youtube-dl/rest \
  -H 'Content-Type: application/json' \
  -d '{
    "url": "https://www.youtube.com/watch?v=s9mO5q6GiAc",
    "resolution": "best",
    "playlist_mode": "single",
    "write_thumbnail": false,
    "id": "iamgroot",
    "pw": "1234"
  }'

Successful response:

{
  "success": true,
  "queued": true,
  "duplicate": false,
  "code": "queued",
  "profile": "best",
  "queue_position": 2,
  "queue_count": 2,
  "msg": "Added best to the NAS queue at position 2.",
  "Remaining downloading count": "2"
}

The ID/password fields remain the default integration method. When YDLNAS_API_TOKEN is configured, advanced clients may omit them and send:

curl -X POST http://localhost:8080/youtube-dl/rest \
  -H 'Authorization: Bearer your-token' \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://youtu.be/s9mO5q6GiAc","resolution":"best"}'

The API returns "duplicate": true without adding another job when the same URL, profile, and options are already queued or saved on the NAS. Add "force": true only when an intentional repeat download is required.

playlist_mode accepts single, first10, or all. It defaults to single for normal URLs and video URLs that also contain a playlist parameter. Pure playlist and channel URLs require an explicit value so an unbounded download cannot start accidentally. Set write_thumbnail to true to save a converted JPG beside each video or audio file.

For a YouTube URL containing t, start, or time_continue, set section_mode to from_timestamp to download from that shared position; omit it or use full for the whole item. Smart mobile clients can authenticate and POST shared text to /youtube-dl/share/context first. That endpoint extracts the first URL and reports whether profile, playlist-scope, or timestamp choices are relevant before the final queue request.

Queue receipts and errors retain the English msg field for existing integrations and also include stable code values. Receipts expose the selected profile and queue position; errors may include interpolation or choice params. The dashboard uses those fields to show errors in the selected language.

Optional naming fields on /youtube-dl/rest and /youtube-dl/api/v1/downloads: filename_style accepts default, channel-title, or date-title; filename_title accepts a plain title (at most 80 characters / 160 UTF-8 bytes), not a path or yt-dlp template. Omit both to preserve the existing behavior. MCP enqueue_download accepts the same fields. They do not rename or replace an existing matching file. Naming for bulk collection previews remains unchanged.

Supported resolution examples:

  • best
  • compatible-mp4 for H.264 video plus AAC audio in an MP4 container
  • 2160p, 1440p, 1080p, 720p, 480p, 360p, 240p, 144p
  • audio-m4a, audio-mp3, audio-opus
  • vtt|en, vtt|ko, srt|en, srt|ko

Authenticated Dashboard APIs

These endpoints are used by the web UI and require a valid login cookie:

Endpoint Method Purpose
/youtube-dl/status GET Read the active download, live transfer details, ordered queue, connected clients, and safe storage-capacity status.
/youtube-dl/preferences GET, POST Read or update the signed per-device PWA share profile.
/youtube-dl/q/<job_id>/remove POST Remove a waiting job before it becomes active.
/youtube-dl/q/active/cancel POST Stop the active job, retain compatible partial data, and continue with the next queued job.
/youtube-dl/history GET Read normalized download history plus mounted /downfolder files that are not in metadata yet.
/youtube-dl/history/retry/<uuid> POST Queue a previous history item again.
/youtube-dl/history/delete/<uuid> POST Delete the history row only.
/youtube-dl/history/delete-file/<uuid> POST Delete the physical file and related history rows.
/youtube-dl/history/clear POST Clear history rows while keeping downloaded files.
/youtube-dl/subtitle-qa/<uuid> POST Compare a stored SRT/VTT/ASS/SSA file with a reference transcript using nlptutti.
/static/preview/<uuid> GET Stream an existing video or audio file inline for the authenticated preview player.
/static/thumbnail/<uuid> GET Serve a saved thumbnail sidecar to the authenticated dashboard.

Local Development

Install dependencies:

pip install -r requirements.txt
pip install -r requirements-dev.txt

Prepare Auth.json with local credentials, then run:

python youtube-dl-server.py

The app reads APP_PORT from Auth.json; the default is typically 8080 when substituted by the container entrypoint.

Useful checks before committing:

python3 -m py_compile youtube-dl-server.py
node --check static/logical_js/logic.js
pytest -q
docker compose --env-file .env.example config
git diff --check
docker build -t youtube-dl-nas:local .

Container Build And Publishing

Build locally:

docker build -t youtube-dl-nas:local .

Run the local image:

docker run --rm \
  -e MY_ID=tester \
  -e MY_PW=secret \
  -v "$PWD/downfolder:/downfolder" \
  -v "$PWD/metadata:/usr/src/app/metadata" \
  -p 8080:8080 \
  youtube-dl-nas:local

The GitHub Actions workflow builds and starts the Docker image for pull requests, verifies the live /health response and sign-in page, and publishes nothing. A version tag repeats that runtime smoke test before publishing multi-architecture linux/amd64 and linux/arm64 images to both Docker Hub (modenaf360/youtube-dl-nas) and GHCR (ghcr.io/hyeonsangjeon/youtube-dl-nas). One tag build updates latest, the pinned release tag, and its immutable sha- tag together.

Manual workflow runs default to smoke-only mode. The smoke compares image size and idle process RSS with the previous release on the same platform; growth above 100 MB or 75 MB respectively blocks publication for review. The GitHub release waits for that tag's successful image publication. 26.0906 has a bounded RSS design review: its first measurement was 157 MB total idle RSS, 107 MB above the previous release. This overhead is disclosed, not reported as passing the 75 MB trigger.

Configure these repository secrets before publishing to Docker Hub:

  • DOCKERHUB_USERNAME
  • DOCKERHUB_TOKEN

GHCR publishing uses the workflow's built-in GITHUB_TOKEN; no additional registry secret is required.

That keeps pull requests build-verified and avoids rebuilding the same release once for the merge and again for the tag.

Architecture

The application runs inside one Debian-based Python container. nginx owns the public port and routes browser, REST, WebSocket, and MCP requests to loopback-only Bottle/gevent and MCP ASGI services. Bottle remains the sole writer for the single-worker queue and atomic JSON state. Completed files are written below /downfolder, including immutable collection directories.

The supervisor stops the container when a core service or the enabled updater daemon dies. A fatal worker persistence error makes health unavailable and terminates the web process so restart recovery uses durable queue state. Startup package checks may fail without blocking the application; the updater checks yt-dlp and matching EJS components hourly by default and attempts nlptutti installation or upgrade at each container start. Deno supplies the JavaScript runtime used by current YouTube extraction challenges.

youtube-dl-nas architecture

Synology Notes

When using Synology Container Manager or Docker UI, mount a download folder to /downfolder, mount a configuration folder to /usr/src/app/metadata, and set MY_ID, MY_PW, and optional environment variables in the container settings. Use compose.yaml as a Container Manager project when available.

Volume setup:

volume setting

ID and password setup:

id password setting

Legal Disclaimer

This tool is based on yt-dlp and is provided solely for personal and legitimate use in accordance with applicable laws. Users are responsible for complying with copyright laws. Downloading or distributing copyrighted material without permission from the rightsholder may violate applicable laws.

This project does not encourage or support unauthorized use. The developer bears no legal responsibility for unauthorized or illegal use by users.

Release Notes

Full release history lives in CHANGELOG.md. Focused follow-up work is tracked in the public youtube-dl-nas Roadmap.

Explore related projects

Loading…