diff options
-rw-r--r-- | cmd/rescribe/gui.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/cmd/rescribe/gui.go b/cmd/rescribe/gui.go index 3de29e3..a75b816 100644 --- a/cmd/rescribe/gui.go +++ b/cmd/rescribe/gui.go @@ -45,6 +45,9 @@ var trainingNames = map[string]string{ // getBookIdFromUrl returns a 12 character Google Book ID from // a Google URL, or an error if one can't be found. +// Example URLs: +// https://books.google.it/books?id=QjQepCuN8JYC +// https://www.google.it/books/edition/_/VJbr-Oe2au0C func getBookIdFromUrl(url string) (string, error) { lurl := strings.ToLower(url) if len(url) == 12 && !strings.ContainsAny(url, "?/:") { @@ -56,10 +59,6 @@ func getBookIdFromUrl(url string) (string, error) { return "", err } - if matchUrl == false && !strings.HasPrefix(lurl, "https://books.google") { - return "", fmt.Errorf("Not a Google Books URL") - } - if strings.HasPrefix(lurl, "https://books.google") { start := strings.Index(lurl, "?id=") if start == -1 { |