From 511a08bd0a8538132bee48437aaaac0fc88b4108 Mon Sep 17 00:00:00 2001 From: flt6 <1404262047@qq.com> Date: Sun, 12 Jun 2022 20:45:26 +0800 Subject: [PATCH] [zxxk_dl] first commit Former-commit-id: 86f12e4db80f1c9b19183cc81e7d785d600095cf --- zxxk_dl/main.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 zxxk_dl/main.py diff --git a/zxxk_dl/main.py b/zxxk_dl/main.py new file mode 100644 index 0000000..fbde737 --- /dev/null +++ b/zxxk_dl/main.py @@ -0,0 +1,40 @@ +import requests +from time import strftime +from re import search + +def writefile(filename,text): + with open(filename+'.html', 'w') as f: + f.write(text) + + +def main(): + softID=input("ID: ") + url = "https://www.zxxk.com/soft/Preview/FirstLoadPreviewJson?softID={}&type=3&product=1&v=2&FullPreview=true" + response = requests.get(url.format(softID)) + if response.status_code!=200: + print("ERROR") + print(response.status_code) + return -1 + ret=response.json()["data"] + if not ret["IsSuccess"]: + print("ERROR: IsSuccess option is not true") + print(ret) + if not ret['IsRar']: + print("Not rar") + print("TotalPage=%d" % ret['TotalPage']) + print("SoftExt=%s" % ret['SoftExt']) + html=response["Html"] + # replace "data-original" to "src" for showing in browser + html=html.replace("data-original", "src") + writefile(strftime("%Y%m%d-%H:%M"),html) + else: + print("is RAR") + rar=ret['rarPreviewInfo'] + for file in rar: + html=file["Html"] + # replace "data-original" to "src" for showing in browser + html=html.replace("data-original", "src") + writefile(file["SoftName"],html) + +if __name__ == "__main__": + main()