Skip to content

Commit

Permalink
Update demo.py
Browse files Browse the repository at this point in the history
添加对novel_comments()的测试
  • Loading branch information
xiyihan0 authored Oct 3, 2023
1 parent ab7d8d2 commit 10190e3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,16 @@ def appapi_novel(aapi):
print(json_result)
novel = json_result.novels[0]
print(">>> {}, text_length: {}, series: {}".format(novel.title, novel.text_length, novel.series))

# List the comments of the novel
json_result = aapi.novel_comments(16509454, include_total_comments=True)
print("Total comments = {}".format(json_result["total_comments"]))
for comment in json_result["comments"]:
if comment["parent_comment"] != dict():
print("{user} replied to {target} at {time} : {content}".format(user = comment["user"]["name"], time = comment["date"], content = comment["comment"], target = comment["parent_comment"]["user"]["name"]))
else:
print("{user} at {time} : {content}".format(user=comment["user"]["name"], time=comment["date"], content=comment["comment"]))



def main():
Expand Down

0 comments on commit 10190e3

Please sign in to comment.