This package aims to make Amazon marketplace products data retrieval easy, using wintr service and its unofficial wrapper alongside with amazon-url-builder
It basically wraps Wintr and AmazonUrlBuilder together, exposing methods to scrap typical Amazon pages
npm i wintr-amazon-scraper
const w = new WintrAmazonScraper(options)
Where options are passed directly to Wintr (details here)
Four methods are available for now. Options such as the ones use for instantiation can be passed, overriding defaults.
-
getByProductId(id, wintrOptions)
returns parsed product information -
getByQuery(searchTerm, wintrOptions, rh)
returns items found when asking forsearchTerm
. Can be narrowed down to a category usingrh
Amazon param -
getByNodeId(id, wintrOptions)
returns items found in "Node" page -
getBestSellersByNodeSlug(nodeSlug, wintrOptions)
returns items found in "Category BestSellers" page
When the result is split in various pages, a link for the next page is returned with the data
Tests and examples are not included in the Npm release to keep it lightweight. Use the repository for development
An example application is included. Run it with :
npm run dev
const { WintrAmazonScraper } = require('wintr-amazon-scraper')
const { constants } = require('wintr')
const w = new WintrAmazonScraper({
[constants.PARAMETERS.API_KEY]: 'XXX',
[constants.PARAMETERS.JS_RENDERING]: true
})
w.getByProductId('B07QY8LDGX')
.then(console.log)
.catch(err => {
console.log(err, err.response.data)
})
Issue reports, pull requests, suggestions and comments are very welcome !
Please keep in mind that this repo use commitizen -style commit messages and follow js standard's style