From 53d5098cec400918818a621ad2607def15d4c7e1 Mon Sep 17 00:00:00 2001 From: orangecoding Date: Mon, 3 Nov 2025 20:01:55 +0100 Subject: [PATCH] fixing wrong number extraction --- lib/provider/regionalimmobilien24.js | 2 +- lib/services/storage/listingsStorage.js | 5 +++-- package.json | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/provider/regionalimmobilien24.js b/lib/provider/regionalimmobilien24.js index fc73c65..3e78ca4 100755 --- a/lib/provider/regionalimmobilien24.js +++ b/lib/provider/regionalimmobilien24.js @@ -8,7 +8,7 @@ function normalize(o) { const title = o.title || 'No title available'; const link = o.link != null ? decodeURIComponent(o.link) : config.url; - var urlReg = new RegExp(/url\((.*?)\)/gim); + const urlReg = new RegExp(/url\((.*?)\)/gim); const image = o.image != null ? urlReg.exec(o.image)[1] : null; return Object.assign(o, { id, address, title, link, image }); } diff --git a/lib/services/storage/listingsStorage.js b/lib/services/storage/listingsStorage.js index 94e96f8..fef1ca6 100755 --- a/lib/services/storage/listingsStorage.js +++ b/lib/services/storage/listingsStorage.js @@ -152,8 +152,9 @@ export const storeListings = (jobId, providerId, listings) => { */ function extractNumber(str) { if (!str) return null; - const match = str.replace(/[.,]/g, '').match(/\d+/); - return match ? +match[0] : null; + const cleaned = str.replace(/\./g, '').replace(',', '.'); + const num = parseFloat(cleaned); + return isNaN(num) ? null : num; } /** diff --git a/package.json b/package.json index f2720ad..0a33e19 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fredy", - "version": "14.3.2", + "version": "14.3.3", "description": "[F]ind [R]eal [E]states [d]amn eas[y].", "scripts": { "prepare": "husky",