MacOS – How to use youtube-dl –cookies

cookiesmacosvideoyoutube

How do I use the --cookies option to youtube-dl to download a Youtube video? Can anyone provide a worked example of how to obtain the relevant cookies for Youtube and put it in the appropriate format for youtube-dl?

Context: I want to download a private Youtube video. For various reasons, the method of logging into my Google account is complicated and involves two-factor authentication and not supported by youtube-dl's existing command-line options. Therefore, it seems the best way is to log in manually in my browser, obtain the authentication cookies somehow, and use the --cookies option — but I can't find a worked example of how to do this.

Best Answer

Once you get the cookies, you only need to run youtube-dl --cookies /pathtocookiefile

If you use Chrome and accept third-party plugins to read your cookies.
Just try this cookie.txt,open the youtube then click cookie.txt plugin.
One more click ,you can download the cookie file for one tab or all. enter image description here

If you want do it manual in Chrome. F12 > Application > Storage > Cookies.
You need convert cookie list to Netscape format cookies file

#domain          HTTP/Secure    Expires      Name Value  
.youtube.com     TRUE/FALSE    1548523767    GPS    1