1.1.4 • Published 4 years ago

redditdata v1.1.4

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

redditdata

A simple tool to get data from reddit

Installation

> npm i redditdata

Usage

Getting posts from a subreddit

rd.getSubreddit(subreddit, opts)
const rd = require("redditdata")

const opts = {
    limit: 25,
    stickies: true,
    videos: true,
    nsfw: true,
    spoiler: true,
    onlyAwarded: false,
    minScore: 0
}

rd.getSubreddit("subreddit", opts)
  .then(response => {
    console.log(response)
  })
  .catch(error => {
    console.log(error)
  })

Opts object

  • Limit (integer, defaults to 25): The maximum number of posts to get. Sometimes may not get so many posts because they don't exist.
  • Stickies (boolean, defaults to true): Whether or not to allow sticky/pinned posts.
  • Videos (boolean, defaults to true): Whether or not to allow video posts.
  • NSFW (boolean, defaults to true): Whether or not to allow nsfw posts.
  • Spoiler (boolean, defaults to true): Whether or not to allow spoiler posts.
  • OnlyAwarded (boolean, defaults to false): Whether or not to only get posts that have been awarded.
  • MinScore (integer, defaults to 0): The minimum score posts need to have in order to get them.

Getting posts and comments from a user

rd.getUser(user, opts)
const rd = require("redditdata")

const opts = {
    limit: 25,        
    type: "all",
    stickies: true,
    videos: true,
    nsfw: true,
    spoiler: true,
    onlyAwarded: false,
    minScore: 0
}

rd.getUser("reddituser", opts)
  .then(response => {
    console.log(response)
  })
  .catch(error => {
    console.log(error)
  })

Opts object

  • Limit (integer, defaults to 25): The maximum number of posts to get. Sometimes may not get so many posts because they don't exist.
  • Type (string, defaults to "all"): The type of data to get.
    • "all": Gets all type of data.
    • "post": Only gets posts.
    • "comment": Only gets comments.
  • Stickies (boolean, defaults to true): Whether or not to allow sticky/pinned posts.
  • Videos (boolean, defaults to true): Whether or not to allow video posts.
  • NSFW (boolean, defaults to true): Whether or not to allow nsfw posts.
  • Spoiler (boolean, defaults to true): Whether or not to allow spoiler posts.
  • OnlyAwarded (boolean, defaults to false): Whether or not to only get posts that have been awarded.
  • MinScore (integer, defaults to 0): The minimum score posts need to have in order to get them.
1.1.1

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.1.4

4 years ago

1.0.5

4 years ago

1.1.3

4 years ago

1.0.4

4 years ago

1.1.2

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago