Skip to content

Commit 1e224bb

Browse files
committed
2 parents da50309 + e83ee48 commit 1e224bb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const getProductDetails = async(url, merchant) => {
6161
});
6262
const $ = cheerio.load(res.data);
6363
const selector = selectors[merchant];
64-
const price = parseInt($(selector.price1).text().trim().replace(/^\D+|[^0-9.]/g, '')) || parseInt($(selector.price2).text().trim().replace(/^\D+|[^0-9.]/g, ''));
64+
const price = parseFloat($(selector.price1).text().trim().replace(/^\D+|[^0-9.]/g, '')) || parseFloat($(selector.price2).text().trim().replace(/^\D+|[^0-9.]/g, ''));
6565
const title = $(selector.title).text().trim();
6666
const image = $(selector.image1).attr('src');
6767
if(!title || !price) {
@@ -74,4 +74,4 @@ const getProductDetails = async(url, merchant) => {
7474
}
7575
}
7676

77-
export { isUrl, getRandomId, getProductDetails, productCommonUrl };
77+
export { isUrl, getRandomId, getProductDetails, productCommonUrl };

0 commit comments

Comments
 (0)