diff --git a/demo.py b/demo.py index 9c9b9c8..dcc906b 100644 --- a/demo.py +++ b/demo.py @@ -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():