From df5e38092dbe46f4ad0ebafc91bb01d07e56a667 Mon Sep 17 00:00:00 2001 From: Naida Vatric Date: Fri, 28 Feb 2020 17:12:55 +0100 Subject: [PATCH] Decomment and saljic smal fix. --- app/crawler/specificCrawlers/olx.js | 13 +++++++------ app/crawler/specificCrawlers/saljic.js | 12 ++++++++---- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/app/crawler/specificCrawlers/olx.js b/app/crawler/specificCrawlers/olx.js index 7d4cf66..548d5ac 100644 --- a/app/crawler/specificCrawlers/olx.js +++ b/app/crawler/specificCrawlers/olx.js @@ -248,11 +248,12 @@ class OlxCrawler { ) .text() .trim(); - // - console.log("Title:", title); - console.log("Url scraped:", url); - console.log("Normal price value:", normalPriceValue); - console.log("Urgent price value:", urgentPriceValue); + + //Debug + //console.log("Title:", title); + //console.log("Url scraped:", url); + // console.log("Normal price value:", normalPriceValue); + // console.log("Urgent price value:", urgentPriceValue); // if (normalPriceValue && normalPriceValue.length > 0) { normalPrice = normalPriceValue @@ -668,7 +669,7 @@ class OlxCrawler { numberOfViewsAgency }; // - console.log("Scraped data:", data); + //console.log("Scraped data:", data); return data; } catch (e) { diff --git a/app/crawler/specificCrawlers/saljic.js b/app/crawler/specificCrawlers/saljic.js index aa1d3f4..8afc751 100644 --- a/app/crawler/specificCrawlers/saljic.js +++ b/app/crawler/specificCrawlers/saljic.js @@ -274,10 +274,14 @@ class SaljicCrawler { .trim(); const latAndLongSrc = $(propertySelectors.latAndLong).attr("src"); - const tmpLatLong = latAndLongSrc.split("marker=")[1]; - const latText = tmpLatLong.split("%2C")[0]; - const longText = tmpLatLong.split("%2C")[1]; - + let tmpLatLong; + let latText; + let longText; + if (latAndLongSrc) { + tmpLatLong = latAndLongSrc.split("marker=")[1]; + latText = tmpLatLong.split("%2C")[0]; + longText = tmpLatLong.split("%2C")[1]; + } const locationLat = parseFloat(latText) || null; const locationLong = parseFloat(longText) || null;