Browse Source

🐛 Corrige le parsing du prix OuestFrance

Fix #23
main
Clément 1 month ago
parent
commit
fc9bbd9e4d
  1. 8
      app/Parser/OuestFrance.php

8
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());

Loading…
Cancel
Save