Update zhihu.py

This commit is contained in:
guanjihuan 2022-04-12 23:31:27 +08:00
parent d77701fb45
commit c2148b3302

View File

@ -51,11 +51,11 @@ for href in match_href_new:
f.write(str(href)) # 文章链接 f.write(str(href)) # 文章链接
f.write('\">') f.write('\">')
f.write(str(title.get_text()[:-5])) f.write(str(title.get_text()[:-5]))
f.write('&nbsp;&nbsp;') f.write('</a>&nbsp;&nbsp;')
author = soup.find("span", {"class": "UserLink AuthorInfo-name"}) author = soup.find("span", {"class": "UserLink AuthorInfo-name"})
f.write(str(author.get_text()+'&nbsp;&nbsp;')) f.write(str(author.get_text()+'&nbsp;&nbsp;'))
post_time = soup.find("div", {"class" : "ContentItem-time"}) post_time = soup.find("div", {"class" : "ContentItem-time"})
f.write(str(post_time.get_text()[4:-6])+'</a></p>') f.write(str(post_time.get_text()[4:-6])+'</p>')
except: except:
pass pass
f.close() f.close()