Browse Source

bol.com fixes

master
Peetz0r 1 year ago
parent
commit
321c7e5f32
2 changed files with 4 additions and 5 deletions
  1. +3
    -4
      get-barcode.js
  2. +1
    -1
      test.js

+ 3
- 4
get-barcode.js View File

@ -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",
};
}
}


+ 1
- 1
test.js View File

@ -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);
})

Loading…
Cancel
Save