Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import random
- r = praw.Reddit('Comment Scraper 1.0 by u/_Daimon_ see '
- 'https://praw.readthedocs.org/en/latest/'
- 'pages/comment_parsing.html')
- submission = r.get_submission(submission_id='3gqwl5')
- submission.replace_more_comments(limit=None, threshold=0)
- allComments = submission.comments
- flatComments = praw.helpers.flatten_tree(allComments)
- usernames = set()
- for comment in flatComments:
- if comment.author is not None and comment.author.name not in usernames:
- usernames.add(comment.author.name)
- print(len(usernames))
- print( random.sample(usernames, 1) )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement