From 6d992fbe0ee99dda0ec450d9d3f8941118414d37 Mon Sep 17 00:00:00 2001 From: Nick White Date: Thu, 29 Sep 2011 19:25:13 +0100 Subject: Use canonical asin for any amazon book --- getabook.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/getabook.c b/getabook.c index ac88f6d..1ac09cb 100644 --- a/getabook.c +++ b/getabook.c @@ -68,6 +68,13 @@ int getpagelist() if(!get("www.amazon.com", url, NULL, NULL, &buf)) return 1; + /* amazon have a canonical asin, which is needed to get all available pages */ + if((s = strstr(buf, "\"ASIN\":\"")) != NULL) { + s+=strlen("\"ASIN\":\""); + strncpy(bookid, s, 10); + bookid[10] = '\0'; + } + if((s = strstr(buf, "\"litbPages\":[")) == NULL) return 1; s+=strlen("\"litbPages\":["); -- cgit v1.2.3