I decided to have my book list available in markdown, instead of using Good Reads, an Amazon service.
To do this, I exported my data from Good Reads as a csv file. Here is the link and a how to.
Once I had the csv, I wrote a script that:
- creates a directory for each book and a markdown file;
- fetches the book info from google books;
- inserts some metadata about the books like pageCount, categories and tags;
- inserts the book description as the content of the post;
- fetches the cover (as a thumbnail);
- if I had a review of the book on Good Reads, the script adds it after the book’s description.
Here is the code:
What you need
You need to have jq
installed. Instructions are here.
If you are on macOS, it is brew install jq
.
For ubuntu, it is sudo apt-get install jq
.
How to run:
- The file name is hardcoded to
good-reads.csv
. (I know that it should be an argument ;p). so rename your file to that and put it in the same directory as the script. - You need to manually drop some columns. Only keep what you see on line 3. Also drop the first line (column headers)
If I ever need to run the script again, i’ll improve on those last two points.