Skip to content

feat: YouTube downloader cookie support, JS runtime, 720p limit#407

Open
fivedang wants to merge 1 commit into
JefferyHcool:masterfrom
fivedang:feat/youtube-downloader-enhancements
Open

feat: YouTube downloader cookie support, JS runtime, 720p limit#407
fivedang wants to merge 1 commit into
JefferyHcool:masterfrom
fivedang:feat/youtube-downloader-enhancements

Conversation

@fivedang

Copy link
Copy Markdown

Summary

Three enhancements to YoutubeDownloader for the Docker single-image deployment:

1. Cookie Support

The YouTube downloader previously ignored cookies configured in the settings page. This PR integrates CookieConfigManager (same pattern as BilibiliDownloader) to:

  • Read cookies from the settings page (config/downloader.json)
  • Support both Netscape format (from browser extensions like "Get cookies.txt LOCALLY") and key=value format
  • Write a temporary Netscape cookiefile for yt-dlp
  • Resolves "Sign in to confirm you're not a bot" errors

2. JavaScript Challenge Solver

yt-dlp 2026+ requires a JavaScript runtime to solve YouTube's n challenge (nsig) and PO Token challenges. Previously, the container had no JS runtime, causing "n challenge solving failed" errors.

  • Added js_runtimes: {"node": {}} and remote_components: ["ejs:github"] to ydl_opts
  • Dockerfile now installs Node.js 22 (required; Node 18 is unsupported)
  • Dockerfile upgrades yt-dlp to latest (2025.03.31 → latest)

3. 720p Video Download Limit

download_video() previously used bestvideo[ext=mp4] (up to 4K). For screenshot extraction, 720p is sufficient and reduces file size by 5-10x.

  • Added max_height: int = 720 parameter with corresponding yt-dlp format string

Related

Three enhancements to YoutubeDownloader:

1. Cookie support — integrate CookieConfigManager to read YouTube cookies
   from the settings page (supports both Netscape format from browser
   extensions and key=value format), writes cookiefile for yt-dlp

2. JS challenge solver — add js_runtimes and remote_components to ydl_opts
   so yt-dlp can solve YouTube's nsig/PO Token challenges. Requires Node.js 22
   installed in the Docker image

3. 720p video limit — add max_height=720 parameter to download_video() for
   screenshot use cases, reducing file size significantly

Dockerfile.complete updated to install Node.js 22 and upgrade yt-dlp.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant