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

1

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.

Satsuma answered 18/9, 2013 at 20:35 Comment(0)
S
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

Satsuma answered 23/9, 2013 at 7:11 Comment(6)
Looks like this solution will give you more results, but still far beyond the complete result set.Satsuma
How to get list of subreddits/mysubreddits subscribe by user ?Immerge
Now https://www.reddit.com/r/[subreddit]/new.json returns all the post from a subreddit.Jennelljenner
@SabbirRahman Looks like that only gives you back 25 listings.Spotted
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.Grimsby
@ß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.jsonMiticide

© 2022 - 2024 — McMap. All rights reserved.