Skip to main content
yt-dlp supports various authentication methods to access content that requires login credentials. This includes private videos, premium content, and age-restricted material.

Authentication Methods

yt-dlp supports multiple authentication approaches:
Store credentials in a .netrc file for automatic authentication

Using 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:
Where <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:
The {} 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

  • brave
  • chrome
  • chromium
  • edge
  • firefox
  • opera
  • safari
  • vivaldi
  • whale
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

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

Troubleshooting

Authentication Failures

Permission Errors

Extractor Names

Find the correct extractor name:

Advanced Authentication

Multiple Accounts

Conditional Authentication

Use shell scripting for conditional auth:

Session Management

Some sites require session tokens: