summaryrefslogtreecommitdiff
path: root/getgbook.c
diff options
context:
space:
mode:
authorNick White <hg@njw.me.uk>2011-07-17 15:52:53 +0100
committerNick White <hg@njw.me.uk>2011-07-17 15:52:53 +0100
commitc19c8fbcdf22bb863e85a47c209c242c19c2b16c (patch)
treef34addf5cedb471e7dd50962d2ad6cdd064afeff /getgbook.c
parent6ca2e52598ec57d7e54a46315daf1e7018b8333f (diff)
Use book id rather than isbn
Diffstat (limited to 'getgbook.c')
-rw-r--r--getgbook.c25
1 files 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,"<dc:identifier>")) == 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