未验证 提交 94aa0644 编写于 作者: L Lesmiscore 提交者: GitHub

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

Authored by: Lesmiscore
上级 07689fc1
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册