summaryrefslogtreecommitdiff
path: root/getabook.c
diff options
context:
space:
mode:
authorNick White <git@njw.name>2020-05-20 14:28:04 +0100
committerNick White <git@njw.name>2020-05-20 14:28:04 +0100
commit0e4276a1ac3b6683619179a180fd76ecd20dc54b (patch)
tree51606575f2602ec926e94ece07aaf918cdcdcb66 /getabook.c
parentf2265c79b7d7460ec91ebf79a891bbe5c689e7c6 (diff)
Fix getabook
There were two things that needed to be changed to get getabook to work again: - HTTPS usage - Disabling HTTP compression
Diffstat (limited to 'getabook.c')
-rw-r--r--getabook.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/getabook.c b/getabook.c
index 6f7d2fd..f8d8215 100644
--- a/getabook.c
+++ b/getabook.c
@@ -15,7 +15,7 @@
" -n download pages from numbers in stdin\n" \
" otherwise, all available pages will be downloaded\n"
-#define USESSL 0
+#define USESSL 1
#define URLMAX 2048
#define STRMAX 1024
#define MAXPAGES 9999
@@ -75,8 +75,10 @@ int getpagelist()
snprintf(url, URLMAX, "/gp/search-inside/service-data?method=getBookData&asin=%s", bookid);
- if(!get("www.amazon.com", USESSL, url, NULL, NULL, &buf, 1))
+ if(!get("www.amazon.com", USESSL, url, NULL, NULL, &buf, 1)) {
+ fprintf(stderr, "failed to get url %s\n", url);
return 1;
+ }
/* amazon have a canonical asin, which is needed to get all available pages */
if((s = strstr(buf, "\"ASIN\":\"")) != NULL) {
@@ -154,7 +156,7 @@ int getpage(Page *page)
return 1;
}
- if(!sscanf(page->url, "http://%[^/]/", host)) {
+ if(!sscanf(page->url, "https://%[^/]/", host)) {
fprintf(stderr, "can't parse host of %s\n", page->url);
return 1;
}