I wanted to add book cover images and publication dates, plus links to reviews to my book lists and individual book review pages (which I will get to someday.) I would like to automate the assignment of cover images as much as possible; there are a lot of titles listed here already and the last thing I want to do is a lot of unnecessary data entry.

My first thought was to use Amazon affiliate links with images. Unfortunately some ad-blocking extensions block the images, and using these links requires joining the Amazon Affiliates program. To stay in the program you have to bring in a base level of income in the first six months; they don’t want any low earning accounts. Also, while the search results in the Amazon Affiliate interface are quite good I didn’tsee a simple way to automate the searches.

So I turned to Open Library and Good Reads. Open Library offers a book cover API with three sizes of cover images, accessible with an ISBN (10 or 13 digit version) or Open Library ID. Open Library’s cover API will also take ‘/librarything/’ or ‘/goodreads/’ endpoint, presumably looking up those IDs and matching them with Open Library entries where those IDs are in the Open Library database.

Since it’s free and easy I decided to try it out on this site. I’ll probably experiment with the Good Reads API sometime soon as well.

First challenge: Whether using Amazon, Open Library or Good Reads, I have to find a useful ID for the book starting with only the author and book title. Amazon, Open Library and Good Reads searches all return multiple editions of any book. Some books have been republished many times and have audio and e-book editions listed in search results. More on this later.

Second challenge: Picking the best edition to link to from the book images and review page so that the information found when looking up that edition is what I want: Publication year, publisher etc.

After today’s results it’s clear each auto-generated link requires some QA. A few books had entries in Open Library but no images; others have incorrect publication dates or default to returning audio versions of the books. Many books got a good image and good link on the first try though.

For instance “The Hitch-Hikers Guide to the Galaxy” gives an edition from 2005 if you pick the first match; but picking the earliest match gives a “first published” date of 1969 which is wrong. A few other books when searched for return ISBN numbers that Open Library can’t turn around and serve up, even though their database gave it to us in the results.

Today I focused on Open Library and used their search API in my Ruby site builder script. It’s quite simple to get results:


The search gives back JSON with listings for all matches; very often the first edition listed, or the edition with the oldest publication date is exactly what I want. What I want in this case is the ISBN, since the ISBN can be used to retrieve the cover image from Open Library and is useful for finding more information on the book elsewhere. As I said many books have lots of ISBNs but Open Library seems to keep the same cover image for all (most?) of them.


The results are fairly inconsistent in what fields are provided but at the least they have an OLID and normally one or more ISBNs. A “cover_i” field is usually included which looks to be the cover ID, but it appears it is associated with all the ISBNs already.

Here’s a sample of search results… just an excerpt of what you get back when looking for “The Long Dark Tea-Time of the Soul”


"title_suggest": "The long dark tea-time of the soul",
   "edition_key": [
   "cover_i": 8291276,
   "isbn": [

   "author_name": [
    "Douglas Adams"
   "contributor": [
    "Adams, Douglas."
   "ia_loaded_id": [
      "title": "The long dark tea-time of the soul",
   "lending_identifier_s": "longdarkteatime00adam",
   "ia_collection_s": "printdisabled;toronto;china;americana;internetarchivebooks;delawarecountydistrictlibrary;inlibrary",
   "publish_date": [
    "February 15, 1991",
    "June 2001",
    "February 2002",
    "December 1989",
    "June 1, 1993"
   "type": "work",
   "ebook_count_i": 2,
   "publish_place": [
    "New York",
   "ia_box_id": [
   "edition_count": 15,
   "first_publish_year": 1988,
   "key": "/works/OL2163717W",
   "id_goodreads": [
   "public_scan_b": false,
   "publisher": [
    "Simon and Schuster",
    "Pocket Books",
    "New Millennium Audio",
    "Audio Literature",
    "Guild Publishing"
   "language": [
   "lccn": [
   "last_modified_i": 1557895729,
   "lending_edition_s": "OL18536708M",
   "id_librarything": [
   "cover_edition_key": "OL18536708M",
   "first_sentence": [
    "It can hardly be a coincidence that no language on earth has ever produced the expression \"As pretty as an airport.\""
   "person": [
    "Dirk Gently"
   "publish_year": [
   "printdisabled_s": "OL17575335M;OL18536708M",
   "place": [
    "London (England)"

Good Reads provides an API with title search and perhaps I’ll find it easier to deal with automatically.