Excellent, thanks Charles.
I can tell you that my technique seems to be working fine, if you want
to try it too.
Construct a URL:
Requset the URL. Grep the response for "book is temporarily
unavailable"--if you get it, there's no search inside the book. If you
don't get it, there is search inside the book. (Sadly, it's still a 200
HTTP status in response, either way).
I want to look at if I can just do a HEAD request and tell the
difference between presence and absence of search inside by the
advertised length of the response. That's Terry Reese's preferred way of
doing a check for legitimate content at the end of a URL, trying to
guess from content length with just a HEAD request. Not sure if that
will work here or not. Would potentially be somewhat more efficient if
Charles Ledvina wrote:
> I've been trying to do this same thing for quite some time. I can
> tell with some certainty that there is NO search-inside-the-book info
> within the API response.
> --Charles Ledvina
> Jonathan Rochkind wrote:
>> Anyoen more familiar with Amazon Web Services than me (AWS) and know
>> the answer to this?
>> Can I tell from my AWS API response if search inside the book is
>> available? Is that information anywhere?
>> Right now, I'm calculating what the search inside the book URL
>> _would_ be from the ASIN (which I get from the AWS), and then making
>> a request to that url---and then screen-scraping for the phrase
>> "temporarily unavailable" which is what they say if search inside the
>> book doesn't exist. Sadly, they don't return 404 status in this case,
>> they return 200 status with that message.
>> But this is messy. And slows down my app, since I need to make a
>> second http request to amazon.
>> Anyone know if there's any way to predict it from the AWS response?
>> The AWS documentation and my actual in practice AWS response examples
>> are both overwhelming and confusing me. :)
Digital Services Software Engineer
The Sheridan Libraries
Johns Hopkins University
rochkind (at) jhu.edu