Synopsis
Export Netscape HTTP Cookie File from browser using the Get cookies.txt LOCALLY extension and pass the cookie path with --cookies
flag in yt-dlp
as authentication method.
Background
Possible and notable ways for authentication are plaintext --username
& --password
, --netrc
, and --cookies
(along with --cookies-from-browser
). Username and password method may be configured to use OAuth but that has been deprecated. While yt-dlp
supports the --cookies-from-browser
flag to extract cookies directly from installed browsers, it can encounter issues with Chromium-based browsers due to changes in their storage mechanisms (cookies locked, and DPAPI).
This can be mitigated by using Firefox, but the preferred method is the extract cookies for specific site locally and point to that file for yt-dlp
to use. This offers flexibility on choosing which account to use and simplifies the overall process.
Procedure
- Open a chromium browser (like Chrome or Edge)
- Install the extension Get cookies.txt LOCALLY
- Open
Incognito
orInPrivate
window and open the website requiring login - Sign in using preferred account
- Extract the cookies for that site using the extension installed earlier
- Save the cookie file at
%LOCALAPPDATA%/yt-dlp/cookies.txt
Usage
Pass the following flag when using yt-dlp
:
--cookies "%LOCALAPPDATA%/yt-dlp/cookies.txt"
References: