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

redditor

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redditor

Minimal reddit API wrapper

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
Created
Source

redditor

A minimal wrapper for the reddit API. It manages the session tokens, rate limiting and JSON parsing, otherwise it just passes on the raw response from reddit.

npm install redditor

Usage

It supports both doing anonymouse and authorized requests.

var reddit = require('redditor');

reddit.get('/r/funny.json', function(err, response) {
	if(err) throw err;
	console.log(response); // response is a Javascript object
});

Login using username and password.

reddit({
	username: 'test_username',
	password: 'test_password'
}, function(err, authorized) {
	// Note that the returned object and the main reddit instance are not the same

	if(err) throw err;
	authorized.get('/api/me.json', function(err, response) {
		// ...
	});
});

Or using username, cookie and modhash directly.

var authorized = reddit({
	username: 'test_username',
	cookie: 'test_cookie',
	modhash: 'test_modhash'
});

If needed the data can also be streamed using the returned instance.

reddit.post('/api/new_captcha').pipe(fs.createWriteStream('captcha.png'));

Keywords

FAQs

Package last updated on 14 Dec 2014

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