Skip to content

Instantly share code, notes, and snippets.

@Aenigma
Created December 24, 2016 02:32
Show Gist options
  • Select an option

  • Save Aenigma/a8ff15724a225b2a24b6f7ff80139173 to your computer and use it in GitHub Desktop.

Select an option

Save Aenigma/a8ff15724a225b2a24b6f7ff80139173 to your computer and use it in GitHub Desktop.
get usernames on a subreddit bot
import praw
from sets import Set
reddit = praw.Reddit()
submissions = reddit.subreddit
users = Set()
for submission in reddit.subreddit('datasets').new(limit=1000):
submission.comments.replace_more(limit=1000)
for comment in submission.comments.list():
username = unicode(comment.author).encode('utf8')
users.add(username)
print(users)
[DEFAULT]
client_id=client id
client_secret=client secret
user_agent=get usernames on a subreddit bot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment