This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import praw | |
def get_subreddit_comments(reddit_agent, subreddit, comments_out = [], count = 100): | |
try: | |
sub = reddit_agent.get_subreddit(subreddit) | |
comments_raw = sub.get_comments(sub, limit=count) | |
comments_flat = praw.helpers.flatten_tree(comments_raw) | |
for comment in comments_flat: | |
try: | |
if hasattr(comment, 'comments'): |