🚑 Repair Safti parser
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Clement Desmidt 2022-12-14 14:32:09 +01:00
parent c0d61cafdd
commit 0221064b1a

View File

@ -29,13 +29,15 @@ class Safti extends Parser
$parsed_home->title = $property_single->filter('h1')->text(); $parsed_home->title = $property_single->filter('h1')->text();
$parsed_home->price = $currency_formatter $parsed_home->price = $currency_formatter
->parseCurrency($property_single->filter('.property__price')->text(), $currency); ->parseCurrency($property_single->filter('.property__price')->text(), $currency);
$parsed_home->city = $property_single->children()->children('div')->eq(1)->filter('p.h4')->text(); $parsed_home->city = $property_single?->children()?->children('div')?->eq(0)?->filter('p.h4')?->text();
$parsed_home->description = $crawler->filter('[data-testid="real-estate-annonce-single-description"]')->text(); $parsed_home->description = $crawler->filter('[data-testid="real-estate-annonce-single-description"]')->text();
$property__additionals = $crawler->filter('.property__additionals'); $property__additionals = $crawler->filter('.property__additionals');
$energies = $property__additionals->filter('.energetic-indicator'); $energies = $property__additionals->filter('.energetic-indicator');
if ($energies->count() > 0) { if ($energies->count() >= 1) {
$parsed_home->energy = substr($energies->eq(0)->text(), 0, 1); $parsed_home->energy = substr($energies->eq(0)->text(), 0, 1);
}
if ($energies->count() >= 2) {
$parsed_home->ges = substr($energies->eq(1)->text(), 0, 1); $parsed_home->ges = substr($energies->eq(1)->text(), 0, 1);
} }