好的,所以我编写了一些代码,无论出于什么意图和目的,都应该有效:
def checkComments(comments):
for comment in comments:
print comment.body
checkComments(comment.replies)
def processSub(sub):
sub.replace_more_comments(limit=None, threshold=0)
checkComments(sub.comments)
#login and subreddit init stuff here
subs = mysubreddit.get_hot(limit=25)
for sub in subs:
processSub(sub)
但是,如果提交的评论有50个嵌套回复,那么:
root comment
-> 1st reply
-> 2nd reply
-> 3rd reply
...
-> 50th reply
以上代码仅打印:
root comment
1st reply
2nd reply
3rd reply
4th reply
5th reply
6th reply
7th reply
8th reply
9th reply
知道如何才能获得剩余的41个回复级别吗?或者这是一个限制?
答案 0 :(得分:3)
首先,limit
限制结果数量,而不是结果深度。
但这不是问题,reddit API的morecomments
端点似乎为深层嵌套的注释返回了错误的结果。
有关更多技术细节,请参阅bug report #321。