You've probably experienced that Google Books often rejects lookup requests, making it unusable. Internet Archive's Open Library can easily be used as Custom Source when searching via ISBN barcode scan. Here's the custom source script if anyone finds it helpful:
function getBookInfo(isbn) {
// The Open Library Books API endpoint
var url = "
https://www.openlibrary.org/api/books?bibkeys=ISBN:" + isbn + "&format=json&jscmd=data";
var response = http().get(url);
if (response.code == 200) {
var data = JSON.parse(response.body);
var bookKey = "ISBN:" + isbn;
var book = data[bookKey];
if (book) {
// Extract author names into a single comma-separated string
var authors = "";
if (book.authors) {
var authorList = [];
for (var i = 0; i < book.authors.length; i++) {
authorList.push(book.authors[i].name);
}
authors = authorList.join(", ");
}
// Return the array object Memento expects
return [{
// Memento UI fields (Required for the popup list)
title: book.title,
desc: authors,
thumb: book.cover ? book.cover.medium : "",
// Custom data fields we will map in the next step
book_title: book.title,
book_author: authors,
isbn: isbn,
book_date: book.publish_date || "",
book_pages: book.number_of_pages ? book.number_of_pages.toString() : "",
book_publisher: book.publishers ? book.publishers[0].name : "",
book_cover: book.cover ? book.cover.large : ""
}];
} else {
return [{ title: "No match found in Open Library" }];
}
}
return [{ title: "API Error: " + response.code }];
}
// Execute the function using Memento's global 'query' variable
result(getBookInfo(query));