2017-11-26
Searching for Books in Command Line Interface (CLI)
announcement, blogentry, programming
announcement, blogentry, programming
Featured Image Credit -Photo by Redd Angelo on Unsplash
I'd like to show you a Node CLI (Command Line Interface), Google-Book-Shell I created from a throwaway code.
Here are the three things you can do with it.
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.
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.
Here is the README, which covers how to install it and use it more thoroughly.
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(--strip-amazon-affiliate or -s) in open command to strip it out in case you do not want that info in the link.
https://gist.github.com/dance2die/9ee9df6afe17cb10e5e2acb3e75be95c
(Please don't be mean to me 😞 )
Google-Book-Shell will make your book searching easier. If you find any issues or suggestions, please leave a feedback on the GitHub new issues page.
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 😊