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

goodreads

v0.1.0

Published

Wrapper for the Goodreads API

Downloads

26

Readme

Goodreads - Use NodeJS to tap into the Goodreads API

This is a dead simple wrapper for the Goodreads API when using NodeJS. I've only exposed a few GR API functions so far but would be happy to entertain adding more if there's demand.

Installation

  1. Install npm: curl http://npmjs.org/install.sh | sh
  2. Grab this module from npm: npm install goodreads
  3. Include it in your program:
  • Coffeescript: goodreads = require 'goodreads'
  • Javascript: goodreads = require('goodreads');
  1. create a new instance of the Goodreads client:
  • Coffeescript: gr = new goodreads.client { 'key': key, 'secret': secret }
  • Javascript: gr = new goodreads.client({ 'key': key, 'secret': secret });
  1. Go get a goodreads developer key/secret from http://www.goodreads.com/api/keys
  2. (optional) Add your key/secret to your environment variables so Nodejs can access them
  • Key: export GOODREADS_KEY=yourkey
  • Secret: export GOODREADS_SECRET=yoursecret
  1. Try it out! Maybe do a node examples/booklist.js to get an idea how things work

Functions

showUser - get user info with userName

  • input - valid userName
  • output - json (as callback)
  • Example: getShelves 'your_username', (json) ->
  • You must have created a username. You can do so here.

getShelves - Get all shelves for a given user

  • Input: userId
  • Output: json (as callback)
  • Example: getShelves '4085451', (json) ->

getSingleShelf - Get a specific list by ID

  • Input: shelfOptions object with userID (required), shelf (required), page (optional), and per_page (optional) properties.
  • Output: json (as callback)
  • Example: getSingleShelf {'userID': '4085451', 'shelf': 'web', 'page': 1, 'per_page': 200}, (json) ->

requestToken - OAUTH: calls back an object with oauthToken, oauthTokenSecret, and the URL!

  • Input: none
  • Output: json { oauthToken: 'iu1iojij14141411414', oauthTokenSecret: 'j1kljklsajdklf132141', url: 'http://goodreads.com/blah'}
  • Example: requestToken (callback) ->

processCallback - expects: oauthToken, oauthTokenSecret, authorize (from the query string) Note: call this after requestToken!

  • Input: oauthToken, oauthTokenSecret, authorize
  • Output: json { 'username': 'Brad Dickason', 'userid': '404168', 'success': 1, 'accessToken': '04ajdfkja', 'accessTokenSecret': 'i14k31j41jkm' }
  • Example: processCallback oauthToken, oauthTokenSecret, params.query.authorize, (callback) ->

More to come!

Help, I need an adult!

First step: Check out the /examples folder. It's decently documented.

If you're still having issues, you can submit them here: https://github.com/bdickason/node-goodreads/issues

Changelog

v0.0.5 - Removed OAuth workarounds

  • {showUser} method added - can get user information given their username.

v0.0.2 - Removed OAuth workarounds

  • OAuth Callback (processCallback) now properly returns an Access Token (accessToken) and Access Token Secret (accessTokenSecret)

v0.0.1 - First release! Woohoo!!

  • Added support getting a list of a user's shelves (getShelves)
  • Added support for getting all books on a single shelf (getSingleShelf)
  • Added support for an OAuth round trip via requestToken and processCallback
  • Started this ugly manual