From ef29a83a1019e3b1e55db1a231b91456187e8011 Mon Sep 17 00:00:00 2001 From: rodrigotomees Date: Sat, 20 Mar 2021 14:45:03 +0100 Subject: [PATCH 1/2] Fixed stock check functionality in LDLC when the product is avalible by vendor Example: https://www.ldlc.com/es-es/ficha/PB00367772.html --- src/scripts/ldlc/scrape.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/ldlc/scrape.js b/src/scripts/ldlc/scrape.js index 8793265..e10abbc 100644 --- a/src/scripts/ldlc/scrape.js +++ b/src/scripts/ldlc/scrape.js @@ -9,7 +9,7 @@ module.exports = async ({ link }) => }, stock: { selector: '.modal-stock-web', - convert: x => x.includes('En stock') + convert: x => x.includes('En stock') || x.includes('Disponible') }, image: { selector: '#ctl00_cphMainContent_ImgProduct', From 3c3fd7afd10be55109bd818057475abd75daf7f7 Mon Sep 17 00:00:00 2001 From: rodrigotomees Date: Sat, 20 Mar 2021 14:45:27 +0100 Subject: [PATCH 2/2] Initial implementation of the Coolmod scraper --- src/scripts/coolmod/scrape.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/scripts/coolmod/scrape.js diff --git a/src/scripts/coolmod/scrape.js b/src/scripts/coolmod/scrape.js new file mode 100644 index 0000000..26cf818 --- /dev/null +++ b/src/scripts/coolmod/scrape.js @@ -0,0 +1,22 @@ +const scrape = require('scrape-it') + +module.exports = async ({ link }) => + ( + await scrape(link, { + price: { + selector: 'span[class="text-price-total"]', + how: x => Number(x.textContent.trim()) + }, + stock: { + selector: '.button-buy' + }, + image: { + selector: 'div.container-main-image a img', + attr: 'src' + }, + name: { + selector: '.product-first-part', + convert: x => x.textContent.trim() + } + }) + ).data