summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2013-10-13 14:26:46 +0100
committerNick White <git@njw.me.uk>2013-10-13 14:26:46 +0100
commitecfae19def66b9ff37dfe356a5169a6103523225 (patch)
tree0ee435fa749577886e8df0dab50b768bfae539f8
parenta0feb5d267d5fd8d5e8837c2e3ae891116f5943c (diff)
Download best possible quality images from google books
-rw-r--r--getgbook.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/getgbook.c b/getgbook.c
index 6f2342a..bc04a96 100644
--- a/getgbook.c
+++ b/getgbook.c
@@ -103,16 +103,20 @@ int getpageurls(char *pagecode, char *cookie)
break;
}
}
- if(j == -1) /* TODO: it would be good to add new page on the end */
+ if(j == -1) /* TODO: it would be good to add new page on the end */
break; /* of structure rather than throw it away. */
- for(p=pages[j]->url, q=(pages[j]->url-(STRMAX-13-1)), d=c+strlen("\"src\":")+1; *d && *d != '"' && p != q; d++, p++) {
+ for(p=pages[j]->url, q=(pages[j]->url-(STRMAX-13-1)), d=c+strlen("\"src\":")+1;
+ *d && *d != '"' && p != q;
+ d++, p++) {
if(!strncmp(d, "\\u0026", 6)) {
*p = '&';
d+=5;
} else
*p = *d;
}
- strncpy(p, "&q=subject:a", 13);
+ /* w=2500 gets the best available quality pages */
+ /* q=subject:a is needed for robots.txt compliance */
+ strncpy(p, "&w=2500&q=subject:a", 20);
pages[j]->cookie = cookie;
break;
}