Authentication Methods
yt-dlp supports multiple authentication approaches:- Netrc File
- Command Line
- Certificates
Store credentials in a
.netrc file for automatic authenticationUsing Netrc Files
The.netrc file is a standard way to store credentials for automatic login.
Creating a Netrc File
Netrc File Format
Add credentials in this format:<extractor> is the lowercase name of the extractor.
Example Netrc File
Enabling Netrc Authentication
Activate netrc authentication with the--netrc flag:
The default netrc location is
~/.netrc on Linux/macOS and %USERPROFILE%\_netrc or %USERPROFILE%\.netrc on Windows.Netrc in Configuration File
Add to your yt-dlp config to always use netrc:Encrypted Netrc with GPG
For enhanced security, encrypt your netrc file:Create Encrypted Netrc
Use Encrypted Netrc
Use--netrc-cmd to decrypt on-the-fly:
Custom Netrc Command
The--netrc-cmd can execute any command that outputs credentials in netrc format:
{} placeholder is replaced with the extractor name.
The command must:
- Output credentials in netrc format
- Return exit code 0 on success
- Return non-zero on failure
Browser Cookies
Extract and use cookies from your browser to authenticate:Supported Browsers
bravechromechromiumedgefirefoxoperasafarivivaldiwhale
Cookie Extraction Syntax
- Basic Usage
- Specific Profile
- Linux Keyring
- Firefox Container
Cookie File Export
You can also export cookies to a file:Browser cookie extraction requires the browser to be closed or may require additional permissions on some systems.
Command Line Authentication
Provide credentials directly via command line:Basic Authentication
Two-Factor Authentication
Video-Specific Password
Some videos require a specific password:Providing passwords on the command line is less secure as they may be visible in shell history. Use netrc files or be prompted for passwords instead.
Adobe Pass Authentication
For sites using Adobe Pass (TV provider authentication):Client Certificates
For sites requiring SSL/TLS client certificates:Certificate File
Separate Key File
Encrypted Private Key
Practical Examples
Configuration File Setup
Set authentication options in your config file:Security Best Practices
Secure Netrc Files
Avoid Command Line Passwords
Browser Cookie Security
When using
--cookies-from-browser, be aware that:- Cookies contain session tokens that could be hijacked
- Some sites may track unusual activity
- Consider using a dedicated browser profile for downloads