JSPM

simple-reddit-api

1.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q43003F
  • License ISC

A simple reddit api that doesnt require auth.

Package Exports

  • simple-reddit-api

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (simple-reddit-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

simple-reddit-api

Simple client for the reddit public api. (No auth needed)

Get it from npm

npm i simple-reddit --save

Import

const Reddit = require("simple-reddit");

or just import individual functions.

const {topPost} = require("simple-reddit");

Usage

Basic examples:

Get top post from reddit.

RedditSimple.topPost(options).then(res => {
    console.log(res);
})

 

Get new post from reddit.

RedditSimple.newPost(options).then(res => {
    console.log(res);
})

 

Get random post from reddit.

RedditSimple.randomPost(options).then(res => {
    console.log(res);
})

 

Search if a subreddit exists.

RedditSimple.searchSubreddits('dankmemes').then(res => {
    console.log(res);
})
  • Args: Name of subreddit to be searched. (Required)

 

RedditSimple.popularSubreddits(count).then(res => {
    console.log(res);
})
  • Args: Number of subreddits to be displayed. (Defaults to 1)

Options

There are 4 options that you can pass.

Name Value Description Default
subreddit name of subreddit Subreddit to fetch the post. r/all
count Number of posts to retrieve Retrieves n number of posts. 1 (max:100)
is_meme true/false If you want to get a meme. Ignores subreddit option if true. false
fulldata true/false Retrieve essential post data or everything reddit has to offer. false