`Subreddit.submission()中的PRAW`extra_query`字段不起作用

时间:2018-01-18 15:38:50

标签: reddit praw

我正在尝试使用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域中。这是为什么?

1 个答案:

答案 0 :(得分:0)

我明白了。我需要:

for submission in reddit.subreddit('all').submissions(now-(3600), now, "(or site:'imgur.com')"):