Search code examples
pythonredditpraw

How can I get all submission id's from a subreddit?


I'm trying to write a chat bot and I want to feed it data from specific subreddits, e.g. https://www.reddit.com/r/leagueoflegends/

I'm already able to crawl all comments while recursively looping

reddit = praw.Reddit()
submission = reddit.submission(submissionId) #id: https://redd.it/7jjtoq -> "7jjtoq"

I have already tried different approaches to receive (all) submission ids from the subreddit:

subreddits = reddit.subreddits.search_by_name('leagueoflegends', include_nsfw=True, exact=False)

or

for submission in reddit.get_new(limit=300):
...

Is there any way to receive all of the id's from a subreddit?


Solution

  • It seems praw does not want to crawl subreddits like questioned. praw provides several "get subreddit" methods to receive specific ones or get "popular" or "gold"-categorized ones. I'm now working with scrapy to receive the needed data from specific subreddits.