mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-01-10 05:27:27 +03:00
refactor(donnons) (#4389)
This commit is contained in:
parent
3fc38c15a3
commit
662e0bfa95
1 changed files with 47 additions and 43 deletions
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne les dons d'une recherche filtrée sur le site Donnons.org
|
* Retourne les dons d'une recherche filtrée sur le site Donnons.org
|
||||||
* Example: https://donnons.org/Sport/Ile-de-France
|
* Example: https://donnons.org/Sport/Ile-de-France
|
||||||
|
@ -44,11 +46,14 @@ class DonnonsBridge extends BridgeAbstract
|
||||||
{
|
{
|
||||||
$uri = $this->getPageURI($page);
|
$uri = $this->getPageURI($page);
|
||||||
|
|
||||||
$html = getSimpleHTMLDOM($uri);
|
$dom = getSimpleHTMLDOM($uri);
|
||||||
|
|
||||||
$searchDiv = $html->find('div[id=search]', 0);
|
$searchDiv = $dom->find('div[id=search]', 0);
|
||||||
|
|
||||||
|
if (! $searchDiv) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_null($searchDiv)) {
|
|
||||||
$elements = $searchDiv->find('a.lst-annonce');
|
$elements = $searchDiv->find('a.lst-annonce');
|
||||||
foreach ($elements as $element) {
|
foreach ($elements as $element) {
|
||||||
$item = [];
|
$item = [];
|
||||||
|
@ -97,7 +102,6 @@ class DonnonsBridge extends BridgeAbstract
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private function getPageURI($page)
|
private function getPageURI($page)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue