From 57a537c8444894820b4c79a6c05e74524fcbfec6 Mon Sep 17 00:00:00 2001 From: cubemaster21 Date: Tue, 13 Jun 2023 12:06:40 -0400 Subject: [PATCH] Added cruisinclassicsinc processor --- processors/cruisinclassicsinc.processor.js | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 processors/cruisinclassicsinc.processor.js diff --git a/processors/cruisinclassicsinc.processor.js b/processors/cruisinclassicsinc.processor.js new file mode 100644 index 0000000..66a3d56 --- /dev/null +++ b/processors/cruisinclassicsinc.processor.js @@ -0,0 +1,30 @@ +const _ = require('lodash'); +const genericVinParserFactory = require("./generics/generic-vin-parser"); + +module.exports = { + baseUrl: 'cruisinclassicsinc.com', + execute: 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; + + }, + parseVIN: async function (page) { + return null; + }, + parseMileage: async function (page) { + return null; + } + +} \ No newline at end of file