插旗开源,代码正在打包
[Python] 纯文本查看 复制代码from base64 import b64decode as dcd
from PIL import Image
from re import compile as ce
from re import findall as fl
from requests import get as gt
import os
from PyPDF2 import PdfMerger
filelt = []
def compt():
global filelt
filenames = os.listdir()
client = PdfMerger()
for filename in filelt:
filepath = os.path.join(os.getcwd(), filename)
print("[debug] add to merge list... " + filepath)
client.append(filepath)
client.write(os.path.join(os.getcwd(), 'output.pdf'))
client.close()
for i in filelt: os.system("del " + i)
cd = input("Made by Kenny0521\n请输入阅读器Url: ")
cdd = cd.split("/")[-1]
totpg = int(fl(ce("parseInt.*?,"), gt(cd).text)[0].split("'")[1]) + 1
for i in range(1, totpg):
print("[debug] downloading " + str(i) + " / " + str(totpg - 1))
open(str(i) + ".pdf", "wb").write(dcd(gt("http://www.nrsis.org.cn/mnr_kfs/file/readPage?" + "code=" + cdd + "&page=" + str(i)).text))
filelt.append(str(i) + ".pdf")
compt()