npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@houshuang/instapaper

v1.1.1

Published

Instapaper API client

Downloads

3

Readme

Instapaper API

Node.js client for the Instapaper API.

Work in progress!

Installation

$ npm i instapaper

Quick example

var Instapaper = require('instapaper');
var client     = Instapaper(CONSUMER_KEY, CONSUMER_SECRET);

client.setUserCredentials(USERNAME, PASSWORD);

// Load a list of bookmarks using promises...
client.bookmarks.list().then(function(bookmarks) {
  console.log('%j', bookmarks);
}).catch(function(err) {
  console.warn('oh noes', err);
});

// ...or regular callbacks
client.bookmarks.list(function(err, bookmarks) {
  if (err) return console.warn('oh noes', err);
  console.log('%j', bookmarks);
});

Authentication

The Instapaper API uses xAuth, which requires that you first register for API usage here. When your registration has been approved, you will receive a "consumer key" and "consumer secret", which you pass to the Instapaper constructor (see below).

You also need either:

  • a username and password belonging to the user on whose behalf you want to manage Instapaper;
  • or, an OAuth token and secret from a previous authentication round.

You should never store the username/password locally. Instead, after you've used them to get an OAuth token/secret pair, use those instead.

Usage:

Constructor

var client = Instapaper(CONSUMER_KEY : String, CONSUMER_SECRET : String[, OPTIONS : Object]);

OPTIONS is an optional object that may contain the following properties:

apiUrl   : String // Instapaper API URL prefix (default: 'https://www.instapaper.com/api/1')
logLevel : String // log level                 (default: 'info')

Authentication

Set user credentials

client.setUserCredentials(USERNAME : String, PASSWORD : String) : client

Set OAuth credentials

client.setOAuthCredentials(TOKEN : String, SECRET : String) : client

Authenticate

client.authenticate() : Promise

All regular API methods call this method implicitly. However, if you want to retrieve the OAuth credentials you can use this method to do so:

client.authenticate().then(function(oauth) {
  // { token : '...', secret : '...' }
});

Verify credentials

This can be used to verify that authenticating as the user was successful.

client.verifyCredentials() : Promise

Bookmarks management

Please refer to the API documentation for valid parameters and response formats.

client.bookmarks.list(PARAMS)           : Promise
client.bookmarks.getText(BOOKMARK_ID)   : Promise
client.bookmarks.delete(BOOKMARK_ID)    : Promise
client.bookmarks.star(BOOKMARK_ID)      : Promise
client.bookmarks.unstar(BOOKMARK_ID)    : Promise
client.bookmarks.archive(BOOKMARK_ID)   : Promise
client.bookmarks.unarchive(BOOKMARK_ID) : Promise

Folder management

TBD.

Terms of use

Please read the Instapaper API Terms of Use before using this API client.

AUTHOR

Robert Klep <[email protected]>

LICENCE

See LICENSE.md.