Mercurial > codedump
changeset 53:ae64a0c8831b
Update kemonopartydownloader.py
committer: GitHub <noreply@github.com>
author | Paper <37962225+mrpapersonic@users.noreply.github.com> |
---|---|
date | Sat, 31 Jul 2021 03:11:58 -0400 |
parents | 3857b2919db0 |
children | 5a5d47a795c6 |
files | kemonopartydownloader.py |
diffstat | 1 files changed, 4 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/kemonopartydownloader.py Sat Jul 31 03:02:43 2021 -0400 +++ b/kemonopartydownloader.py Sat Jul 31 03:11:58 2021 -0400 @@ -19,7 +19,6 @@ else: filesize = 0 if str(filesize) != req.head(f"https://data.kemono.party{x['path']}").headers["Content-Length"]: - print("unfinished download") with req.get(f"https://data.kemono.party{x['path']}", stream=True, headers={"Range": f"bytes={filesize}-"}) as r: r.raise_for_status() with open(filename, "ab") as f: @@ -42,20 +41,19 @@ req = requests.Session() if args.proxy: + req.proxies = {} if args.proxy[:6] == "socks5": httpproxy = args.proxy httpsproxy = args.proxy - elif args.proxy[0:5] == "https": + elif args.proxy[:5] == "https": httpsproxy = args.proxy - elif args.proxy[0:4] == "http": + elif args.proxy[:4] == "http": httpproxy = args.proxy else: print("unknown proxy format! defaulting to HTTP...") httpproxy = args.proxy if httpproxy: - req.proxies = { - "http": httpproxy, - } + req.proxies["http"] = httpproxy if httpsproxy: req.proxies["https"] = httpsproxy