This is a very simple Node.js script to convert the cookies you can copy/paste from Chrome's Application -> Storage -> Cookies, into the Netscape cookies format accepted by tools like curl
and youtube-dl
.
It's useful because you don't have to install any browser extension in order to save or convert the cookies. Browser extensions are a known security risk.
- A terminal/command line window
- Node.js
-
Download the script (or clone this repo if you prefer)
-
In an editor, open a new blank file
-
In Chrome/Chromium, launch Developer Tools (F12)
-
Navigate to the site you need cookies from, e.g. YouTube, and log in.
-
Go to Application -> Storage -> Cookies
-
For each URL under Cookies (e.g.
https://www.youtube.com
), copy the table of cookies into the clipboard, then paste it at the end of the file you've opened in step 2. -
Save the file with a name like
file-with-cookies-copy-pasted-from-Chrome.txt
-
Run the script:
node convert-cookies.js file-with-cookies-copy-pasted-from-Chrome.txt > netscape-cookies.txt
Now, netscape-cookies.txt
will contain cookies ready to be used by any application that reads cookies in Netscape format (e.g. yotube-dl
or curl
).
Copyright © 2020 Dan Dascalescu.