Skip to content

chewhx/google-books

Repository files navigation

@chewhx/google-books - v4

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 and params argument
  • The first argument query is required.
  • query.q is a required field
// search(query, params)
search({ q: 'Atomic Habits' });
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');