修复微信改版后正文无法正常显示的问题

This commit is contained in:
LeLe86 2020-01-03 20:41:12 +08:00
parent cd135b97b4
commit 7e4e77d958
2 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,5 @@
{ {
"jsonDir": "C:/vWeChatFiles/rawlist/tmp1", "jsonDir": "C:/Users/kklwin10/Desktop/Dump-0103-20-14-29",
"htmlDir": "c:/vWeChatFiles/html/", "htmlDir": "c:/vWeChatFiles/html/",
"pdfDir": "c:/vWeChatFiles/pdf/" "pdfDir": "c:/vWeChatFiles/pdf/"
} }

View File

@ -96,6 +96,7 @@ def ChangeImgSrc(htmltxt,saveimgdir,htmlname):
else : else :
img.attrs["src"] = "" img.attrs["src"] = ""
ChangeCssSrc(bs) #修改link标签 ChangeCssSrc(bs) #修改link标签
ChangeContent(bs) #修改js_content的style使正文能正常显示
return str(bs) #将BeautifulSoup对象再转换为字符串用于保存 return str(bs) #将BeautifulSoup对象再转换为字符串用于保存
def ChangeCssSrc(bs): def ChangeCssSrc(bs):
@ -106,6 +107,10 @@ def ChangeCssSrc(bs):
newhref = "http:" + href newhref = "http:" + href
link.attrs["href"] = newhref link.attrs["href"] = newhref
def ChangeContent(bs):
jscontent = bs.find(id="js_content")
jscontent.attrs["style"]=""
#文章类 #文章类
class Article(): class Article():
def __init__(self,url,pubdate,idx,title): def __init__(self,url,pubdate,idx,title):