-
-
Notifications
You must be signed in to change notification settings - Fork 1
Using your cookies in yt‐dlp
yt-dlp often requires a valid cookie to download content from YouTube. Similarly, downloading from 𝕏 (Twitter) requires cookies if the post is from a private account.
Current supported browsers for yt-dlp:
- firefox
- edge
- chrome
- chromium
- opera
- safari
- brave
- vivaldi
- whale
For an up-to-date list, check the --cookies-from-browser section in the official repository.
yt-dlp can extract cookies directly from a browser, profile, or container. For more details, refer to the yt-dlp FAQ.
It is highly recommended to use Firefox. Chromium-based browsers (Edge, Chrome, Brave, etc.) often encrypt cookie databases or prevent easy access, which can prevent yt-dlp from reading them easily. See this issue for technical context.
Creating a dedicated Firefox profile for yt-dlp is the most secure and efficient method:
- Security: It isolates your main browsing data.
- Performance: yt-dlp loads cookies faster from a smaller, specific profile.
- Maintenance: If a cookie expires, simply open this profile, log in again, and close it.
Example Setup:
If you created a Firefox profile named Youtube:
- On Windows, go to
%appdata%\Mozilla\Firefox\Profiles. - Identify the folder name (e.g.,
oo49eawy.Youtube). - In your
yt-download.ps1script (around line 42), configure it as follows:
New-Variable -Name UseBrowser -Value $true -Option Constant
# Format: "browser:profile_directory_name"
New-Variable -Name browserCookies -Value "firefox:oo49eawy.Youtube" -Option ConstantCaution
This method is discouraged for security reasons. Please read the Security section below before proceeding.
If you must use a standalone file, you can export cookies using the terminal:
yt-dlp --cookies-from-browser firefox --cookies cookies.txtIf yt-dlp fails to access the browser data directly, use these verified extensions:
- Firefox: cookies.txt. Tip: Use the "Current container and site" option to avoid bugs.
- Chromium/Edge: Get cookies.txt LOCALLY.
If you use a cookies.txt file, store it in a secure location (e.g., your Documents folder or an encrypted drive) and update your yt-download.ps1 script:
New-Variable -Name UseBrowser -Value $false -Option Constant
New-Variable -Name myCookies -Value "C:/path/to/your/secure/cookies.txt"-
Privacy: A
cookies.txtfile contains sensitive session tokens. If stolen, an attacker can hijack your active sessions without needing your password. - Minimalism: Always edit the file to remove cookies for unrelated websites. Only keep the strictly necessary entries.
- Protection: Enable Two-Factor Authentication (2FA) on all accounts used with these cookies.
- Access Control: Ensure the file is only readable by your user account or administrator.
- (Optional but recommended) Install a Nerd Font
- Using Windows Terminal
- (Optional but recommended) Install UniGetUI
- Install Powershell 7
- Allow Powershell scripts to run
-
Install
yt-dlpandffmpegcommands on your OS globally - Install Tampermonkey on your browser
- 🛠️ Configuration: yt-download.ps1
- 🚀 Usage via Terminal
- 🌐 Browser Integration (Userscript)
- TIPS: Run the script as a command from everywhere