Amazon Product Scraper
![npm](https://img.shields.io/npm/v/amazon-buddy.svg?style=for-the-badge)
Useful tool to scrape product information from the amazon
If you like this tool then please Star it
![Buy Me A Coffee](https://cdn.buymeacoffee.com/buttons/default-blue.png)
Features
- Scrape products from amazon search result: asin, rating, number of reviews, price, title, url, sponsored or not, discounted or not
- Scrape reviews from amazon search result: title, review, rating, reviewer name and date when it was posted
- Sort result by rating(stars)
- Sort result by sponsored products only
- Sorts result by discounted products only
- Result can be save to a CSV file
- You can scrape up to 500 produtcs and 1000 reviews
Product List
Review List
![alt text](https://i.imgur.com/HuBW3rl.png)
Note:
- Empty parameter = empty value
Possible errors
- If there will be let me know
Installation
Install from NPM
$ npm i -g amazon-buddy
Install from YARN
$ yarn global add amazon-buddy
USAGE
Terminal
$ amazon-buddy --help
Usage: amazon-buddy <command> [options]
Commands:
amazon-buddy products scrape products from the provided key word
amazon-buddy reviews scrape reviews from a product
Options:
--help, -h help [boolean]
--version Show version number [boolean]
--keyword, -k Amazon search keyword ex. 'Xbox one' [string] [default: ""]
--asin, -a To scrape reviews you need to provide product ASIN(amazon
product id) [string] [default: ""]
--number, -n Number of products to scrape. Maximum 100 products or 300 reviews [default: 10]
--save, -s Save to a CSV file? [boolean] [default: true]
--sort If searching for a products then list will be sorted by a higher
score(reviews*rating). If searching for a reviews then they will
be sorted by rating. [boolean] [default: false]
--discount, -d Scrape only products with the discount
[boolean] [default: false]
--sponsored Scrape only sponsored products [boolean] [default: false]
--min-rating Minimum allowed rating [default: 1]
--max-rating Maximum allowed rating [default: 5]
--host, -H The custom amazon host (can be www.amazon.fr, www.amazon.de, etc.)
[string] [default: "www.amazon.com"]
--random-ua Randomize user agent version. This helps to prevent request
blocking from the amazon side [boolean] [default: false]
--timeout, -t Timeout between requests. Timeout is set in mls: 1000 mls = 1
second [number] [default: 0]
Examples:
amazon-buddy products -k 'Xbox one'
amazon-buddy products -k 'Xbox one' -h 'www.amazon.fr'
amazon-buddy reviews -a B01GW3H3U8
Example 1
Scrape 40 producs from the "vacume cleaner" keyword and save everything to a CSV file
$ amazon-buddy products -k 'vacume cleaner' -n 40
The file will be saved in a folder from which you run the script:
1552945544582_products.csv
Example 2
Scrape 100 reviews from a product by using ASIN.
NOTE: ASIN is a uniq amazon product ID, it can be found in product URL or if you have scraped product list with our tool you will find it in a CSV file
$ amazon-buddy reviews -a B01GW3H3U8 -n 100
The file will be saved in a folder from which you run the script:
1552945544582_B01GW3H3U8_reviews.csv
Example 3
Scrape 300 producs from the "xbox one" keyword with rating minimum rating 3 and maximum rating 4 and save everything to a CSV file
$ amazon-buddy products -k 'xbox one' -n 300 --min-rating 3 --max-rating 4
The file will be saved in a folder from which you run the script:
1552945544582_products.csv
Module
Promise
const amazonScraper = require('amazon-buddy');
(async() => {
try{
let products = await amazonScraper.products({keyword: 'Xbox One', number: 50, save: true });
let reviews = await amazonScraper.rewviews({asin: 'B01GW3H3U8', number: 50, save: true });
let products_rank = await amazonScraper.products({keyword: 'Xbox One', number: 50, rating:[3,5] });
let reviews_rank = await amazonScraper.rewviews({asin: 'B01GW3H3U8', number: 50, rating: [1,2] });
}catch(error){
console.log(error);
}
})()
Event
- You won't be able to use promises.
- {sort} and {save} will be ignored
const amazonScraper = require('amazon-buddy');
let products = amazonScraper.products({
keyword: 'xbox',
number: 50,
event: true,
});
products.on('error message', error => {
console.log(error);
});
products.on('item', item => {
console.log(item);
});
products.on('completed', () => {
console.log('completed');
});
products._startScraper();
JSON/CSV output(products):
[{
asin: 'B01N6HLV9L',
discounted: false,
sponsored: false,
amazonChoice: true,
price: '$32.99',
before_discount: '$42.99',
title:'product title',
url:'long amazon url'
}...]
JSON/CSV output(reviews):
[{
id: 'R335O5YFEWQUNE',
review_data: '6-Apr-17',
name: 'Bob',
title: 'Happy Gamer',
rating: 5,
review: 'blah blah blah'
}...]
Options
let options = {
keyword: "",
number: 10,
event: false,
save: false,
proxy: "",
rating:[1,5],
sort: false,
discount: false,
sponsored: false,
host: "www.amazon.de",
randomeUa: false
timeout: 0
};
![Buy Me A Coffee](https://cdn.buymeacoffee.com/buttons/default-blue.png)
License
MIT
Free Software