Update start.py

转Pdf失败时自动跳过
This commit is contained in:
LeLe86 2022-05-06 19:25:30 +08:00 committed by GitHub
parent f98ee35da6
commit 6b15ee6459
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -230,7 +230,10 @@ def PDFDir(htmldir,pdfdir):
""" """
[s.extract() for s in bs(["script", "iframe", "link"])] [s.extract() for s in bs(["script", "iframe", "link"])]
SaveFile(tmppath, str(bs)) SaveFile(tmppath, str(bs))
try:
PDFOne(tmppath,pdfpath) PDFOne(tmppath,pdfpath)
except:
print("转pdf失败可能是因为标题中有特殊字符",f)
#把一个Html文件转为pdf #把一个Html文件转为pdf
def PDFOne(htmlpath,pdfpath,skipExists=True,removehtml=True): def PDFOne(htmlpath,pdfpath,skipExists=True,removehtml=True):