cookie-quick-manager icon indicating copy to clipboard operation
cookie-quick-manager copied to clipboard

Netscape format not working with youtube-dl

Open alitajelsir opened this issue 4 years ago • 4 comments

  • I get the following error http.cookiejar.LoadError: 'Downloads/cookies.txt' does not look like a Netscape format cookies file when using the cookies file downloaded in a Netscape format. This is working fine with extensions like cookies.text and Export Cookies.
  • Running the latest version in Firefox 77
  • I don't know if it would be beneficial, but this is the error output from youtube-dl:
Traceback (most recent call last):
  File "/usr/bin/youtube-dl", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/youtube_dl/__init__.py", line 474, in main
    _real_main(argv)
  File "/usr/lib/python3.8/site-packages/youtube_dl/__init__.py", line 441, in _real_main
    with YoutubeDL(ydl_opts) as ydl:
  File "/usr/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 419, in __init__
    self._setup_opener()
  File "/usr/lib/python3.8/site-packages/youtube_dl/YoutubeDL.py", line 2329, in _setup_opener
    self.cookiejar.load(ignore_discard=True, ignore_expires=True)
  File "/usr/lib/python3.8/site-packages/youtube_dl/utils.py", line 2840, in load
    self._really_load(cf, filename, ignore_discard, ignore_expires)
  File "/usr/lib/python3.8/http/cookiejar.py", line 2020, in _really_load
    raise LoadError(
http.cookiejar.LoadError: 'Downloads/cookies.txt' does not look like a Netscape format cookies file

alitajelsir avatar Jul 01 '20 06:07 alitajelsir

I suspect it has something to do with this: https://stackoverflow.com/a/11536599

At least for me, the header is missing in exported files and that's what caused problems with youtube-dl.

TpmKranz avatar Jul 29 '20 12:07 TpmKranz

Just had the same issue and came here to report. Indeed, the info in that SO question did the trick.

The file exported by the extension is missing the first line, which should be either

# HTTP Cookie File

or

# Netscape HTTP Cookie File

Adding that as the first line of the file makes it work with youtube-dl.

fmorato avatar Jul 29 '20 18:07 fmorato

I wish this add-on had the option to insert that comment line since most of the programs that use this format look for that header...

Another thing that causes issues are the www lines that have a leading '.' ex: .www.somesite.com

TFWol avatar Jan 18 '22 17:01 TFWol

youtube-dl only accepts tabs rather than spaces. This will also cause the issue. ref: --cookies: be more flexible in the file format · Issue #4539 · ytdl-org/youtube-dl

Explorare avatar Aug 27 '22 08:08 Explorare