如何使用 PRAW 获取上周的评论?
How to get comments from last week using PRAW?
我正在阅读 doc for get_comments
,但我无法弄清楚 time
参数的正确输入是什么。我知道默认值是 "all",但我是输入具体日期,还是必须输入 "day"、"week" 等字词?
假设我想获得用户在一周内发表的评论,会是这样的吗:
r = praw.Reddit(user_agent='blah')
user = r.get_redditor(username)
comments = user.get_comments(sort='new', time='week', limit=None)
您可以在source code that the time
parameter is passed to the API as t
. According to the Reddit API documentation中看到:
t
: one of (hour
, day
, week
, month
, year
, all
)
我正在阅读 doc for get_comments
,但我无法弄清楚 time
参数的正确输入是什么。我知道默认值是 "all",但我是输入具体日期,还是必须输入 "day"、"week" 等字词?
假设我想获得用户在一周内发表的评论,会是这样的吗:
r = praw.Reddit(user_agent='blah')
user = r.get_redditor(username)
comments = user.get_comments(sort='new', time='week', limit=None)
您可以在source code that the time
parameter is passed to the API as t
. According to the Reddit API documentation中看到:
t
: one of (hour
,day
,week
,month
,year
,all
)