Socket
Socket
Sign inDemoInstall

@vedantsharma/reddit

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @vedantsharma/reddit

Reddit Library for Nodejs and Typescript


Version published
Maintainers
1
Created

Readme

Source

Reddit Scraper

About

@vedant/reddit is a nodejs library coded using javascript to make work for coders who are using the raw reddit api to make there lives easier. Thanks to Ric for helping me fix major part in the code.

Overview

The parameters are optional. So... the default subreddits are "dankmemes" and "wholesomememes".

Below are the Given Methods.

getRandom();
getLast();
getFirst();

before using all this, you have to set up the instances, which is by doing the given:

import {Scraper} from "@vedant/reddit";
const a = new Scraper();

Possible errors

Usages

Typescript:

import {Scraper} from "@vedant/reddit";

const manager = new Scraper();

// Using Async/Await
const post = await manager.getFirst('funny'); // Leaving this empty would use the default subreddits as given on 
console.log(post); // Print out the Reddit Post Object.
console.log(post.titl); // Print out the title of the reddit post.


// Using .then()
manager.getRandom().then(post => {
    console.log(post); // Print out the Object.
    console.log(post.title); // Print out the Post Title.
});

Javascript:

const lib = require("@vedant/reddit")

const manager = new lib.Scraper();

// async/await
const post = await manager.getRandom();
console.log(post);
console.log(post.title);

//  .then()
manager.getLast().then((post) => {
    console.log(post); // Print out the Reddit Post object.
    console.log(post.title); // Print out the post title
})

Keywords

FAQs

Last updated on 07 Mar 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc