Reddit RSS API

A Deno-powered HTTP service that turns Reddit subreddit RSS feeds into structured JSON, complete with filtering, sorting, merging, and random selection utilities.

Resources

Table of Contents

Features

API Overview

Path Parameters

Query Parameters

Combine parameters to compose custom feeds. Validation errors produce informative 400 Bad Request messages. When option=random is used, the response is a single ExtractedItem object instead of the full feed payload.

Usage Examples

Fetch the Latest Posts from a Single Subreddit

curl "https://reddit-rss-api.deno.dev/r/deno"

Merge Two Subreddits and Return Only Image Posts

curl "https://reddit-rss-api.deno.dev/r/deno+typescript?merge=true&filter=image"

Get a Random Video Post with Old Reddit Links

curl "https://reddit-rss-api.deno.dev/r/memes+videos?filter=video&option=random&old_reddit=true"

Limit the Response to Five Items, Sorted Descending

curl "https://reddit-rss-api.deno.dev/r/pics?sort=desc&count=5"

Response Shape

type ResponseData = {
 title: string;
 lastBuildDate: Date;
 link: string;
 feedUrl: string;
 itemsLength?: number;
 items: ExtractedItem[];
};

type ExtractedItem = {
 title: string;
 link: string;
 author: string;
 isoDate: Date;
 feedURL: string;
 id: string;
 message?: string;
 links?: string[];
 images?: string[];
 videos?: string[];
};

Sample response (GET /r/deno?count=2):

{
 "title": "posts from r/deno",
 "lastBuildDate": "2024-04-09T12:34:56.000Z",
 "link": "https://www.reddit.com/r/deno/",
 "feedUrl": "https://www.reddit.com/r/deno/.rss",
 "itemsLength": 2,
 "items": [
  {
   "title": "Deno 1.41 release highlights",
   "link": "https://www.reddit.com/r/deno/comments/abc123/...",
   "author": "user123",
   "isoDate": "2024-04-09T09:12:34.000Z",
   "feedURL": "https://www.reddit.com/r/deno/.rss",
   "id": "t3_abc123",
   "links": ["https://example.com/blog-post"],
   "images": ["https://i.redd.it/xyz.png"]
  },
  {
   "title": "Working with kv storage",
   "link": "https://www.reddit.com/r/deno/comments/def456/...",
   "author": "user456",
   "isoDate": "2024-04-08T16:20:10.000Z",
   "feedURL": "https://www.reddit.com/r/deno/.rss",
   "id": "t3_def456"
  }
 ]
}

Error Handling

Development

To contribute to the project, follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and ensure all tests pass.
  4. Submit a pull request describing your changes.

Quick Start

  1. Install Deno (v1.41 or newer recommended).
  2. Clone the repository and switch into the project directory.
  3. Run the server:

    deno run start
    

    The service listens on http://localhost:8000 by default.

Helpful Tasks

Architecture

Testing

Run the full suite with:

deno run test

Tests rely on live Reddit RSS endpoints; ensure you have network access when executing them.