summaryrefslogtreecommitdiff
path: root/getabook.c
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2011-09-29 19:25:13 +0100
committerNick White <git@njw.me.uk>2011-09-29 19:25:13 +0100
commit6d992fbe0ee99dda0ec450d9d3f8941118414d37 (patch)
tree2542dfad64413716040cd0f13de2b4d0ce955727 /getabook.c
parent399438e4a78777db9230968ef5902915b4c814ce (diff)
Use canonical asin for any amazon book
Diffstat (limited to 'getabook.c')
-rw-r--r--getabook.c7
1 files changed, 7 insertions, 0 deletions
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\":[");