From c19c8fbcdf22bb863e85a47c209c242c19c2b16c Mon Sep 17 00:00:00 2001 From: Nick White Date: Sun, 17 Jul 2011 15:52:53 +0100 Subject: Use book id rather than isbn --- getgbook.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/getgbook.c b/getgbook.c index df5de6f..37506c3 100644 --- a/getgbook.c +++ b/getgbook.c @@ -5,7 +5,7 @@ #include "util.c" #define usage "getgbook " VERSION " - a google books downloader\n" \ - "usage: getgbook [-i ip] [-p|-a] isbn\n" \ + "usage: getgbook [-i ip] [-p|-a] bookid\n" \ " -p print all available pages\n" \ " -a download all available pages\n" \ " -i appear from ip address\n" \ @@ -22,26 +22,6 @@ typedef struct { char extrahdr[1024] = "\0"; -char *getbookid(char *isbn) -{ - char url[URLMAX]; - char *buf, *bookid, *c; - - snprintf(url, URLMAX, "/books/feeds/volumes?q=isbn:%s", isbn); - - if(!get("books.google.com", url, extrahdr, &buf)) - return NULL; - - if((c = strstr(buf,"")) == NULL) - return NULL; - bookid = malloc(sizeof(char *) * BOOKID_LEN); - strncpy(bookid, c+15, BOOKID_LEN); - bookid[BOOKID_LEN] = '\0'; - free(buf); - - return bookid; -} - int gettotalpages(char *bookid) { char url[URLMAX]; @@ -126,8 +106,7 @@ int main(int argc, char *argv[]) argc-=2; } - if((bookid = getbookid(argv[argc-1])) == NULL) - die("Could not find book\n"); + bookid = argv[argc-1]; if(argv[1][0] == '-') { /* note this isn't the best way, not least because it misses the -- cgit v1.2.3