From 321c7e5f3213b73ba54021694ce647ae4a94c073 Mon Sep 17 00:00:00 2001 From: Peetz0r Date: Sun, 29 Mar 2020 18:17:21 +0200 Subject: [PATCH] bol.com fixes --- get-barcode.js | 7 +++---- test.js | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/get-barcode.js b/get-barcode.js index 43a1f1e..6c334d6 100644 --- a/get-barcode.js +++ b/get-barcode.js @@ -219,13 +219,13 @@ function getBarcode_bolCom(barcode) { if (response.statusCode === 200) { let $ = cheerio.load(response.body); - let productName = cleanValue($(".pdp-header__title").text()); + let productName = cleanValue($(".product-title").text()); if (productName.length > 0) { return { name: productName, - image: $(".js_product_img").attr("src"), - price: `€ ${cleanValue($(".promo-price").text())}` + image: $(".product-image img").attr("src").replace("/regular/", "/extralarge/"), + price: `€ ${cleanValue($("meta[itemprop=price]").attr('content')).replace(".", ",")}`, }; } } @@ -249,7 +249,6 @@ function getBarcode_calorielijst(barcode) { return { name: productName, image: (image != "") ? `http://img.calorielijst.nl/product/${image}` : null, - //~ price: "N/A", }; } } diff --git a/test.js b/test.js index 7f6ceba..f95c37c 100644 --- a/test.js +++ b/test.js @@ -5,7 +5,7 @@ const Promise = require("bluebird"); const getBarcode = require("./get-barcode"); Promise.try(() => { - return getBarcode("8718265015388"); + return getBarcode("8716309087797"); }).then((result) => { console.log(result); })