Trying to create a PRAW scraper that can pull the comments from a list of sub_ids. Only returns the last sub_ids comment data.
I'm guessing I must be overwriting something. I've looked through other questions but because I'm using PRAW it has specific parameters and I can't figure out what could/should be replaced.
sub_ids = ["2ypash", "7ocvlb", "7okxkf"]
for sub_id in sub_ids:
submission = reddit.submission(id=sub_id)
submission.comments.replace_more(limit=None, threshold=0)
comments = submission.comments.list()
commentlist = []
for comment in comments:
commentsdata = {}
commentsdata["id"] = comment.id
commentsdata["subreddit"] = str(submission.subreddit)
commentsdata["thread"] = str(submission.title)
commentsdata["author"] = str(comment.author)
commentsdata["body"] = str(comment.body)
commentsdata["score"] = comment.score
commentsdata["created_utc"] = datetime.datetime.fromtimestamp(comment.created_utc)
commentsdata["parent_id"] = comment.parent_id
commentlist.append(commentsdata)