Bob Matyas

JavaScript Bookmarklet for Book Cover Images

Posted on by Bob Matyas

OpenLibrary.org Logo

While working on a project to track books, I wanted to find a quick way to get book covers. OpenLibrary.org โ€“ a project to aimed at creating a complete digital library โ€“ has a nice covers API that allows for this. They have an easy system where covers are always available via a predictable URL and no API authentication is required.

To make the process quicker, I made a quick JavaScript bookmarklet (Github Gist):

javascript: (() => {
  const isbn = prompt("Enter the 9 or 13 Digit ISBN for the book")
  if (isbn != null) {
    const coverImage = `https://covers.openlibrary.org/b/isbn/${isbn}-L.jpg`
    navigator.clipboard.writeText(coverImage)
    alert(`${coverImage}\n\n Cover Image URL Copied to clipboard.`)
  }
})()

You can add it to your browserโ€™s bookmarks and it takes an ISBN and returns the URL for cover image and copies it to the clipboard for ease of use.