aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLesmiscore <nao20010128@gmail.com>2022-05-01 00:38:30 +0900
committerGitHub <noreply@github.com>2022-05-01 00:38:30 +0900
commit94aa064497122084c68f5f366c4c0ad5ea082485 (patch)
tree7bd599a3568788125969e06405e9e17c3e5060e0
parent07689fc149698d74368eeccfe583824a963b973d (diff)
downloadhypervideo-pre-94aa064497122084c68f5f366c4c0ad5ea082485.tar.lz
hypervideo-pre-94aa064497122084c68f5f366c4c0ad5ea082485.tar.xz
hypervideo-pre-94aa064497122084c68f5f366c4c0ad5ea082485.zip
[utils] YoutubeDLCookieJar: Detect and reject JSON file (#3599)
Authored by: Lesmiscore
-rw-r--r--yt_dlp/utils.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index 35426568b..3b75ab6b3 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -1507,6 +1507,10 @@ class YoutubeDLCookieJar(compat_cookiejar.MozillaCookieJar):
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)