wintr-amazon-scraper
Version:
Amazon data scraper using Wintr API
60 lines (57 loc) • 2.41 kB
JavaScript
const { constants } = require('wintr')
/**
* Wintr output schema for category bestsellers page
*/
const extractionSchemaForCategoryBestSellerPage = {
hasNextPage: {
[]: 'body',
[]: {
link: {
[]: '.a-pagination .a-selected + .a-normal a',
[]: 'href'
}
}
},
items: {
[]: '.a-list-item',
[]: {
title: {
[]: 'img:first-of-type',
[]: 'alt',
[]: [
constants.OUTPUT_SCHEMA_MODIFIERS.TRIM_RESULT
]
},
price: {
[]: '.a-color-price span',
[]: '*text*'
},
// @todo: Image source does not get extracted correctly.
// Possibly lazy-load & cache related. Should be inspected deeper as it had worked sometimes
image: {
[]: 'img:first-of-type',
[]: 'src'
},
rating: {
[]: '.a-icon-alt',
[]: '*text*',
[]: 'out of 5 stars',
[]: true,
[]: [
{
[]: ' out of 5 stars',
[]: ''
}
],
[]: [
constants.OUTPUT_SCHEMA_MODIFIERS.TO_NUMBER
]
},
link: {
[]: '.zg-item > a',
[]: 'href'
}
}
}
}
module.exports = { extractionSchemaForCategoryBestSellerPage }