3

I'm having trouble understanding if this is possible in the praw API: I'd like to get a list of all posts that have comments mentioning a keyword, say "python". It seems like the search function is always called form a specific subreddit, as in

for submission in reddit.subreddit("all").search("python", sort="comments", limit=None):
    print(submission.title)

But won't this only return posts that have made it to r/all? How can I search all subreddits, without brute force searching one subreddit at a time?

theQman
  • 1,690
  • 6
  • 29
  • 52

1 Answers1

2

Searching /r/all will search all subreddits. (Or maybe it's all subreddits that have opted into /r/all)

"Made it to /r/all" includes all posts (at least from subreddits that opted into /r/all, which is most of them). The posts might appear in different listings, such as /hot and /new, or they might not be accessible through any listings due to the 1000-item limit, even though theoretically they are still part of the listing, just further down. Regardless, they will all be searchable this way.

jarhill0
  • 1,559
  • 1
  • 11
  • 19