2

Im using Google Books API in order to get some covers of books.

In order to get them I use the following url:

"http://books.google.com/books/content?id=" + id + "&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api"

Where id is unique for a book.

For example, for the Harry Potter book, the following returns the cover:

http://books.google.com/books/content?id=o-QCOFDHmPEC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api

However, there are some cases where there is no book cover, such as:

http://books.google.com/books/content?id=xsXnngEACAAJ&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api

I was wondering if there is some method to know if an image has content or if it is not available in order to place some image for example in those place instead of keeping it like this.

Thank you

Ben
  • 1,737
  • 2
  • 30
  • 61
  • Is this a Java question or a Javascript one? By the way, if you have no direct fileserver access to the Google fileserver, which you probably don't have, there is no other way to check for a picture than to validate the return value of the server sided script. – paladin Oct 03 '20 at 01:05
  • It is a Java question , sorry. What do you mean by validate? Like to check the size of the image or so? – Ben Oct 03 '20 at 07:22
  • Yes, something like that, but it might even be possible to just check the filename. At least try to check the hashvalue. – paladin Oct 04 '20 at 05:34
  • Could you please explain the hashvalue with regard to the link above? from my poor knowledge it is something that should start with # and there is none in the link. – Ben Oct 04 '20 at 11:29
  • I was talking about secure hash algorithms -> _https://en.wikipedia.org/wiki/Secure_Hash_Algorithms_ you can use these to validate something, like a specific file or some specific file attributes. For example, you create a sha2(256) hash value of your `image not available` image, save that hash value within your downloader app, and compare every downloaded picture's hash value with that one. If both hash values match, you know that image is not available. – paladin Oct 04 '20 at 12:31

0 Answers0