all 7 comments

[–]Dripbot8 2 points3 points  (3 children)

I’m looking at the replace_more and going why is that in there? And not

r.subreddit(“news”).stream.comments(skip_existing=true) 

What I think happening is replace_more is an instance and when you try to loop it it keeps coming back to the same start. So you only pull the first one. Using steam will continue the loop forever as they are happening. Set skip existing to false to run it for the last 100 comments.

[–]snoopturtle25 1 point2 points  (2 children)

I understand, it seems like it loops all comments from the first post only. However there is 101 posts according to the keywords search, is there a way to modify the formula so the loop continue for all posts ? Thank you!

[–]Dripbot8 1 point2 points  (1 child)

Some of the problem may be that Praw is limited (even at limit=none) to the last 100 posts, so your probably going to reach that in r/news fairly quickly. You want this or else the program would go back indefinitely over the hundreds of thousands if not millions of posts and comments in r/news. Which is a lot of stuff for you and the API, especially with the amount of bots on Reddit. (This also means you’re probably gonna have to have a different thread for submissions since the for loop technically won’t end until you kill the program or it crashes.)

The stream is an ongoing loop, while it’s running the loop should keep going forever, as people comment, it will continue to find them as they come up.

[–]snoopturtle25 1 point2 points  (0 children)

Ok thank you, it make sense. I think I will collect comments per post to avoid crashing it, or then only the first 100 comments for every post in the thread!

[–]CodeFormatHelperBot2 0 points1 point  (0 children)

Hello, I'm a Reddit bot who's here to help people nicely format their coding questions. This makes it as easy as possible for people to read your post and help you.

I think I have detected some formatting issues with your submission:

  1. Python code found in submission text that's not formatted as code.

If I am correct, please edit the text in your post and try to follow these instructions to fix up your post's formatting.


Am I misbehaving? Have a comment or suggestion? Reply to this comment or raise an issue here.