Goodreads data export options
Ever since my Goodreads account loss disaster I’ve been eager to back up all the info on books I have recorded there. Right now I’m motivated to build my own UI for that data so I can search for books more easily. Considering emulating Simon Willison’s dogsheep projects and getting the data into sqlite for Datasette.
Anyway, there’s a bunch of ways to get data out of Goodreads. They’ve changed over the years as Amazon, their owner, makes it less and less accessible. Here’s some options:
My Books > Import/Export. The simplest bulk export. Takes a few minutes and you get a CSV file, one per book in your library. Data includes title, author, ISBN, rating, date read, etc. The data format is a bit funky with columns like "=""0060590297""" or "=""""" but it seems to have most of the data I want in it. (Unfortunately it does not have the number of reviews the book has received, but it does have average rating.)
Account Settings > Settings > Privacy > download request, called a “DSAR” (a GDPR compliance term). This gets you a zip file full of JSON stuff. They say it will take up to a month to prepare the download, last time I did it took several days. There’s a lot of uninteresting stuff here, like a record of every time I opened the Kindle app on my tablet. It’s also not in a convenient format. The review.json contains my reviews, for instance, but the book is only referenced by freetext title: no IDs or ISBNs or the like.
Goodreads API. Hahha, just kidding, it was shut down in 2020 “As part of our overall commitment to continually improve our data management”.
HTML scraping. There’s a bunch of projects and tutorials around scraping data, all at various levels of completeness or abandonment. I had some luck with goodreads-user-scraper: it looks like someone’s maintaining it and it’s oriented around user data, not just scraping stuff for some marketing purpose. But it errored out about halfway through with a 404, not sure if I was throttled or it’s broken. Also none of the data was personal to me other than the list of books, in particular my review text isn’t in the dump.
Note my list is organized around getting a snapshot of your account. Given it takes them up to a month to prepare that a snapshot, it’d be nice to have incremental updates. I think a scraping approach is the only way to do that.
I’m going to start with the CSV and feed it into datasette and see where that gets me. Probably use scraping otherwise, the DSAR looks pretty useless for my purposes.
Datasette import
Quick-and-dirty Datasette notes:
- install datasette with pip
- install sqlite-utils with pip
sqlite-utils insert goodreads.db books goodreads.csv --csvdatasette serve goodreads.db
The schema is messy so I created some views in sqlite to have cleaner output in Datasette
drop view if exists read;
create view read as
select
"My Rating",
"Average Rating",
"Date Read",
Title,
Author,
trim(ISBN13, '"=') as "ISBN13",
replace("My Review", '<br/>', '
') as "Review"
from
books
where
"Bookshelves" in ("", "wont-finish")
;
drop view if exists toread;
create view toread as
select
"Average Rating",
"Date Added",
Title,
Author,
trim(ISBN13, '"=') as "ISBN13"
from
books
where
"Bookshelves" = "to-read"
;







