diff --git a/processors/generics/generic-showCarThumbs.js b/processors/generics/generic-showCarThumbs.js new file mode 100644 index 0000000..5e98eee --- /dev/null +++ b/processors/generics/generic-showCarThumbs.js @@ -0,0 +1,22 @@ +const _ = require('lodash'); +const genericVinParserFactory = require("./generics/generic-vin-parser"); +module.exports = function (config) { + return async function (page) { + const pageLoadIndicator = '.show-car-thumbs'; + await page.waitForSelector(pageLoadIndicator); + const imageSelector = '.show-car-thumbs > a'; + const images = await page.$$(imageSelector); + console.log(`Found ${images.length} images...`) + const sources = await Promise.all(images.map(async carouselItem => { + const src = await page.evaluate(el => el.getAttribute('data-original'), carouselItem); + if(!src) { + return {} + } + // console.log(src); + return { url: src }; + })); + return sources; + + } + +} \ No newline at end of file