In the next article we are going to take a look at AmzSear. This utility is an unofficial CLI and API from Amazon. Will allow us easily search the Amazon product directory from the command line without the need for an Amazon API key. This is something interesting at this time as Amazon and other firms are preparing their battle stocks with discounts, exclusive products and other attractions for buyers.
AmzSear is a script unofficial to work with Amazon. With amzSear we will have at our disposal the possibility of being able to easily search for products on Amazon from the command line and see the basic information of the product, such as all the prices of different sellers, the URL, the classifications of any product, directly from the window of your terminal, without using the Amazon API. This utility is freely available at GitHub and is released under the MIT license.
Install AmzSear on Ubuntu 17.10
AmzSear requires a version Python 2.7 or higher to function properly. We will have to make sure we have pip installed on our system. If pip is not installed, we will be able to install it in a simple way as shown below.
In Ubuntu and its derivatives, we will only have to open the terminal (Ctrl + Alt + T) and execute the following command to install pip:
sudo apt install python-pip
Once we have pip installed, we will install AmzSear in the same terminal using pip with the command:
sudo pip install amzsear
How to use AmzSear
El standard command to use amzSear it will be:
amzsear query_string [-p num [-i num]] [-q] [-v] [-d]
Search for a product by name
Let's try to find a product, such as the book «A River in Darkness: One Man's Escape from North Korea«. For this we will write:
amzsear 'A River in Darkness: One Mans Escape from North Korea'
It will show us the results based on our search string in Amazon product directory in our terminal. In this example only one result will be displayed.
We will also be shown the results in our web browser predetermined.
We do not have to give the exact search term. We may use the relevant search terms as it could be for this example «A River in Darkness»And see the results both in the terminal and in the browser.
View results per page
The AmzSear script will only show us the result of the first page. But also we can specify the particular page number as it's shown in the following:
amzsear 'A River in Darkness' -p 2
This command, like the previous ones, will show us the results of the second page of the Amazon product directory both in the terminal and in the browser.
View results in browser only
If we do not want the result to be shown in the terminal but in the web browser, we will be able to use the -q option as it's shown in the following.
amzsear 'A River in Darkness' -p 2 -q
As I say, this command will show the second page of the result only in the web browser. We will not see any results in the terminal.
View results only in terminal
In the same way, if we want to see the result only in the terminal and not in the web browser, we will have to use the -d option.
amzsear 'A River in Darkness' -p 2 -d
See all product information
In order for the terminal to show all the information about the product, such as the name, the URL, all the prices and the classification chain, etc., we will have to add the -v option.
amzsear 'A River in Darkness' -d -v
This command will show us the first page of the result only in the terminal. We may request that any other page be shown to us. We will also be shown all the details, such as the URL, the prices of different sellers and the ratings of the products shown, as you can see in the screenshot above.
These results will not show in the browser, since we include the -d option. If we wanted to view the result both in the terminal and in the browser, we would only have to remove the -d option from the command.
Warning
Those who use this script frequently to search for products on Amazon will have to be careful. Amazon has marked many similar scripts as a bot and has banned IP addresses that send repetitive queries. Thus, it's a good idea to run it through a VPN or proxy. It's also a good idea to limit our searches until the developer comes up with a solution.
Uninstall AmzSear
To eliminate this script from our system, we will only have to open a terminal (Ctrl + Alt + T) and write the following command in it:
sudo pip uninstall amzsear