Here are the three things you can do with it.
- You can search for a book from Google Books.
- The searched book detail can be viewed.
- Open the book on Google Books or Amazon page in a browser.
I am a voracious reader being a somewhat bibliophile. Searching for books online was slow due to an overhead of browser too slow. At the time, I was learning how to create a Node CLI application as well as ES6 syntax. I just decided to write a program on a whim.
Google-Book-Shell in Action
OK, I’ve rambled on too much. Here is the CLI in action (It’s a GIF but click to go to YouTube video).
Here is the basic workflow.
- Search for a book with a search command.
- View the detail of a book with a view command.
- Optionally open the link in a browser (to Google Books or Amazon website) with an open command.
Here is the README, which covers how to install it and use it more thoroughly.
Notes on Open command
When you open an Amazon page, the CLI queries Amazon’s Product Advertising API (PAA) via Azure Functions. I didn’t want to expose my Amazon Product Key and Secret so I moved the PAA query functionality to Azure Functions (after failed attempt to use AWS Lambda…). Azure Functions sleeps after 5 minutes of inactivity so opening an Amazon page for the first time could take 10~30 seconds unfortunately for I have used a pay-per-use plan.
PAA requires a developer to sign up for Amazon Affiliate Program. Thus the Amazon link returned adds a finger print with my affiliate info. I’ve added a flag(
open command to strip it out in case you do not want that info in the link.
(Please don’t be mean to me 😞 )
I will write another entry on technical challenges I had as well as the architecture (and lack thereof).
WARNING: By the way, the source is very sloppy since it was built from a throwaway code while learning ES6 😊