Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reddit-scraper

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-scraper

Reddit Scraper

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Reddit Scraper

Instructions

  1. Create an App in https://www.reddit.com/prefs/apps/
    • Type should be script
    • redirect uri does not matter
  2. Get the App Id (Under the App's Name)
  3. Get the App Secret

Example

const RedditScraper = require("reddit-scraper");

(async () => {
 
    const redditScraperOptions = {
        AppId: "appId",
        AppSecret: "appSecret",
    };
 
    const requestOptions = {
        Pages: 5,
        Records: 25,
        SubReddit: "javascript",
        SortType: "hot",
    };
 
    try {
        const redditScraper = new RedditScraper.RedditScraper(redditScraperOptions);
        const scrapedData = await redditScraper.scrapeData(requestOptions);
        console.log(scrapedData);
    } catch (error) {
        console.error(error);
    }
 
})();
import {
	RedditScraper,
	IPageListingResults,
	IRequestOptions,
	IRedditCredentials,
} from "reddit-scraper";

(async () => {

	const redditScraperOptions: IRedditCredentials = {
		AppId: "appId",
		AppSecret: "appSecret",
	};

	const requestOptions: IRequestOptions = {
		Pages: 5,
		Records: 25,
		SubReddit: "javascript",
		SortType: "hot",
	};

	try {
		const redditScraper: RedditScraper = new RedditScraper(redditScraperOptions);
		const scrapedData: IPageListingResults = await redditScraper.scrapeData(requestOptions);
		console.log(scrapedData);
	} catch (error) {
		console.error(error);
	}

})();

Keywords

FAQs

Package last updated on 15 Apr 2018

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