How to extract hi-res png images from Amazon “Look Inside the Book” feature?

I have been gathering book previews from google books and from amazon manually on Firefox using the debugger tools Inspect element, under the Network tab with an image filter. It is tedious so I wanted to automate if I could.

I found a convenient tool written in C (getxbook) with three utilities: one for google, another for amazon, and a third for barnes and noble. Only the google utility seems to work.

I’m attempting to understand the request URL for the amazon images so that I can automate in Node.js.

Here is the URL for a hi-res book image:

https://d1b14unh5d6w7g.cloudfront.net/1405193557.01.S00R.JUMBOXXX.jpg?Expires=1596719655&Signature=N69M9pndwI5lhb35vd2XNBC/DAxYpGKIqG+gvhHrY7icH3DxB+DZ8oOZT/pqLJbRiJeHVkBiOTWOqA7wpNctg4fa/MwnvLiZ8jBIOKEJsJ1jhT9Lma4KGCaUapyji3oqz0p/qf42OuGISoKeXjoCX9d9ghbKU1QiIPq6evaLypc=&Key-Pair-Id=APKAIUO27P366FGALUMQ

From this page, it is clear that Amazon is using CloudFront signed URLs in order to secure the transaction.

First the pieces that I understand:

  • 1405193557 is the ISBN10
  • S00R is the page number (page 14 in this case), the next will be S00S (page 15), etc.
  • JUMBOXXX gives the hi-res (800×1205) [XXXXXXXX gives the low-res (600×903)]
  • Key-Pair-Id: is the same for all pages
  • Expires: increments of time in seconds
  • Signature: 172 characters, always ends with ‘=’, seems to be base64 encoding

The pieces I need to understand still are:

  • Signature: at some point in the loading, the library (sitb-library-js.js) fetches all of the image urls from the server, with the signatures pregenerated

What I’d like is a way to insert code that prints the list of jumboImageUrls[] once it has been populated. I’ve got no idea how to go forward with this – greasemonkey?

Any thoughts or experience appreciated.

Answer

A post is made to https://www.amazon.ca/gp/search-inside/service-data . The response holds a list of image URLs with signature.

enter image description here

enter image description here