python - 在 PRAW 中,有没有办法为多个用户获取评论流?
问题描述
有了 PRAW,我知道你可以做到
subs = reddit.subreddit("Pics+Funny")
获取 r/Pics 和 r/Funny 的流,我知道你可以做到这一点
user = reddit.redditor("spez")
获得一个用户,但是有没有办法一次获得多个用户?像这样:
users = reddit.redditor("spez+kn0wthing")
?
我正在尝试阅读一大群用户的评论,我想知道这样的事情是否可行。当我尝试放在上面的内容时,它返回了 404 错误。谁能帮帮我?
解决方案
You cannot do this as you can with multireddits. However, there is a way around this with the pause_after
parameter in praw comment streams.
e.g.
spezStream = reddit.redditor('spez').stream.comments(pause_after=-1)
kn0thingStream = reddit.redditor('kn0thing').stream.comments(pause_after=-1)
while True:
for comment in spezStream:
print(comment.body)
for comment in kn0thingStream:
print(comment.body)
And that should work :-)
推荐阅读
- android - Kotlin BitmapFactory IllegalStateException
- php - 带有导致空白页面的参数的 AJAX 页面加载/url
- oracle - 在 sql 查询中避免 group by 子句中的列
- selenium - 如何在 Selenium Webdriver 中的 sendkeys 中传递系统日期(非硬编码)
- javascript - 在 Windows 中测试/调试 Phonegap iOS 应用程序
- python - 两种方式去除重复的开始和结束节点
- sql - 将 CREATE TABLE 更改为 SELECT INTO 时 DATETIME 丢失 hh:mm
- ruby - 您的 Ruby 版本是 2.3.1,但运行 rails s 时您的 Gemfile 指定了 2.4.1
- java - 比较 SQL(Room Reservation WebApp)Java 中的元素
- kubernetes - 使用 yaml 文件进行 Kubernetes 滚动部署