Compare commits
7 Commits
edit-locat
...
sliders-fo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6725355a0 | ||
|
|
259799144e | ||
|
|
bc73d4159d | ||
|
|
37ad32fe76 | ||
|
|
94875a0fa3 | ||
|
|
0c2d218d29 | ||
|
|
fed2dc00dc |
@@ -7,7 +7,42 @@ const PRICE_SLIDER_OPTIONS_SALE = {
|
|||||||
step: 1000,
|
step: 1000,
|
||||||
connect: true
|
connect: true
|
||||||
};
|
};
|
||||||
|
const FLAT_PRICE_SLIDER_OPTIONS_SALE = {
|
||||||
|
start: [50000, 150000],
|
||||||
|
range: {
|
||||||
|
min: [0],
|
||||||
|
max: [800000]
|
||||||
|
},
|
||||||
|
step: 5000,
|
||||||
|
connect: true
|
||||||
|
};
|
||||||
|
const HOUSE_PRICE_SLIDER_OPTIONS_SALE = {
|
||||||
|
start: [50000, 150000],
|
||||||
|
range: {
|
||||||
|
min: [0],
|
||||||
|
max: [1500000]
|
||||||
|
},
|
||||||
|
step: 10000,
|
||||||
|
connect: true
|
||||||
|
};
|
||||||
|
const OFFICE_PRICE_SLIDER_OPTIONS_SALE = {
|
||||||
|
start: [15000, 50000],
|
||||||
|
range: {
|
||||||
|
min: [0],
|
||||||
|
max: [2000000]
|
||||||
|
},
|
||||||
|
step: 2000,
|
||||||
|
connect: true
|
||||||
|
};
|
||||||
|
const LAND_PRICE_SLIDER_OPTIONS_SALE = {
|
||||||
|
start: [40000, 80000],
|
||||||
|
range: {
|
||||||
|
min: [0],
|
||||||
|
max: [2000000]
|
||||||
|
},
|
||||||
|
step: 10000,
|
||||||
|
connect: true
|
||||||
|
};
|
||||||
const PRICE_SLIDER_OPTIONS_RENT = {
|
const PRICE_SLIDER_OPTIONS_RENT = {
|
||||||
start: [300, 500],
|
start: [300, 500],
|
||||||
range: {
|
range: {
|
||||||
@@ -17,18 +52,62 @@ const PRICE_SLIDER_OPTIONS_RENT = {
|
|||||||
step: 50,
|
step: 50,
|
||||||
connect: true
|
connect: true
|
||||||
};
|
};
|
||||||
|
const FLAT_PRICE_SLIDER_OPTIONS_RENT = {
|
||||||
|
start: [300, 600],
|
||||||
|
range: {
|
||||||
|
min: [0],
|
||||||
|
max: [4000]
|
||||||
|
},
|
||||||
|
step: 100,
|
||||||
|
connect: true
|
||||||
|
};
|
||||||
|
const HOUSE_PRICE_SLIDER_OPTIONS_RENT = {
|
||||||
|
start: [500, 1000],
|
||||||
|
range: {
|
||||||
|
min: [0],
|
||||||
|
max: [10000]
|
||||||
|
},
|
||||||
|
step: 100,
|
||||||
|
connect: true
|
||||||
|
};
|
||||||
|
const OFFICE_PRICE_SLIDER_OPTIONS_RENT = {
|
||||||
|
start: [200, 1000],
|
||||||
|
range: {
|
||||||
|
min: [0],
|
||||||
|
max: [20000]
|
||||||
|
},
|
||||||
|
step: 100,
|
||||||
|
connect: true
|
||||||
|
};
|
||||||
|
const LAND_PRICE_SLIDER_OPTIONS_RENT = {
|
||||||
|
start: [500, 1000],
|
||||||
|
range: {
|
||||||
|
min: [0],
|
||||||
|
max: [20000]
|
||||||
|
},
|
||||||
|
step: 100,
|
||||||
|
connect: true
|
||||||
|
};
|
||||||
//This will be used for Flats, Apartments, Houses
|
//This will be used for Flats, Apartments, Houses
|
||||||
const HOME_SIZE_SLIDER_OPTIONS = {
|
const HOME_SIZE_SLIDER_OPTIONS = {
|
||||||
start: [30, 75],
|
start: [30, 75],
|
||||||
range: {
|
range: {
|
||||||
min: [0],
|
min: [0],
|
||||||
max: [400]
|
max: [500]
|
||||||
},
|
},
|
||||||
step: 5,
|
step: 5,
|
||||||
connect: true
|
connect: true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const OFFICE_SIZE_SLIDER_OPTIONS = {
|
||||||
|
start: [30, 150],
|
||||||
|
range: {
|
||||||
|
min: [0],
|
||||||
|
max: [1200]
|
||||||
|
},
|
||||||
|
step: 10,
|
||||||
|
connect: true
|
||||||
|
};
|
||||||
const GARDEN_SIZE_SLIDER_OPTIONS = {
|
const GARDEN_SIZE_SLIDER_OPTIONS = {
|
||||||
start: [100, 1000],
|
start: [100, 1000],
|
||||||
range: {
|
range: {
|
||||||
@@ -111,8 +190,8 @@ const AD_CATEGORY = {
|
|||||||
hasNumberOfRoom: true,
|
hasNumberOfRoom: true,
|
||||||
hasNumberOfFloors: false,
|
hasNumberOfFloors: false,
|
||||||
hasFloorProp: true,
|
hasFloorProp: true,
|
||||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
priceSliderOptionsSale: FLAT_PRICE_SLIDER_OPTIONS_SALE,
|
||||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
priceSliderOptionsRent: FLAT_PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
||||||
},
|
},
|
||||||
HOUSE: {
|
HOUSE: {
|
||||||
@@ -126,8 +205,8 @@ const AD_CATEGORY = {
|
|||||||
hasNumberOfRoom: true,
|
hasNumberOfRoom: true,
|
||||||
hasNumberOfFloors: true,
|
hasNumberOfFloors: true,
|
||||||
hasFloorProp: false,
|
hasFloorProp: false,
|
||||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
priceSliderOptionsSale: HOUSE_PRICE_SLIDER_OPTIONS_SALE,
|
||||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
priceSliderOptionsRent: HOUSE_PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS,
|
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS,
|
||||||
gardenSizeSliderOptions: GARDEN_SIZE_SLIDER_OPTIONS
|
gardenSizeSliderOptions: GARDEN_SIZE_SLIDER_OPTIONS
|
||||||
},
|
},
|
||||||
@@ -142,9 +221,9 @@ const AD_CATEGORY = {
|
|||||||
hasNumberOfRoom: true,
|
hasNumberOfRoom: true,
|
||||||
hasNumberOfFloors: false,
|
hasNumberOfFloors: false,
|
||||||
hasFloorProp: true,
|
hasFloorProp: true,
|
||||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
priceSliderOptionsSale: OFFICE_PRICE_SLIDER_OPTIONS_SALE,
|
||||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
priceSliderOptionsRent: OFFICE_PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
sizeSliderOptions: OFFICE_SIZE_SLIDER_OPTIONS
|
||||||
},
|
},
|
||||||
LAND: {
|
LAND: {
|
||||||
id: "LAND",
|
id: "LAND",
|
||||||
@@ -157,8 +236,8 @@ const AD_CATEGORY = {
|
|||||||
hasNumberOfRoom: false,
|
hasNumberOfRoom: false,
|
||||||
hasNumberOfFloors: false,
|
hasNumberOfFloors: false,
|
||||||
hasFloorProp: false,
|
hasFloorProp: false,
|
||||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
priceSliderOptionsSale: LAND_PRICE_SLIDER_OPTIONS_SALE,
|
||||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
priceSliderOptionsRent: LAND_PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: LAND_SIZE_SLIDER_OPTIONS
|
sizeSliderOptions: LAND_SIZE_SLIDER_OPTIONS
|
||||||
},
|
},
|
||||||
APARTMENT: {
|
APARTMENT: {
|
||||||
@@ -172,8 +251,8 @@ const AD_CATEGORY = {
|
|||||||
hasNumberOfRoom: true,
|
hasNumberOfRoom: true,
|
||||||
hasNumberOfFloors: false,
|
hasNumberOfFloors: false,
|
||||||
hasFloorProp: true,
|
hasFloorProp: true,
|
||||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
priceSliderOptionsSale: FLAT_PRICE_SLIDER_OPTIONS_SALE,
|
||||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
priceSliderOptionsRent: FLAT_PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS
|
||||||
},
|
},
|
||||||
GARAGE: {
|
GARAGE: {
|
||||||
@@ -202,8 +281,8 @@ const AD_CATEGORY = {
|
|||||||
hasNumberOfRoom: true,
|
hasNumberOfRoom: true,
|
||||||
hasNumberOfFloors: true,
|
hasNumberOfFloors: true,
|
||||||
hasFloorProp: false,
|
hasFloorProp: false,
|
||||||
priceSliderOptionsSale: PRICE_SLIDER_OPTIONS_SALE,
|
priceSliderOptionsSale: HOUSE_PRICE_SLIDER_OPTIONS_SALE,
|
||||||
priceSliderOptionsRent: PRICE_SLIDER_OPTIONS_RENT,
|
priceSliderOptionsRent: HOUSE_PRICE_SLIDER_OPTIONS_RENT,
|
||||||
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS,
|
sizeSliderOptions: HOME_SIZE_SLIDER_OPTIONS,
|
||||||
gardenSizeSliderOptions: GARDEN_SIZE_SLIDER_OPTIONS
|
gardenSizeSliderOptions: GARDEN_SIZE_SLIDER_OPTIONS
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -312,7 +312,7 @@ class RentalCrawler {
|
|||||||
|
|
||||||
let numberOfRooms =
|
let numberOfRooms =
|
||||||
parseInt(extractedData["re_realEstates_roomsNO"]) +
|
parseInt(extractedData["re_realEstates_roomsNO"]) +
|
||||||
parseInt(extractedData["re_realEstates_bedroomNO"]) || null,
|
parseInt(extractedData["re_realEstates_bedNO"]) || null,
|
||||||
numberOfFloors =
|
numberOfFloors =
|
||||||
parseInt(extractedData["re_realEstates_floorsNO"]) ||
|
parseInt(extractedData["re_realEstates_floorsNO"]) ||
|
||||||
this.getNumberOfFloorsFromFloorId(extractedData["re_floorNO_id"]),
|
this.getNumberOfFloorsFromFloorId(extractedData["re_floorNO_id"]),
|
||||||
@@ -352,7 +352,9 @@ class RentalCrawler {
|
|||||||
realEstatePropertiesFromInfrastructure.phoneConnection,
|
realEstatePropertiesFromInfrastructure.phoneConnection,
|
||||||
cableTV = realEstatePropertiesFromInfrastructure.cableTV,
|
cableTV = realEstatePropertiesFromInfrastructure.cableTV,
|
||||||
internet = realEstatePropertiesFromInfrastructure.internet,
|
internet = realEstatePropertiesFromInfrastructure.internet,
|
||||||
basementAttic = realEstatePropertiesFromSpaces.basementAttic,
|
basementAttic =
|
||||||
|
realEstatePropertiesFromSpaces.basementAttic ||
|
||||||
|
this.checkBasemAtticFromFloors(extractedData["re_floorNO_id"]),
|
||||||
storeRoom = realEstatePropertiesFromSpaces.storeRoom,
|
storeRoom = realEstatePropertiesFromSpaces.storeRoom,
|
||||||
videoSurveillance =
|
videoSurveillance =
|
||||||
realEstatePropertiesFromDescriptions.videoSurveillance ||
|
realEstatePropertiesFromDescriptions.videoSurveillance ||
|
||||||
@@ -397,9 +399,7 @@ class RentalCrawler {
|
|||||||
);
|
);
|
||||||
if (!publishedDateMoment.isValid()) {
|
if (!publishedDateMoment.isValid()) {
|
||||||
throw {
|
throw {
|
||||||
message: `Invalid published date : ${
|
message: `Invalid published date : ${extractedData["re_realEstates_inserted"]}`
|
||||||
extractedData["re_realEstates_inserted"]
|
|
||||||
}`
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,9 +410,7 @@ class RentalCrawler {
|
|||||||
);
|
);
|
||||||
if (!renewedDateMoment.isValid()) {
|
if (!renewedDateMoment.isValid()) {
|
||||||
throw {
|
throw {
|
||||||
message: `Invalid renewed date : ${
|
message: `Invalid renewed date : ${extractedData["re_realEstates_edited"]}`
|
||||||
extractedData["re_realEstates_edited"]
|
|
||||||
}`
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -782,8 +780,42 @@ class RentalCrawler {
|
|||||||
if (floorIds.length === 0) {
|
if (floorIds.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
let noOfFloors = floorIds.length;
|
||||||
|
// Floors of 'suteren', 'podrum', 'tavan' and 'potkrovlje' are not counted
|
||||||
|
floorIds.forEach(id => {
|
||||||
|
if (
|
||||||
|
parseInt(id) === 1 ||
|
||||||
|
parseInt(id) === 2 ||
|
||||||
|
parseInt(id) === 12 ||
|
||||||
|
parseInt(id) === 14
|
||||||
|
) {
|
||||||
|
noOfFloors--;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return noOfFloors;
|
||||||
|
}
|
||||||
|
|
||||||
return floorIds.length;
|
checkBasemAtticFromFloors(floorsIdText) {
|
||||||
|
// floorIdText can be array of numbers, separated by comma or number
|
||||||
|
const floorIds = floorsIdText.split(",");
|
||||||
|
|
||||||
|
let check = false;
|
||||||
|
|
||||||
|
if (floorIds.length === 0) {
|
||||||
|
check = false;
|
||||||
|
}
|
||||||
|
//If floors 'suteren', 'podrum', 'tavan' and 'potkrovlje' exists then tag for basement-attic is true
|
||||||
|
floorIds.forEach(id => {
|
||||||
|
if (
|
||||||
|
parseInt(id) === 1 ||
|
||||||
|
parseInt(id) === 2 ||
|
||||||
|
parseInt(id) === 12 ||
|
||||||
|
parseInt(id) === 14
|
||||||
|
) {
|
||||||
|
check = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return check;
|
||||||
}
|
}
|
||||||
|
|
||||||
async sleep(ms) {
|
async sleep(ms) {
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ if (urlToScrape) {
|
|||||||
})();
|
})();
|
||||||
} else {
|
} else {
|
||||||
console.log("No URL to scrape. Use like this : ");
|
console.log("No URL to scrape. Use like this : ");
|
||||||
console.log("npm run test-olx-scraper -- URL_TO_SCRAPE");
|
console.log("npm run test-rental-scraper -- URL_TO_SCRAPE");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user