Unfortunately, Goodreads has decided to retire their api. This means you won’t be able to register for a developer key, and this package straight-up won’t work. Sigh. I’m gonna archive the repo.
this package allows you to manage goodreads from within your emacs.
- emacs-oauth: not the one that’s included with emacs, since that one uses oauth 2 but goodreads needs oauth 1
cl
: should be included with emacs:(require ’cl)
- ivy / counsel: for completion. optional.
in order to use this package, you’ll have to register your app with goodreads. go here and register. you’ll get a public key that’s 22 characters long and a secret that’s 40 characters long.
next (setq goodreads-my-key "your_key_here")
and (setq goodreads-my-secret "your_secret_here")
.
goodreads-el
provides a function called goodreads-oauth-authorize
. this function uses goodreads-my-key
and goodreads-my-secret
to request an access token from the goodreads servers. so that you don’t have to re-authorize every time, goodreads-oauth-authorize
will serialize the token and store it at a location defined by the variable goodreads-token-location
(by default, ~/.goodreads-el-token
. you can use setq
prior to calling goodreads-oauth-authorize
to change it).
after you’ve set goodreads-my-key
, goodreads-my-secret
, and optionally goodreads-token-location
, you can M-x goodreads-oauth-authorize
.
if all goes well, then your token should be stored in the variable goodreads-access-token
. you’ll have to re-run this function every time you restart emacs. in order to avoid this, you could put (goodreads-oauth-authorize)
in your init file.
if you get an error that some function in oauth
has a value of nil, then do C-h f make-oauth-access-token
and click the link that takes you to oauth.el
and then run M-x eval-buffer
in it.
next, you have to retrieve your unique user id from the goodreads servers to be able to write. this requires goodreads-oauth-authorize
first. run M-x goodreads-get-user-id
. if all goes well, your user id should be in the variable goodreads-my-id
.
goodreads-el
exposes two functions that you can use.
use this to select a shelf. after selecting a shelf, the books in that shelf will come up. you can RET
on one of them (behind the scenes, this runs goodreads-book-action
) to move to a shelf or view on goodreads.com.
searches for QUERY
. you can RET
on a book to bring up a menu where you can add it to a shelf or view it on goodreads.com.
unfortunately, while the api ostensibly supports editing a review, the method’s broken right now 😔. i’ve opened an issue on the goodreads forums. the api is creaky and old and i’m not sure when or if this will be fixed. until this is fixed, i don’t see this package supporting editing reviews (although all the work on my end is already done; you can see in the source code the function goodreads-edit-review
and the commented-out code in goodreads-book-action
).