New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

reddit-json-api

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reddit-json-api

Simple reddit json api wrapper that able to fetch data without authentication

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

reddit-json-api

Simple reddit json api wrapper that able to fetch data without authentication

Installing

npm i reddit-json-api

Usage

  1. Import package
const RedditJsonApi = require('reddit-json-api');
  1. Initialize RedditJsonApi
const reddit = new RedditJsonApi();

Then you can set up the parameters to be sent

reddit
  .setSubReddit('node')
  .setListing('new')
  .setLimit(5)
  .setTimeFrame('day');
  1. After that you can simply get the result by calling getResults()
const data = await reddit.getResults();

It is also possible to immediately construct the parameter

const reddit = new RedditJsonApi({
  subReddit: 'node',
  listing: 'new',
  limit: 5,
  timeFrame: 'day',
});
const data = await reddit.getResults();

Method

ParameterFunctionDescriptionValue accepted
subRedditsetSubRedditSubreddit name without "r/"String
listingsetListingListing type what content will be sorted of available optionsString: controversial, best, hot, new, random, rising, top
limitsetLimitAmount of data to fetch per requestNumber
timeFramesetTimeFrameimeframe of when the post createdString: hour, day, week, month, year, all

FAQs

Package last updated on 16 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc