A Deno-powered HTTP service that turns Reddit subreddit RSS feeds into structured JSON, complete with filtering, sorting, merging, and random selection utilities.
- Merge multiple subreddits by delegating individual RSS requests and consolidating the payload for richer result sets.
- Filter feed items to media-rich posts (images or videos) or fetch a random post from any combination of subreddits.
- Sort posts by publish date (
asc,desc) or shuffle them (mixed). - Limit response size with
countwhile retaining the originalitemsLengthfor reference. - Rewrite all Reddit links to
old.reddit.comon demand for legacy views. - CORS-friendly JSON responses served by
[Deno.serve](https://deno.land/api?s=Deno.serve)with a zero-dependency runtime.
- Base URL:
https://reddit-rss-api.deno.dev - Root (
GET /): provides basic API information and usage instructions. - Feed (
GET /r/{subreddits}): fetches RSS-derived JSON for one or more subreddits.
subreddits– one or more subreddit names separated by+(URL-encoded space). Example:deno+typescript.
-
option(string)- Values:
random - Default:
null - Description: Returns a single random item from the processed feed.
- Values:
-
sort(string)- Values:
asc,desc,mixed - Default:
asc - Description: Orders items by publish date or shuffles them (
mixed). Applied beforecount.
- Values:
-
filter(string)- Values:
image,video,image+video - Default:
null - Description: Keeps only media-rich posts. Combine options with
+(decoded as space).
- Values:
-
merge(boolean)- Values:
true,false - Default:
false - Description: When
true, the API fetches each subreddit individually and merges the results.
- Values:
-
count(number)- Values:
>= 1 - Default:
null - Description: Truncates the response to the first n items after all other operations.
- Values:
-
old_reddit(boolean)- Values:
true,false - Default:
false - Description: Rewrites feed and item links to use
old.reddit.com.
- Values:
Combine parameters to compose custom feeds. Validation errors produce informative
400 Bad Requestmessages. Whenoption=randomis used, the response is a singleExtractedItemobject instead of the full feed payload.
curl "https://reddit-rss-api.deno.dev/r/deno"curl "https://reddit-rss-api.deno.dev/r/deno+typescript?merge=true&filter=image"curl "https://reddit-rss-api.deno.dev/r/memes+videos?filter=video&option=random&old_reddit=true"curl "https://reddit-rss-api.deno.dev/r/pics?sort=desc&count=5"400 Bad Requestfor invalid paths, malformed query parameters, or RSS parsing failures.405 Method Not Allowedfor non-GETrequests.- Error bodies include the message where available to simplify debugging.
To contribute to the project, follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and ensure all tests pass.
- Submit a pull request describing your changes.
-
Install Deno (v1.41 or newer recommended).
-
Clone the repository and switch into the project directory.
-
Run the server:
deno task start
The service listens on
http://localhost:8000by default.
deno task start– run the API once with full permissions.deno task dev– watch mode for local development.deno task test– execute the unit test suite undersrc/tests/.deno task fmt– format codebase.
Run the full suite with:
deno task testTests rely on live Reddit RSS endpoints; ensure you have network access when executing them.