Added node schedule to run crawler and notification service
This commit is contained in:
@@ -36,23 +36,26 @@ module.exports = class OlxCrawler {
|
||||
const urls = this.createRequestUrls(realestateRequests);
|
||||
let results = await this.indexPages(urls, this.fromPage, this.toPage, this.maxResults);
|
||||
console.log("Final crawler results");
|
||||
console.log(results[0].length);
|
||||
if (results[0]) {
|
||||
console.log(results[0].length);
|
||||
|
||||
for (const finalResult of results[0]) {
|
||||
for (const finalResult of results[0]) {
|
||||
|
||||
if (null !== finalResult) {
|
||||
if (finalResult.lat !== undefined && finalResult.lat !== null && finalResult.lat !== "") {
|
||||
const pointInsideBoundingBox = await findPointInsideBoundingBox([finalResult.lng, finalResult.lat], finalResult.email);
|
||||
if (null !== finalResult) {
|
||||
if (finalResult.lat !== undefined && finalResult.lat !== null && finalResult.lat !== "") {
|
||||
const pointInsideBoundingBox = await findPointInsideBoundingBox([finalResult.lng, finalResult.lat], finalResult.email);
|
||||
|
||||
if (pointInsideBoundingBox[0].length !== 0) {
|
||||
filteredResults.push(finalResult);
|
||||
if (pointInsideBoundingBox[0].length !== 0) {
|
||||
filteredResults.push(finalResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log("OLX CRAWLER: number of olx crawler results, after geo location filtering: " + filteredResults.length);
|
||||
return filteredResults;
|
||||
console.log("OLX CRAWLER: number of olx crawler results, after geo location filtering: " + filteredResults.length);
|
||||
return filteredResults;
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
createRequestUrls(realestateRequests) {
|
||||
|
||||
Reference in New Issue
Block a user