Praw (Redditt API) How to retrieve replies to a comment past 10 levels deep
Posted
by
jpreed00
on Stack Overflow
See other posts from Stack Overflow
or by jpreed00
Published on 2014-08-20T04:14:57Z
Indexed on
2014/08/20
4:20 UTC
Read the original article
Hit count: 136
Ok, so I've written some code that, for all intents and purposes, should work:
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=50)
for sub in subs:
processSub(sub)
However, given a submission that has 50 nested replies like so:
root comment
-> 1st reply
-> 2nd reply
-> 3rd reply
...
-> 50th reply
The above code only prints:
root comment
1st reply
2nd reply
3rd reply
4th reply
5th reply
6th reply
7th reply
8th reply
9th reply
Any idea how I can get the remaining 41 levels of replies? Or is this a praw limitation?
© Stack Overflow or respective owner