Skip to content

Instantly share code, notes, and snippets.

View YoRyan's full-sized avatar

Ryan Young YoRyan

View GitHub Profile
@YoRyan
YoRyan / yt-dlp cookies.txt for YouTube.js
Last active June 4, 2026 03:08
Obtain cookies.txt for yt-dlp without external software or browser extensions. Tested with a Firefox private browsing session.
// This work is marked CC0 1.0 Universal.
// To view a copy of this mark, visit https://creativecommons.org/publicdomain/zero/1.0/
// 1. Watch a video
// 2. Open the network inspector, and pick a request to the www.youtube.com domain
// 3. Copy the value of the Cookie: request header and store it into a string
// variable named "cookies" on the JavaScript console
// cookies = "name=value; ..."
// 4. Run the code below to obtain the contents of cookies.txt
// 5. Pass it to yt-dlp with yt-dlp --cookies /path/to/cookies.txt