handle failed page fetch

This commit is contained in:
Bilal
2020-05-18 03:53:08 +02:00
parent 65068932ad
commit 159fedbc2d
4 changed files with 17 additions and 1 deletions

View File

@@ -202,6 +202,10 @@ class RentalCrawler {
const body = await adPageSource.text();
const $ = cheerio.load(body);
if (body.indexOf('<html') === -1) {
throw { message: 'Failed to fetch page !' }
}
const mapElementParent = $(".box-map").parent();
const scriptElement = $("script", mapElementParent);
if (