From c44c569aa5d1ce6b6bd9ffde46fadee330ca2107 Mon Sep 17 00:00:00 2001 From: Paul de Rosanbo Date: Sun, 1 Feb 2015 15:03:39 +0100 Subject: [PATCH] Add paru vendu immo bridge --- bridges/ParuVenduImmoBridge.php | 77 +++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 bridges/ParuVenduImmoBridge.php diff --git a/bridges/ParuVenduImmoBridge.php b/bridges/ParuVenduImmoBridge.php new file mode 100644 index 0000000..cbb420e --- /dev/null +++ b/bridges/ParuVenduImmoBridge.php @@ -0,0 +1,77 @@ +getURI().'/immobilier/annonceimmofo/liste/listeAnnonces?tt=1&tbMai=1&tbVil=1&tbCha=1&tbPro=1&tbHot=1&tbMou=1&tbFer=1'; + + if (isset($param['minarea'])) { + $link .= '&sur0='.urlencode($param['minarea']); + } + + if (isset($param['maxprice'])) { + $link .= '&px1='.urlencode($param['maxprice']); + } + + if (isset($param['pa'])) { + $link .= '&pa='.urlencode($param['pa']); + } + + if (isset($param['lo'])) { + $link .= '&lo='.urlencode($param['lo']); + } + + $html = file_get_html($link) or $this->returnError('Could not request paruvendu.', 404); + + + foreach($html->find('div.annonce a') as $element) { + + $img =''; + foreach($element->find('span.img img') as $img) { + if ($img->original) { + $img = ''; + } + } + + $desc = $element->find('span.desc')[0]->innertext; + $desc = str_replace("voir l'annonce", '', $desc); + + $price = $element->find('span.price')[0]->innertext; + + $item = new \Item(); + $item->uri = $this->getURI().$element->href; + $item->title = $element->title; + $item->content = $img.$desc.$price; + $this->items[] = $item; + + } + } + + public function getName(){ + return 'ParuVenduImmo'; + } + + public function getURI(){ + return 'http://www.paruvendu.fr'; + } + + public function getCacheDuration(){ + return 0; + return 3600; // 1 hour + } +}