This is a simple Amazon web scraper built using Node.js and Express, designed to extract product details and reviews from Amazon.com. It utilizes the Scraper API to bypass restrictions imposed by Amazon. You can use this scraper to collect information from Amazon product pages for various purposes, such as market research, price tracking, or data analysis.
Before using this Amazon web scraper, make sure you have the following prerequisites installed on your machine:
- Node.js: This project is built using Node.js. You will need it to run the server.
- npm: Node Package Manager is required to install project dependencies.
Follow these steps to set up and use the Amazon web scraper:
-
Clone this repository to your local machine:
git clone https://github.com/your-username/amazon-web-scraper.git
-
Navigate to the project directory:
cd amazon-web-scraper
-
Install project dependencies:
npm install
-
Obtain a Scraper API Key:
- You need an API Key from Scraper API to make requests to Amazon. Sign up for an account and obtain your API key. You can set your API key by updating the
APIKeyvariable inapp.js.
- You need an API Key from Scraper API to make requests to Amazon. Sign up for an account and obtain your API key. You can set your API key by updating the
-
Run the server:
node app.js
The server will start running on the default port 5000 or the port specified in your environment variables.
The scraper server listens on http://localhost:5000 by default. You can access the following endpoints to scrape data:
-
GET /This is the root endpoint and can be used to check if the server is running.
-
GET /products/:productIdUse this endpoint to get details of a specific Amazon product. Replace
:productIdwith the Amazon product's unique identifier found in its URL. For example, if the product's URL ishttps://www.amazon.com/dp/B08H7Y1YJ3, the:productIdwould beB08H7Y1YJ3. -
GET /products/:productId/reviewsThis endpoint allows you to retrieve product reviews for a specific Amazon product. Replace
:productIdwith the product's unique identifier as mentioned above.
The server will respond with JSON data containing the scraped information.
To get product details, you can make a GET request like this:
curl http://localhost:5000/products/B08H7Y1YJ3
This will return a JSON response containing details about the specified product.
When using this scraper, be sure to comply with Amazon's Terms of Service and the applicable laws and regulations governing web scraping in your jurisdiction. This scraper is intended for educational and research purposes.
This repository is provided for educational and informational purposes only. The authors are not responsible for any misuse or violation of terms and conditions by users of this software.
Happy scraping!