You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ListingExtractor/processors/superstockamx.processor.js

34 lines
1.1 KiB
JavaScript

const genericVinParserFactory = require("./generics/generic-vin-parser");
module.exports = {
baseUrl: 'superstockamx.com',
async execute(page) {
const gallerySelector = '.main-bg'
const imageSelector = 'img';
await page.waitForSelector(gallerySelector);
const images = await page.$$(imageSelector);
const sources = await Promise.all(images.map(async carouselItem => {
const src = await page.evaluate(el => el.getAttribute('src'), carouselItem);
if(src.startsWith('data:image')) {
//base 64 pasted image
console.log('Found base64 image.')
return {base64: src};
} else if(src.startsWith('http')) {
return { url: src };
} else {
return {
url: module.exports.baseUrl + '/' + src
}
}
}));
return sources;
},
parseVIN: async function (page) {
return null;
},
parseMileage: async function (page) {
return null;
}
}