From 6464846d1e6ee9c339f71abca1a2284051ad22ac Mon Sep 17 00:00:00 2001 From: Nick White Date: Tue, 23 Jun 2020 13:51:02 +0100 Subject: [iiifdownloader] Add support for BNF urls with a dot after book id --- cmd/iiifdownloader/main.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'cmd/iiifdownloader') diff --git a/cmd/iiifdownloader/main.go b/cmd/iiifdownloader/main.go index 03a15bc..f6ad6ca 100644 --- a/cmd/iiifdownloader/main.go +++ b/cmd/iiifdownloader/main.go @@ -15,6 +15,9 @@ import ( const usage = `Usage: iiifdownloader url Downloads all pages from a IIIF server. + +Currently supports the following IIIF using services: +- BNF's Gallica (any book or page URL should work) ` const bnfPrefix = `https://gallica.bnf.fr/ark:/` @@ -73,8 +76,15 @@ func main() { if len(f) < 2 { log.Fatalln("Failed to extract BNF book ID from URL") } - bookid := f[0] + "/" + f[1] - bookdir = f[0] + "-" + f[1] + var lastpart string + dot := strings.Index(f[1], ".") + if dot == -1 { + lastpart = f[1] + } else { + lastpart = f[1][0:dot] + } + bookid := f[0] + "/" + lastpart + bookdir = f[0] + "-" + lastpart pgurlStart = "https://gallica.bnf.fr/iiif/ark:/" + bookid + "/f" pgurlEnd = "/full/full/0/native.jpg" -- cgit v1.2.1-24-ge1ad