0

I want to get my cookies.txt for YouTube so that I can youtube-dl my liked videos playlist.

How can I get my cookies from Safari? Opening the web inspector just lets me view them, I can't see how to download the text file from here.

minseong
  • 8,824

1 Answers1

2

Safari cookies are located under ~/Library/Cookies. However, they're binary cookies, so you'll have to decode it to human-readable (Netscape equivalent) cookies.

To do so, you would have to install this tool and follow the instruction (I've never used it before, so I don't know if this still works.)

Personally, I'd rather just install Chrome (or a browser that uses Chromium, such as Vivaldi, etc) and use extensions like Get cookies.txt locally, though.

Skye-AT
  • 592
  • 1
    Is it just me, or is the folder empty now? (Safari, v16.0) – Alexandre Cassagne Oct 09 '22 at 14:01
  • @AlexandreCassagne At least on my MBP (Monterey 12.4, Safari 16.0) I have cookies. I think it's just you. – Skye-AT Oct 09 '22 at 16:49
  • 2
    It's empty for me as well on macOS 13.1 (Ventura) and Safari 16.2, and trying to run sudo ls ~/Library/Cookies gives "Operation not permitted" – Linus Unnebäck Mar 16 '23 at 10:33
  • I have cookies there (Safari 15.5; MacOS 10.15.7). – reallydismayed Nov 13 '23 at 15:53
  • @LinusUnnebäck You can get around the "Operation not permitted" by by going into System Preferences > Security & Privacy and giving Full Disk Access to Terminal. However, on my machine, after doing this, I've discovered that the folder is empty – Patrick Hund Feb 02 '24 at 08:19