Skip to content

Instantly share code, notes, and snippets.

@Abrownn
Created July 28, 2018 23:17
Show Gist options
  • Save Abrownn/f615cc18e920f77cbf9a0b3ea240ba7c to your computer and use it in GitHub Desktop.
Save Abrownn/f615cc18e920f77cbf9a0b3ea240ba7c to your computer and use it in GitHub Desktop.
#CommentNameScrape
import praw
def CommentNameScrape():
r = praw.Reddit(username = "",
password = "",
client_id = "",
client_secret = "",
user_agent = "")
postID = input("What's the post ID? ")
post = r.submission(id = postID)
nameList = []
post.comments.replace_more(limit=4500)
for comment in post.comments.list():
commenter = str(comment.author)
if commenter not in nameList:
if commenter != "None":
nameList.append(comment.author)
else:
continue
else:
continue
print("Writing")
with open ("commentDump.txt" ,'a') as nameWrite:
for name in nameList:
nameWrite.write(" /u/" + str(name))
exit()
while True:
try:
CommentNameScrape()
except Exception as e:
print ("Error: " + str(e))
exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment