Compare commits
16 Commits
edit-locat
...
add-more-r
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
756a233a49 | ||
|
|
259799144e | ||
|
|
bc73d4159d | ||
|
|
37ad32fe76 | ||
|
|
94875a0fa3 | ||
|
|
0c2d218d29 | ||
|
|
fed2dc00dc | ||
|
|
a7855a3de6 | ||
|
|
9e3ca6c621 | ||
|
|
e60e818952 | ||
|
|
e6054824a6 | ||
|
|
cb175595db | ||
|
|
3157973552 | ||
|
|
5ff10fc62d | ||
|
|
5e0de499e8 | ||
|
|
851fef45b0 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -2,4 +2,4 @@ node_modules/
|
||||
.env
|
||||
.idea/
|
||||
.eslintrc
|
||||
.vscode/
|
||||
.vscode/
|
||||
|
||||
@@ -312,7 +312,7 @@ class RentalCrawler {
|
||||
|
||||
let numberOfRooms =
|
||||
parseInt(extractedData["re_realEstates_roomsNO"]) +
|
||||
parseInt(extractedData["re_realEstates_bedroomNO"]) || null,
|
||||
parseInt(extractedData["re_realEstates_bedNO"]) || null,
|
||||
numberOfFloors =
|
||||
parseInt(extractedData["re_realEstates_floorsNO"]) ||
|
||||
this.getNumberOfFloorsFromFloorId(extractedData["re_floorNO_id"]),
|
||||
@@ -352,7 +352,9 @@ class RentalCrawler {
|
||||
realEstatePropertiesFromInfrastructure.phoneConnection,
|
||||
cableTV = realEstatePropertiesFromInfrastructure.cableTV,
|
||||
internet = realEstatePropertiesFromInfrastructure.internet,
|
||||
basementAttic = realEstatePropertiesFromSpaces.basementAttic,
|
||||
basementAttic =
|
||||
realEstatePropertiesFromSpaces.basementAttic ||
|
||||
this.checkBasemAtticFromFloors(extractedData["re_floorNO_id"]),
|
||||
storeRoom = realEstatePropertiesFromSpaces.storeRoom,
|
||||
videoSurveillance =
|
||||
realEstatePropertiesFromDescriptions.videoSurveillance ||
|
||||
@@ -397,9 +399,7 @@ class RentalCrawler {
|
||||
);
|
||||
if (!publishedDateMoment.isValid()) {
|
||||
throw {
|
||||
message: `Invalid published date : ${
|
||||
extractedData["re_realEstates_inserted"]
|
||||
}`
|
||||
message: `Invalid published date : ${extractedData["re_realEstates_inserted"]}`
|
||||
};
|
||||
}
|
||||
|
||||
@@ -410,9 +410,7 @@ class RentalCrawler {
|
||||
);
|
||||
if (!renewedDateMoment.isValid()) {
|
||||
throw {
|
||||
message: `Invalid renewed date : ${
|
||||
extractedData["re_realEstates_edited"]
|
||||
}`
|
||||
message: `Invalid renewed date : ${extractedData["re_realEstates_edited"]}`
|
||||
};
|
||||
}
|
||||
|
||||
@@ -782,8 +780,42 @@ class RentalCrawler {
|
||||
if (floorIds.length === 0) {
|
||||
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) {
|
||||
|
||||
@@ -13,5 +13,5 @@ if (urlToScrape) {
|
||||
})();
|
||||
} else {
|
||||
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