WIP Fake vip ads.

This commit is contained in:
Naida Vatric
2020-01-10 19:20:26 +01:00
parent 49161c1b60
commit 1658325c4b
2 changed files with 16 additions and 3 deletions

View File

@@ -183,7 +183,19 @@ class ProstorCrawler {
async scrapeAd(realEstate) {
const { lat, lng, property_name, price, size, link, status } = realEstate;
//console.log("[PROSTOR] Scraping : ", url);
//Status information is given already in realestate list
//For VIP Ads status ='' canot be used, but also area='0' we will use that temporary
//It is weird because yesterday it said 'VIP ponuda' ???
const adStatus =
size === "0"
? ProstorCrawler.getStatusId("VIP ponuda")
: ProstorCrawler.getStatusId(status);
//
console.log("adStatus", adStatus);
const url = `https://prostor.ba${link}`;
// console.log("[PROSTOR] Scraping : ", url);
try {
const adPageSource = await fetch(url);
const body = await adPageSource.text();
@@ -330,7 +342,6 @@ class ProstorCrawler {
furnishingType = FURNISHING_TYPE.NOT_FURNISHED.id;
}
const adStatus = ProstorCrawler.getStatusId(status);
const title = property_name;
const parsedPrice = parseFloat(price.replace(/\./g, "")) || null;
const parsedArea = parseFloat(size);
@@ -539,6 +550,8 @@ class ProstorCrawler {
}
static getStatusId(statusText) {
//
console.log("statusText u funkciji", statusText);
switch (statusText) {
case "":
return AD_STATUS.STATUS_NORMAL;

View File

@@ -32,6 +32,6 @@
<script>
window.onload = function() {
document.getElementById("realEstateUrl").click();
//document.getElementById("realEstateUrl").click();
};
</script>