wintr-amazon-scraper
v1.1.0
Published
Amazon data scraper using Wintr API
Downloads
12
Maintainers
Readme
wintr-amazon-scraper
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
Installation
npm i wintr-amazon-scraper
Usage
Instantiation
const w = new WintrAmazonScraper(options)
Where options are passed directly to Wintr (details here)
Scraping
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 informationgetByQuery(searchTerm, wintrOptions, rh)
returns items found when asking forsearchTerm
. Can be narrowed down to a category usingrh
Amazon paramgetByNodeId(id, wintrOptions)
returns items found in "Node" pagegetBestSellersByNodeSlug(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
Development
Tests and examples are not included in the Npm release to keep it lightweight. Use the repository for development
Example
An example application is included. Run it with :
npm run dev
Usage example
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)
})
Contributing
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