mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-09-02 20:52:44 +02:00
Reformat codebase v4 (#2872)
Reformat code base to PSR12 Co-authored-by: rssbridge <noreply@github.com>
This commit is contained in:
@@ -1,112 +1,115 @@
|
||||
<?php
|
||||
class ParuVenduImmoBridge extends BridgeAbstract {
|
||||
|
||||
const MAINTAINER = 'polo2ro';
|
||||
const NAME = 'Paru Vendu Immobilier';
|
||||
const URI = 'https://www.paruvendu.fr';
|
||||
const CACHE_TIMEOUT = 10800; // 3h
|
||||
const DESCRIPTION = 'Returns the ads from the first page of search result.';
|
||||
class ParuVenduImmoBridge extends BridgeAbstract
|
||||
{
|
||||
const MAINTAINER = 'polo2ro';
|
||||
const NAME = 'Paru Vendu Immobilier';
|
||||
const URI = 'https://www.paruvendu.fr';
|
||||
const CACHE_TIMEOUT = 10800; // 3h
|
||||
const DESCRIPTION = 'Returns the ads from the first page of search result.';
|
||||
|
||||
const PARAMETERS = array( array(
|
||||
'minarea' => array(
|
||||
'name' => 'Minimal surface m²',
|
||||
'type' => 'number'
|
||||
),
|
||||
'maxprice' => array(
|
||||
'name' => 'Max price',
|
||||
'type' => 'number'
|
||||
),
|
||||
'pa' => array(
|
||||
'name' => 'Country code',
|
||||
'exampleValue' => 'FR'
|
||||
),
|
||||
'lo' => array(
|
||||
'name' => 'department numbers or postal codes, comma-separated'
|
||||
)
|
||||
));
|
||||
const PARAMETERS = [ [
|
||||
'minarea' => [
|
||||
'name' => 'Minimal surface m²',
|
||||
'type' => 'number'
|
||||
],
|
||||
'maxprice' => [
|
||||
'name' => 'Max price',
|
||||
'type' => 'number'
|
||||
],
|
||||
'pa' => [
|
||||
'name' => 'Country code',
|
||||
'exampleValue' => 'FR'
|
||||
],
|
||||
'lo' => [
|
||||
'name' => 'department numbers or postal codes, comma-separated'
|
||||
]
|
||||
]];
|
||||
|
||||
public function collectData(){
|
||||
$html = getSimpleHTMLDOM($this->getURI());
|
||||
public function collectData()
|
||||
{
|
||||
$html = getSimpleHTMLDOM($this->getURI());
|
||||
|
||||
$elements = $html->find('#bloc_liste > div.ergov3-annonce a');
|
||||
$elements = $html->find('#bloc_liste > div.ergov3-annonce a');
|
||||
|
||||
foreach($elements as $element) {
|
||||
foreach ($elements as $element) {
|
||||
if (!$element->title) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!$element->title) {
|
||||
continue;
|
||||
}
|
||||
$img = '';
|
||||
foreach ($element->find('span.img img') as $img) {
|
||||
if ($img->original) {
|
||||
$img = '<img src="' . $img->original . '" />';
|
||||
}
|
||||
}
|
||||
|
||||
$img = '';
|
||||
foreach($element->find('span.img img') as $img) {
|
||||
if($img->original) {
|
||||
$img = '<img src="' . $img->original . '" />';
|
||||
}
|
||||
}
|
||||
$description = $element->find('p', 0);
|
||||
if ($description) {
|
||||
$desc = str_replace("voir l'annonce", '', $description->innertext);
|
||||
} else {
|
||||
$desc = '';
|
||||
}
|
||||
|
||||
$description = $element->find('p', 0);
|
||||
if ($description) {
|
||||
$desc = str_replace("voir l'annonce", '', $description->innertext);
|
||||
} else {
|
||||
$desc = '';
|
||||
}
|
||||
$priceElement = $element->find('div.ergov3-priceannonce', 0);
|
||||
if ($priceElement) {
|
||||
$price = $priceElement->innertext;
|
||||
} else {
|
||||
$price = '';
|
||||
}
|
||||
|
||||
$priceElement = $element->find('div.ergov3-priceannonce', 0);
|
||||
if ($priceElement) {
|
||||
$price = $priceElement->innertext;
|
||||
} else {
|
||||
$price = '';
|
||||
}
|
||||
list($href) = explode('#', $element->href);
|
||||
|
||||
list($href) = explode('#', $element->href);
|
||||
$item = [];
|
||||
$item['uri'] = self::URI . $href;
|
||||
$item['title'] = $element->title;
|
||||
$item['content'] = $img . $desc . $price;
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
$item = array();
|
||||
$item['uri'] = self::URI . $href;
|
||||
$item['title'] = $element->title;
|
||||
$item['content'] = $img . $desc . $price;
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
public function getURI()
|
||||
{
|
||||
$appartment = '&tbApp=1&tbDup=1&tbChb=1&tbLof=1&tbAtl=1&tbPla=1';
|
||||
$maison = '&tbMai=1&tbVil=1&tbCha=1&tbPro=1&tbHot=1&tbMou=1&tbFer=1';
|
||||
$link = self::URI
|
||||
. '/immobilier/annonceimmofo/liste/listeAnnonces?tt=1'
|
||||
. $appartment
|
||||
. $maison;
|
||||
|
||||
public function getURI(){
|
||||
$appartment = '&tbApp=1&tbDup=1&tbChb=1&tbLof=1&tbAtl=1&tbPla=1';
|
||||
$maison = '&tbMai=1&tbVil=1&tbCha=1&tbPro=1&tbHot=1&tbMou=1&tbFer=1';
|
||||
$link = self::URI
|
||||
. '/immobilier/annonceimmofo/liste/listeAnnonces?tt=1'
|
||||
. $appartment
|
||||
. $maison;
|
||||
if ($this->getInput('minarea')) {
|
||||
$link .= '&sur0=' . urlencode($this->getInput('minarea'));
|
||||
}
|
||||
|
||||
if($this->getInput('minarea')) {
|
||||
$link .= '&sur0=' . urlencode($this->getInput('minarea'));
|
||||
}
|
||||
if ($this->getInput('maxprice')) {
|
||||
$link .= '&px1=' . urlencode($this->getInput('maxprice'));
|
||||
}
|
||||
|
||||
if($this->getInput('maxprice')) {
|
||||
$link .= '&px1=' . urlencode($this->getInput('maxprice'));
|
||||
}
|
||||
if ($this->getInput('pa')) {
|
||||
$link .= '&pa=' . urlencode($this->getInput('pa'));
|
||||
}
|
||||
|
||||
if($this->getInput('pa')) {
|
||||
$link .= '&pa=' . urlencode($this->getInput('pa'));
|
||||
}
|
||||
if ($this->getInput('lo')) {
|
||||
$link .= '&lo=' . urlencode($this->getInput('lo'));
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
|
||||
if($this->getInput('lo')) {
|
||||
$link .= '&lo=' . urlencode($this->getInput('lo'));
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
public function getName()
|
||||
{
|
||||
if (!is_null($this->getInput('minarea'))) {
|
||||
$request = '';
|
||||
$minarea = $this->getInput('minarea');
|
||||
if (!empty($minarea)) {
|
||||
$request .= ' ' . $minarea . ' m2';
|
||||
}
|
||||
$location = $this->getInput('lo');
|
||||
if (!empty($location)) {
|
||||
$request .= ' In: ' . $location;
|
||||
}
|
||||
return 'Paru Vendu Immobilier' . $request;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
if(!is_null($this->getInput('minarea'))) {
|
||||
$request = '';
|
||||
$minarea = $this->getInput('minarea');
|
||||
if(!empty($minarea)) {
|
||||
$request .= ' ' . $minarea . ' m2';
|
||||
}
|
||||
$location = $this->getInput('lo');
|
||||
if(!empty($location)) {
|
||||
$request .= ' In: ' . $location;
|
||||
}
|
||||
return 'Paru Vendu Immobilier' . $request;
|
||||
}
|
||||
|
||||
return parent::getName();
|
||||
}
|
||||
return parent::getName();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user