]> jfr.im git - yt-dlp.git/commitdiff
[utils] YoutubeDLCookieJar: Detect and reject JSON file (#3599)
authorLesmiscore <redacted>
Sat, 30 Apr 2022 15:38:30 +0000 (00:38 +0900)
committerGitHub <redacted>
Sat, 30 Apr 2022 15:38:30 +0000 (00:38 +0900)
Authored by: Lesmiscore

yt_dlp/utils.py

index 35426568b8b48c9c1c5845a4fe455ecaaac40a90..3b75ab6b3cff2df96046b3fa527c8555380c9e78 100644 (file)
@@ -1507,6 +1507,10 @@ def prepare_line(line):
                 try:
                     cf.write(prepare_line(line))
                 except compat_cookiejar.LoadError as e:
+                    if f'{line.strip()} '[0] in '[{"':
+                        raise compat_cookiejar.LoadError(
+                            'Cookies file must be Netscape formatted, not JSON. See  '
+                            'https://github.com/ytdl-org/youtube-dl#how-do-i-pass-cookies-to-youtube-dl')
                     write_string(f'WARNING: skipping cookie file entry due to {e}: {line!r}\n')
                     continue
         cf.seek(0)