Goodreads random next book selection
Photo by Susan Yin on Unsplash
I’m a huge fan of Goodreads. Every book that I find even remotely interesting goes on my “to-read” shelf. I also mark what I’m currently reading (usually synced from my Kindle) and rate most things I’ve ever read, past and present. It is a pretty indispensable tool in my reading life.
I love being able to see what my friends have read and what they think about books I’m considering reading. I also love the idea of having this giant digital bookshelf that doesn’t take up any space. After over eight years of using the service, my shelves have become quite large. As it stands right now, I have 572(!) books that I want to read. These span a wide range of genres like science fiction, business, sports/running, self-improvement, and other random fiction. But when I sit down to figure out what to read next, I often don’t know how to choose.
To make my life a little bit easier, I decided to use the Goodreads API to pick out one random book from my “to-read” shelf that I hopefully will want to read next. If I don’t, I just ask again.
Here’s how you can set this up yourself:
Create an API key at https://www.goodreads.com/api/keys.
Grab your Goodreads ID. You can find that by going to your profile and looking at the number that precedes your first and last name in the profile URL. For example, mine is 4640588 from https://www.goodreads.com/user/show/4640588-kyle-brazil.
Use the following cURL command in your terminal and replace your own API key and ID.
curl -X GET 'https://www.goodreads.com/review/list?v=2&key=YOUR_API_KEY&id=YOUR_ID&shelf=to-read&sort=random&per_page=1'
Using this, you will get back a not-so-pretty XML response with one random book from your “to-read” shelf and all the info you need about it like the title, ratings, summary, and links to Goodreads. Note: In order for this to work your shelves must be public. Otherwise, you’ll need to use OAuth.
So, based on all of this, what will I be reading next? The Catcher in the Rye! Something I’ve, surprisingly, never read and a classic.