gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 10:29:24 31 4
gpt4 key购买 nike

我正在阅读 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/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com