diff --git a/app/Parser/OuestFrance.php b/app/Parser/OuestFrance.php index f807cee..fdf4cc8 100644 --- a/app/Parser/OuestFrance.php +++ b/app/Parser/OuestFrance.php @@ -18,9 +18,13 @@ class OuestFrance extends Parser $crawler = new Crawler($body); $parsedHome = new ParsedHome(); $parsedHome->title = $crawler->filter('h1')->text(); - $parsedHome->price = (int)str_replace(' ', '', $crawler->filter('#strongPrix')->text()); - $parsedHome->description = $crawler->filter('#blockonDescriptif')->text(); $details = $crawler->filter('#blocCaractAnn > ul > li'); + $price = $crawler->filter('#strongPrix'); + if (!$price instanceof Crawler) { + $price = $details->eq(0)->filter('strong')->text(); + } + $parsedHome->price = (int)str_replace(' ', '', $price->text()); + $parsedHome->description = $crawler->filter('#blockonDescriptif')->text(); $parsedHome->surface = (int)str_replace(' ', '', $details->eq(2)->filter('strong')->text()); $parsedHome->garden_surface = (int)str_replace(' ', '', $details->eq(3)->filter('strong')->text()); $parsedHome->rooms = (int)str_replace(' ', '', $details->eq(4)->filter('strong')->text());