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

readability-api

v1.0.1

Published

A Node wrapper for the Readability APIs

Downloads

11

Readme

node-readability-api

Build Status Code Climate

This is a Node client for the Readability API. It supports the Reader API, Parser API and Shortener API.

Installation

npm install --save readability-api

Usage

Initialize the client

var readability = require('readability-api');

readability.configure({
    consumer_key: 'some_consumer_key',
    consumer_secret: 'some_consumer_secret',
    parser_token: 'some_parser_token'
});

Authentication

Retrieve an OAuth access token and access token secret for a user

readability.xauth('some_username', 'some_password', function (err, tokens) {
  // Use tokens.oauth_token and tokens.oauth_token_secret when creating a Reader API client
})

Reader API

To use the Reader API, create a Reader object using an OAuth token and token secret

var reader = new readability.reader({
  access_token: 'some_access_token',
  access_token_secret: 'some_access_token_secret'
});
User information
// Get information about the current user
reader.user(function (err, user) {
  //...
});
Bookmarks
// Get all bookmarks - response contains both metadata (pagination etc.) and an array of bookmarks
reader.bookmarks(options, function (err, bookmarks) {
   //...
});

// Get a bookmark by its id
reader.bookmark('some_bookmark_id', function (err, bookmark) {
   //...
});

// Add a bookmark - returns the created bookmark
reader.addBookmark('http://some.bookmark.url.com/article.html', function (err, bookmark) {
   //...
});

// Remove a bookmark - success is a boolean
reader.removeBookmark('some_bookmark_id', function (err, success) {
   //...
});

// Archive a bookmark - returns the archived bookmark
reader.archiveBookmark('some_bookmark_id', function (err, bookmark) {
   //...
});

// Unarchive a bookmark - returns the bookmark
reader.unarchiveBookmark('some_bookmark_id', function (err, bookmark) {
   //...
});

// Favourite a bookmark - returns the favourited bookmark
reader.favouriteBookmark('some_bookmark_id', function (err, bookmark) {
   //...
});

// Unavourite a bookmark - returns the bookmark
reader.unfavouriteBookmark('some_bookmark_id', function (err, bookmark) {
   //...
});
Tags
// Get all of the current user's tags - returns an array of tags
reader.userTags(function (err, tags) {
   //...
});

// Get all of the tags for a bookmark - returns an array of tags
reader.tags('some_bookmark_id', function (err, tags) {
   //...
});

// Add tags to a bookmark - returns an array of tags
reader.addTags('some_bookmark_id', ['tag1', 'tag2', 'tag3'], function (err, bookmark) {
    //...
});

// Remove a tag from a bookmark - returns the bookmark
reader.removeTag('some_bookmark_id', 'some_tag_id', function (err, bookmark) {
   //...
});
Articles
// Get a single article
reader.article('some_article_id', function (err, article) {
   //...
});

Parser API

// Create a parser object
var parser = new readability.parser();

// Parse an article
parser.parse('http://some.bookmark.url.com/article.html', function (err, parsed) {
  //...
});

// Get the Parser confidence level - returns a number between 0 and 1
parser.confidence('http://some.bookmark.url.com/article.html', function (err, confidence) {
  //...
});

Shortener API

// Create a shortener object
var shortener = new readability.shortener()

// Create a short URL - returns the short URL as a string and additional URL data
shortener.shorten('http://www.example.com/article.html', function(err, shortUrl, data) {
  //...
});

// Get information about a short URL
shortener.url('some_url_id', function(err, url) {
  //...
});