Get Reddit usernames of users who use a specific subreddit
Asked Answered
G

1

6

I would like to generate a list of usernames of users who use a specific subreddit.

As far as I know, it is not possible to simply get a list of users who subscribed to the subreddit. If that's not possible, it would probably be the best to go through all threads and look at who has commented.

How would I approach this?

Gasparo answered 23/5, 2019 at 7:20 Comment(1)
Yes, going through all the threads and getting the usernames of the commenters is the only way as Reddit api doesn't expose the names of the subscribers.Catholicism
R
6

It is not possible to get a list of subscribers. You can use Pushshift's API to get a list of all known commenters in a specific subreddit using the /reddit/comment/search?subreddit=srhere endpoint, although you might want to use PSAW for that.

Given a reddit instance r, here's how to get it using PRAW only:

srname = 'subreddit_name_here'
users = []
sr = r.subreddit(srname)
for comment in sr.comments(limit=1000):
     a = comment.author
     if not a in users:
         users.append(a)
Ramses answered 5/6, 2019 at 0:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.