【问题标题】:Get Reddit usernames of users who use a specific subreddit获取使用特定 subreddit 的用户的 Reddit 用户名
【发布时间】:2019-10-09 17:16:33
【问题描述】:

我想生成使用特定 subreddit 的用户的用户名列表。

据我所知,不可能简单地获得订阅 subreddit 的用户列表。如果这不可能,最好浏览所有线程并查看谁发表了评论。

我该如何处理?

【问题讨论】:

  • 是的,遍历所有线程并获取评论者的用户名是唯一的方法,因为 Reddit api 不会公开订阅者的姓名。

标签: python reddit praw


【解决方案1】:

无法获取订阅者列表。您可以使用 Pushshift 的 API 来获取使用 /reddit/comment/search?subreddit=srhere 端点的特定 subreddit 中所有已知评论者的列表,尽管您可能希望为此使用 PSAW。

给定一个 reddit 实例 r,以下是仅使用 PRAW 获取它的方法:

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)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-11-18
    • 2020-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-30
    • 1970-01-01
    • 2022-01-20
    相关资源
    最近更新 更多