e-scraper
Version:
Collect products, reviews, locations from a different E-Commerce stores. Currently supporting Target.Com and soon more.
16 lines (15 loc) • 760 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.reviews = exports.product = void 0;
const core_1 = require("./core");
const constant_1 = require("./constant");
const eScraper = async ({ number = 30, offset = 0, keyword, storeId, sponsoredProducts, store, productId }, type) => {
if (!core_1.eStores[store]) {
throw `Unsupported store. Supported stores: ${constant_1.config.supportedStores}`;
}
const scraper = new core_1.eStores[store]({ number, offset, keyword, storeId, sponsoredProducts, productId });
const result = await scraper[type]();
return result;
};
exports.product = async (options) => eScraper(options, 'product');
exports.reviews = async (options) => eScraper(options, 'reviews');