Skip to content

Have random books recommended to you from your terminal.

License

Notifications You must be signed in to change notification settings

demir-delic/confused-librarian

Repository files navigation

Confused Librarian

Get random book recommendations from the comfort of your terminal. If you like a book's description, a full eBook download is just a click away.

Confused Librarian picks a random word, then displays the description of a random book that contains that word.

Installation and Use

Prerequisites:

  • A free Google Books API key. Refer to the following documentation to obtain a key: https://developers.google.com/books/docs/v1/using#APIKey. This process takes less than 5 minutes with an existing Google account.
  • Node.js (v14 or above), Yarn 2, and a terminal emulator such as iTerm2. Not all terminal emulators support displaying images and clickable links.
  • Optional: An API key for WordsAPI. This API enables searching for books using a word bank of 300,000 words instead of 10,000. After obtaining an API key, use WordsAPI by running the script with the --expanded flag.

After fulfilling the prerequisites, clone this repository. Next, create an .env file at the project root and add your API keys to the file in the following format:

GOOGLE_BOOKS_API_KEY=YOUR_GOOGLE_KEY
RAPIDAPI_WORDS_API_KEY=YOUR_WORDS_KEY

Now you're ready to run the script. Thanks to zero-installs, there's no need for an installation step.

# get a random book recommendation
yarn start

# expand the list of potential books by using a larger word bank from WordsAPI
yarn start --expanded

# don't require a recommended book to include a description and download link
yarn start --lowdetail

# find a random book that contains a query that you specify
# includes --lowdetail in order to provide results for queries that have no downloadable books
yarn start --query "my query"

# learn about other options
yarn start --help

If you plan to contribute to the repository, you may find it helpful to read about Yarn 2's editor SDKs.

Motivation

I made this for fun to practice using Node.js and a few of its commonly used dependencies.

About

Have random books recommended to you from your terminal.

Resources

License

Stars

Watchers

Forks