mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-23 02:25:11 +00:00
Improve cookie error handling
This commit is contained in:
parent
0e33684194
commit
229cac754a
1 changed files with 5 additions and 2 deletions
|
@ -290,10 +290,13 @@ def _real_main():
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
jar = compat_cookiejar.MozillaCookieJar(opts.cookiefile)
|
jar = compat_cookiejar.MozillaCookieJar(opts.cookiefile)
|
||||||
if os.path.isfile(opts.cookiefile) and os.access(opts.cookiefile, os.R_OK):
|
if os.access(opts.cookiefile, os.R_OK):
|
||||||
jar.load()
|
jar.load()
|
||||||
except (IOError, OSError) as err:
|
except (IOError, OSError) as err:
|
||||||
sys.exit(u'ERROR: unable to open cookie file')
|
if opts.verbose:
|
||||||
|
traceback.print_exc()
|
||||||
|
sys.stderr.write(u'ERROR: unable to open cookie file\n')
|
||||||
|
sys.exit(101)
|
||||||
# Set user agent
|
# Set user agent
|
||||||
if opts.user_agent is not None:
|
if opts.user_agent is not None:
|
||||||
std_headers['User-Agent'] = opts.user_agent
|
std_headers['User-Agent'] = opts.user_agent
|
||||||
|
|
Loading…
Reference in a new issue