[utils] YoutubeDLCookieJar: Detect and reject JSON file (#3599)
Authored by: Lesmiscore
This commit is contained in:
parent
07689fc149
commit
94aa064497
1 changed files with 4 additions and 0 deletions
|
@ -1507,6 +1507,10 @@ class YoutubeDLCookieJar(compat_cookiejar.MozillaCookieJar):
|
||||||
try:
|
try:
|
||||||
cf.write(prepare_line(line))
|
cf.write(prepare_line(line))
|
||||||
except compat_cookiejar.LoadError as e:
|
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')
|
write_string(f'WARNING: skipping cookie file entry due to {e}: {line!r}\n')
|
||||||
continue
|
continue
|
||||||
cf.seek(0)
|
cf.seek(0)
|
||||||
|
|
Loading…
Reference in a new issue