Please note that I use the yt-dlp version, which is a fork of youtube-dl. However, out of habit, I continue to save and use it as youtube-dl
instead of yt-dlp
.
To download a private video, you need to be logged in; otherwise, you will encounter the following error:
$ youtube-dl https://www.youtube.com/shorts/oo1kIr4OQE
[youtube] Extracting URL: https://www.youtube.com/shorts/oo1kIr4OQE
[youtube] oo1kIr4OQE: Downloading webpage
[youtube] oo1kIr4OQE: Downloading ios player API JSON
ERROR: [youtube] oo1kIr4OQE: Private video. Sign in if you've been granted access to this video
Even with -u
option to pass the email, we are still unable to download the video.
$ youtube-dl https://www.youtube.com/shorts/oo1kIr4OQE -u [email protected]
Type account password and press [Return]:
WARNING: [youtube] Login with password is not supported for this website. Use --cookies-from-browser or --cookies for the authentication. See https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how-do-i-pass-cookies-to-yt-dlp for how to manually pass cookies
As stated in the warning above, the solution is to use existing cookies from the browser where your YouTube account is already logged in. In my case, I use Chrome:
$ youtube-dl --cookies-from-browser chrome https://www.youtube.com/shorts/oo1kIrx4OQE
Now, we can successfully download the private video. For further information, please refer to their documentation.