@chewhx/google-books
v4.0.1
Published
Search for books on Google Books
Downloads
657
Readme
@chewhx/google-books - v4
- Javascript Wrapper to search for books on Google Books API.
- Promise-based
- Requires NodeJS 18+
- No dependencies. Uses native
fetch
api. - No authentication or API Key needed.
- More info: https://developers.google.com/books/docs/v1/using
[!NOTE] From experience, the results for each api call might differ slightly, even with the same parameters.
Installation
npm install @chewhx/google-books
Imports
Note: All methods a promise.
import { search, title, id, author, isbn } from '@chewhx/google-books';
Types
import { Query, Params } from '@chewhx/google-books';
search
- Takes in
query
andparams
argument - The first argument
query
is required. query.q
is a required field
// search(query, params)
search({ q: 'Atomic Habits' });
search
- special keywords
search({ q: 'Atomic Habits', inauthor: 'James Clear' });
- intitle: Returns results where the text following this keyword is found in the title.
- inauthor: Returns results where the text following this keyword is found in the author.
- inpublisher: Returns results where the text following this keyword is found in the publisher.
- subject: Returns results where the text following this keyword is listed in the category list of the volume.
- isbn: Returns results where the text following this keyword is the ISBN number.
- lccn: Returns results where the text following this keyword is the Library of Congress Control Number. oclc: Returns results where the text following this keyword is the Online Computer Library Center number.
search
- q
can be empty string.
search({ q: '', intitle: 'Atomic Habits', inauthor: 'James Clear' });
search
- specific parameters
Read more about API-specific query parameters
search({ q: 'Atomic Habits' }, { maxResults: 2 });
search({ q: 'Atomic Habits' }, { download: 'epub' });
id
Search for book with google books volume id
id('lFhbDwAAQBAJ');
title
Search for book with only title
title('atomic habits');
author
Search for book with only author
author('James Clear');
isbn
Search for book with only isbn
isbn('978-0735211292');