I'm looking to pull all the comments from a reddit post and ultimately get the author name, comment, and upvotes into a dataframe. I'm fairly new to programming so I'm having a tough time..
Right now I'm pulling the stickied comment using PRAW and trying to use a for loop to iterate through the comments and create a list of dictionaries with the author and comment. For some reason it's only adding the first author comment dictinoary pairing to the list and repeating it. Here's what I have:
import praw
import pandas as pd
import pprint
reddit = praw.Reddit(xxx)
sub = reddit.subreddit('ethtrader')
hot_python = sub.hot(limit=1)
for submissions in hot_python:
if submission.stickied:
print('Title: {}, ups: {}, downs: {}'.format(submissions.title, submissions.ups,submissions.downs))
post = {}
postlist = []
submission.comments.replace_more(limit=0)
for comment in submission.comments:
post['Author'] = comment.author
post['Comment'] = comment.body
postlist.append(post)
Any ideas? Apologies for the ugly code I'm a novice here. Thanks!