Skip to content

Commit

Permalink
Stop saving cookies_file when use_cookies=False
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Feb 11, 2023
1 parent 63fa100 commit 752d303
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions gdown/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,15 @@ def download(
print(e, file=sys.stderr)
return

# Save cookies
with open(cookies_file, "w") as f:
cookies = [
(k, v)
for k, v in sess.cookies.items()
if not k.startswith("download_warning_")
]
json.dump(cookies, f, indent=2)
if use_cookies:
# Save cookies
with open(cookies_file, "w") as f:
cookies = [
(k, v)
for k, v in sess.cookies.items()
if not k.startswith("download_warning_")
]
json.dump(cookies, f, indent=2)

if "Content-Disposition" in res.headers:
# This is the file
Expand Down

0 comments on commit 752d303

Please sign in to comment.