Support multiple commas in zestimate (#15)

Signed-off-by: Don Zickus <dzickus@redhat.com>
This commit is contained in:
dzickusrh
2024-12-10 03:04:52 -05:00
committed by GitHub
parent aeb6a48ddd
commit b3dd876989
+1 -1
View File
@@ -25,7 +25,7 @@ async function getZestimate(URL) {
const dom = new jsdom.JSDOM(html); const dom = new jsdom.JSDOM(html);
const zestimateText = dom.window.document.getElementById('home-details-home-values').getElementsByTagName('h3')[0].textContent; const zestimateText = dom.window.document.getElementById('home-details-home-values').getElementsByTagName('h3')[0].textContent;
return parseInt(zestimateText.replace('$', '').replace(',', '')) * 100; return parseInt(zestimateText.replace('$', '').replaceAll(',', '')) * 100;
} catch (error) { } catch (error) {
console.log('Error parsing Zillow page:'); console.log('Error parsing Zillow page:');
console.log(error); console.log(error);