处理xhs意外的评论信息为空的情况

报错就会打断我,我没辙
This commit is contained in:
crpa33 2025-04-02 11:59:27 +08:00 committed by GitHub
parent a39b571d27
commit 274d64aefc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -415,6 +415,12 @@ class XiaoHongShuClient(AbstractApiClient):
num=10,
cursor=sub_comment_cursor,
)
if comments_res is None:
utils.logger.info(
f"[XiaoHongShuClient.get_comments_all_sub_comments] No response found for note_id: {note_id}"
)
continue
sub_comment_has_more = comments_res.get("has_more", False)
sub_comment_cursor = comments_res.get("cursor", "")
if "comments" not in comments_res: