0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-25 02:45:12 +00:00

[utils] YoutubeDLCookieJar: Detect and reject JSON file (#3599)

Authored by: Lesmiscore
This commit is contained in:
Lesmiscore 2022-05-01 00:38:30 +09:00 committed by GitHub
parent 07689fc149
commit 94aa064497
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View 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)