moar fixes
This commit is contained in:
@@ -228,16 +228,18 @@ class OlxCrawler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const hamo = []
|
||||||
const { scrapedData, errors } = await PromisePool
|
const { scrapedData, errors } = await PromisePool
|
||||||
.withConcurrency(2)
|
.withConcurrency(2)
|
||||||
.for(asyncScraping)
|
.for(asyncScraping)
|
||||||
.process(async data => {
|
.process(async data => {
|
||||||
const result = await this.scrapeAd(data)
|
const result = await this.scrapeAd(data)
|
||||||
await this.sleep(this.delayBetweenPages);
|
await this.sleep(this.delayBetweenPages);
|
||||||
return result;
|
hamo.push(result)
|
||||||
|
return result; //TODO: this does not work, scrapedData is null, hamo works
|
||||||
})
|
})
|
||||||
|
|
||||||
const filteredScrapedData = scrapedData.filter(adData => !!adData);
|
const filteredScrapedData = hamo.filter(adData => !!adData);
|
||||||
return filteredScrapedData;
|
return filteredScrapedData;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Exception caught:" + e);
|
console.error("Exception caught:" + e);
|
||||||
|
|||||||
Reference in New Issue
Block a user