Fix handling of Content-Disposition headers
This commit is contained in:
parent
a8f3d43c82
commit
3ed2669c9d
1 changed files with 1 additions and 1 deletions
|
@ -59,7 +59,7 @@ def pageHandler(driver):
|
||||||
fid = a["href"].split("=")[1]
|
fid = a["href"].split("=")[1]
|
||||||
if not glob.glob("files/sbd%s*" % fid):
|
if not glob.glob("files/sbd%s*" % fid):
|
||||||
res = session.get("https://scriptzbase.org/%s" % a["href"])
|
res = session.get("https://scriptzbase.org/%s" % a["href"])
|
||||||
fname = re.findall("filename=(.+)", res.headers["content-disposition"])[0].strip('"')
|
fname = re.findall("filename=(.+)", res.headers["content-disposition"])[0].split(";")[0].strip('"')
|
||||||
|
|
||||||
with open("files/sbd%s_%s" % (fid, fname), "wb") as out:
|
with open("files/sbd%s_%s" % (fid, fname), "wb") as out:
|
||||||
out.write(res.content)
|
out.write(res.content)
|
||||||
|
|
Loading…
Reference in a new issue