python - 如何使用 PRAW 获取上周的评论?

标签 python reddit praw

我正在阅读 doc for get_comments而且我不知道 time 参数的正确输入是什么。我知道默认值是“全部”,但我是输入具体日期,还是必须输入“天”、“周”等词?

假设我想获得用户在一周内发表的评论,会不会是这样的:

r = praw.Reddit(user_agent='blah')
user = r.get_redditor(username)
comments = user.get_comments(sort='new', time='week', limit=None)

最佳答案

你可以在source code中看到time 参数作为 t 传递给 API。根据Reddit API documentation :

t: one of (hour, day, week, month, year, all)

关于python - 如何使用 PRAW 获取上周的评论?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27768132/

相关文章:

python - 安装 python reddit api 包装器模块

python - 如何使用 PRAW 对 Python 中的惰性对象执行 try- except ?

python - 在 PRAW 中探索特定深度的评论?

python - 你如何解包不同长度的嵌套列表?

python - 使用 comtypes 保存 PowerPoint 演示文稿时使用文件格式常量

python - 如何在 Django 查询集中重新创建 reddit 排序?

python - 虾 6 : Get all submission of a subreddit

python - 计算时间序列中的最高连续值

python - .__repr__() 帮助 python 3

python - 向 reddit api 添加对 flair 的支持