Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting NEW posts from a subreddit in JSON

Tags:

How would I go about getting the new posts of a subreddit in JSON? Just tacking on .json to the url (http://www.reddit.com/r/SOME_SUBREDDIT/new.json) returns the following:

{     kind: "Listing"     -     data: {         modhash: ""         children: [ ]         after: null         before: null     } } 

The children array doesn't contain any posts. I've come to find that http://www.reddit.com/r/SOME_SUBREDDIT/new actually routes to new?sort=rising when what I need is new?sort=new.

and /new?sort=new.json of course wont work.

like image 351
Chris Cummings Avatar asked May 31 '11 05:05

Chris Cummings


1 Answers

The .json modifier should be put at the end of the path component, not the entire URL. The URL you're looking for is:

http://www.reddit.com/r/subreddit/new.json?sort=new 
like image 71
Neil Williams Avatar answered Sep 28 '22 03:09

Neil Williams