Created
July 28, 2018 23:17
-
-
Save Abrownn/f615cc18e920f77cbf9a0b3ea240ba7c to your computer and use it in GitHub Desktop.
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
#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