我正在尝试使用PRAW的extra_query
方法中的Subreddit.submissions()
字段,如文档here中所述。
这是我的代码:
import praw
import json
import time
configFile = open("config.json", 'r')
configData = json.load(configFile)
now = time.time()-60
reddit = praw.Reddit(client_id=configData['user']['client_id'],
client_secret=configData['user']['client_secret'],
user_agent=configData['user']['user_agent'])
for submission in reddit.subreddit('all').submissions(now-3600, now, 'site:imgur.com'):
print(submission.url)
这不会产生任何结果,即使我删除了搜索查询只有submissions(now-3600, now)
时,结果也显示在imgur.com
域中。这是为什么?
答案 0 :(得分:0)
我明白了。我需要:
for submission in reddit.subreddit('all').submissions(now-(3600), now, "(or site:'imgur.com')"):