- 1 Export JSON from Chrome
CookieMan → Export → JSON Array for the current site. Session cookies must be included; they become expiry
0in Netscape. - 2 Convert to cookies.txt
Paste into the converter (output Netscape). Download the file. Tabs and the magic header are written for you.
- 3 Run wget
Use
--load-cookies cookies.txt --save-cookies cookies.txt --keep-session-cookieswhen you need the jar to still contain session tokens after the run.
The --keep-session-cookies trap
wget’s --save-cookies writes Netscape. Without --keep-session-cookies, rows with expiry 0 are omitted on write. Your next --load-cookies then has no session. curl does not have this default; wget does.
wget --load-cookies cookies.txt --save-cookies cookies.txt \
--keep-session-cookies \
https://example.com/dashboard
# wget2
wget2 --load-cookies cookies.txt --save-cookies cookies.txt \
--keep-session-cookies https://example.com/dashboard
wget versus curl on the same file
| Behaviour | curl | wget |
|---|---|---|
| Read Netscape | -b | --load-cookies |
| Write Netscape | -c | --save-cookies |
| Keep expiry 0 on write | Default keep | Requires --keep-session-cookies |
| HttpOnly prefix | Writes and reads #HttpOnly_ | Reads the same prefix |