[ParuVenduImmo] fix: try to repair broken css selectors (#2641)

* [ParuVenduImmo] fix: try to repair broken css selectors

Needs more work.
This commit is contained in:
Dag 2022-04-12 23:37:54 +02:00 committed by GitHub
parent b6e8350596
commit 57c8806954
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,7 +28,9 @@ class ParuVenduImmoBridge extends BridgeAbstract {
public function collectData(){
$html = getSimpleHTMLDOM($this->getURI());
foreach($html->find('div.annonce a') as $element) {
$elements = $html->find('#bloc_liste > div.ergov3-annonce a');
foreach($elements as $element) {
if(!$element->title) {
continue;
@ -41,10 +43,19 @@ class ParuVenduImmoBridge extends BridgeAbstract {
}
}
$desc = $element->find('span.desc')[0]->innertext;
$desc = str_replace("voir l'annonce", '', $desc);
$description = $element->find('p', 0);
if ($description) {
$desc = str_replace("voir l'annonce", '', $description->innertext);
} else {
$desc = '';
}
$price = $element->find('span.price')[0]->innertext;
$priceElement = $element->find('div.ergov3-priceannonce', 0);
if ($priceElement) {
$price = $priceElement->innertext;
} else {
$price = '';
}
list($href) = explode('#', $element->href);