Categorized | reddit

Tags | ,

Reddit’s Secret API

Posted on 24 November 2008 by Ryan

Over the past few weeks I have been working on creating a tool to gather some social media metrics to track social media optimization campaigns. Friendfeed is your friend if you’re embarking on the same project. While looking for a native reddit API however I stumbled across a post on code.reddit.com that mentioned an API endpoint.

http://code.reddit.com/ticket/154:

In many applications, such as Socialite, it is valuable to look up information about a link on reddit. Currently, there are two good ways to do this using the JSON API:

Info call
Example: http://www.reddit.com/api/info.json?count=1&url=STORYURL

The API “info” call is an ideal way to look up reddit stories by URL. However, in some cases, looking up stories by URL alone presents problems:

1. URLs are not mapped to stories on a one-to-one basis. Since the same URL can be posted to many subreddits, when looking up stories by URL, it becomes necessary to constrain the search by subreddit, e.g.: http://www.reddit.com/r/subreddit/api/info.json?count=1&url=STORYURL

For a typical reddit story the json looks like:

{"kind": "Listing", "data": {"children": [{"kind": "t3", "data": {"subreddit_id": "t5_6", "clicked": false, "name": "t3_70ehq", "ups": 3709, "created": 1220933746.0, "url": "http:\/\/voices.washingtonpost.com\/the-trail\/2008\/09\/08\/obama_to_palin_dont_mock_the_c.html", "num_comments": 871, "downs": 943, "author": "neoabraxas", "domain": "voices.washingtonpost.com", "subreddit": "reddit.com", "score": 2766, "likes": null, "title": "Obama to Palin:\"Don't mock the Constitution. Don't make fun of it. Don't suggest that it's not American to abide by what the founding fathers set up. It's worked pretty well for over 200 years.\"", "hidden": false, "saved": false, "id": "70ehq"}}, {"kind": "t3", "data": {"subreddit_id": "t5_2cneq", "clicked": false, "name": "t3_70e4r", "ups": 96, "created": 1220928368.0, "url": "http:\/\/voices.washingtonpost.com\/the-trail\/2008\/09\/08\/obama_to_palin_dont_mock_the_c.html", "num_comments": 9, "downs": 61, "author": "andybigs", "domain": "voices.washingtonpost.com", "subreddit": "politics", "score": 35, "likes": null, "title": "Obama to Palin: 'Don't Mock the Constitution'", "hidden": false, "saved": false, "id": "70e4r"}}]}}

So there you have it. No auth string required, just open access to a portion of reddit’s db. So far the only endpoint visible is URL. With a little trial and error you can probably find some other useful endpoints other then the URL one listed.

3 Comments For This Post

  1. Foo Says:

    This really isn’t much of a secret. They’re open source, you know

  2. ryan Says:

    Try googling “reddit api” See what comes up.

  3. Brian Says:

    Take any URL at reddit and append .json to it. E.G. http://www.reddit.com/r/Libertarian/new/.json

Leave a Reply

Blog Advertising - Advertise on blogs with SponsoredReviews.com Advertise Here