12

Is there a way to get all posts for a given subreddit instead of just the posts newer than one month?

For example, this is the "last" page of posts from IAmA subreddit we can get to, http://www.reddit.com/r/IAmA/?count=900&limit=100&after=t3_1k3tm1, and clearly this is not the last page of posts. It does not include any posts older than one month.

shengmin
  • 319
  • 1
  • 3
  • 13

1 Answers1

7

After playing around with Reddit, I found a way to fetch all posts of a given subreddit is to use its search interface: http://www.reddit.com/r/<subreddit>/search.json?restrict_sr=on&t=all. For example, you can get all posts under IAmA subreddit using this request endpoint: http://www.reddit.com/r/IAmA/search.json?restrict_sr=on&t=all

pii_ke
  • 2,811
  • 2
  • 20
  • 30
shengmin
  • 319
  • 1
  • 3
  • 13
  • 9
    Looks like this solution will give you more results, but still far beyond the complete result set. – shengmin Sep 23 '13 at 22:58
  • How to get list of subreddits/mysubreddits subscribe by user ? – Nancy thakkar Dec 05 '16 at 08:56
  • Now `https://www.reddit.com/r/[subreddit]/new.json` returns all the post from a subreddit. – Sabbir Rahman Mar 04 '18 at 16:26
  • @SabbirRahman Looks like that only gives you back 25 listings. – Christopher Perry Oct 09 '19 at 19:23
  • 1
    The reason it only gives back 25 results is because of the default limit set. To request for more (up to 100) add the querystring paramater 'limit' followed by the amount of results you want to retrieve. To get the next page, use the before or after paramater to get the next and previous results. – ßrilliant May 26 '20 at 11:02
  • @ßrilliant @SabbirRahman, your endpoint `https://www.reddit.com/r/[subreddit]/new.json` does not return the all post from a subreddit. I tried even with auth way and applying all the limits, count, after params. The below url returns only one post. `https://oauth.reddit.com/r/features/new.json` – John Byro May 06 '22 at 10:42