mirror of
https://github.com/RYDE-WORK/MediaCrawler.git
synced 2026-02-07 09:23:20 +08:00
保护author为None但未被识别的情况
This commit is contained in:
parent
6b6e2b8ba0
commit
3c72fc48b0
@ -192,6 +192,7 @@ class ZhihuExtractor:
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
res = ZhihuCreator()
|
res = ZhihuCreator()
|
||||||
|
try:
|
||||||
if not author:
|
if not author:
|
||||||
return res
|
return res
|
||||||
if not author.get("id"):
|
if not author.get("id"):
|
||||||
@ -201,6 +202,8 @@ class ZhihuExtractor:
|
|||||||
res.user_nickname = author.get("name")
|
res.user_nickname = author.get("name")
|
||||||
res.user_avatar = author.get("avatar_url")
|
res.user_avatar = author.get("avatar_url")
|
||||||
res.url_token = author.get("url_token")
|
res.url_token = author.get("url_token")
|
||||||
|
finally:
|
||||||
|
pass
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def extract_comments(self, page_content: ZhihuContent, comments: List[Dict]) -> List[ZhihuComment]:
|
def extract_comments(self, page_content: ZhihuContent, comments: List[Dict]) -> List[ZhihuComment]:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user