Skip to content

video_downloader: optional cookies_file input + enable node JS runtime#274

Open
MoonCaves wants to merge 1 commit into
calesthio:mainfrom
MoonCaves:video-downloader-cookies-node-runtime
Open

video_downloader: optional cookies_file input + enable node JS runtime#274
MoonCaves wants to merge 1 commit into
calesthio:mainfrom
MoonCaves:video-downloader-cookies-node-runtime

Conversation

@MoonCaves

Copy link
Copy Markdown
Contributor

Summary

youtube downloads via video_downloader currently fail on a lot of boxes — youtube now serves "Sign in to confirm you're not a bot" to anonymous requests (datacenter IPs get it consistently, residential increasingly too), and yt-dlp's n-challenge solving needs a JS runtime that isn't enabled by default when only node is installed. this PR adds an optional cookies_file input (netscape-format cookies.txt, passed through as yt-dlp's cookiefile) and enables node alongside deno in js_runtimes so the EJS challenge solver works on node-only machines. to be precise about the second part: the node runtime is enabled unconditionally (not only when cookies are passed) — yt-dlp's embedded API documents js_runtimes as a dict of runtimes to enable, defaulting to {'deno': {}} (yt_dlp/YoutubeDL.py lines 539–545 and 736), so on machines that have deno nothing changes, and on node-only machines the solver starts working instead of failing.

also adds /cookies.txt (anchored to repo root) to .gitignore so nobody accidentally commits their session cookies to a fork.

Related issue

Refs # (none found — happy to open one first if you prefer)

Changes

  • tools/analysis/video_downloader.py: new optional cookies_file input on the schema, threaded through metadata extraction, video/audio/subtitle download paths via a shared _common_ydl_opts; js_runtimes now {"deno": {}, "node": {}}
  • .gitignore: ignore /cookies.txt at repo root

Testing

  • on a debian 12 server (datacenter IP, node 22, no deno): without cookies, downloads fail with youtube's bot-check; with a cookies.txt exported from a logged-in browser, metadata + video + audio + subtitles all succeed end-to-end
  • same box: without node in js_runtimes, formats fail with "n challenge solving failed" / "No video formats found"; with it, formats resolve

Checklist

  • The change is focused on a single logical concern.
  • I ran the relevant tests locally (make test-contracts / make test) where applicable. (contract suite on a clean checkout of main with only this change applied: 325 passed, 6 skipped)
  • I updated docs/README if behavior or usage changed. (the tool's schema description documents the new input; happy to add a README note if wanted)
  • No unrelated files (build artifacts, local config) are included in the diff.

YouTube now serves "Sign in to confirm you're not a bot" to anonymous
requests (consistently on datacenter IPs), and yt-dlp's n-challenge
solver needs a JS runtime it only auto-detects for deno. Add an
optional netscape-format cookies_file input (passed as yt-dlp
cookiefile) threaded through metadata/video/audio/subtitle paths, and
enable node alongside deno in js_runtimes (yt-dlp's embedded API
defaults to {'deno': {}}; enabling node is unconditional but inert on
machines that have deno). Also ignore /cookies.txt so session cookies
can't be committed by accident.

proofread by fable 5 + codex
@MoonCaves MoonCaves requested a review from calesthio as a code owner July 3, 2026 01:11
@MoonCaves MoonCaves force-pushed the video-downloader-cookies-node-runtime branch from 4063c4b to 49f8a2f Compare July 6, 2026 07:17
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