diff options
author | Nick White <git@njw.me.uk> | 2013-10-13 14:26:46 +0100 |
---|---|---|
committer | Nick White <git@njw.me.uk> | 2013-10-13 14:26:46 +0100 |
commit | ecfae19def66b9ff37dfe356a5169a6103523225 (patch) | |
tree | 0ee435fa749577886e8df0dab50b768bfae539f8 /getgbook.c | |
parent | a0feb5d267d5fd8d5e8837c2e3ae891116f5943c (diff) |
Download best possible quality images from google books
Diffstat (limited to 'getgbook.c')
-rw-r--r-- | getgbook.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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; } |