fix some potential problem now

master
ZouJiu 2023-08-26 19:16:16 +08:00
parent 39340c2c3b
commit 2546508a01
1 changed files with 1 additions and 1 deletions

View File

@ -358,7 +358,7 @@ def parser_beautiful(innerHTML, article, number, dircrea, bk=False):
linksite = chi.attrs['href']
if linksite:
linksite = linksite.replace("//link.zhihu.com/?target=https%3A", "").replace("//link.zhihu.com/?target=http%3A", "")
if article[-1]=='\n':
if len(article) > 0 and article[-1]=='\n':
article += "["+chi.text+"]"+"("+linksite + ")"
else:
article += "\n\n["+chi.text+"]"+"("+linksite + ")"