[FierPandaBridge] Fix bridge

This bridge now returns all articles from the front page, following
layout changes in the past.

References #679
This commit is contained in:
logmanoriginal 2018-07-21 18:06:59 +02:00
parent f97d2ef254
commit 15e6d77569

View file

@ -8,17 +8,22 @@ class FierPandaBridge extends BridgeAbstract {
const DESCRIPTION = 'Returns latest articles from Fier Panda.'; const DESCRIPTION = 'Returns latest articles from Fier Panda.';
public function collectData(){ public function collectData(){
$html = getSimpleHTMLDOM(self::URI) $html = getSimpleHTMLDOM(self::URI)
or returnServerError('Could not request Fier Panda.'); or returnServerError('Could not request Fier Panda.');
foreach($html->find('div.container-content article') as $element) { defaultLinkTo($html, static::URI);
foreach($html->find('article') as $article) {
$item = array(); $item = array();
$item['uri'] = $this->getURI() . $element->find('a', 0)->href;
$item['title'] = trim($element->find('h1 a', 0)->innertext); $item['uri'] = $article->find('a', 0)->href;
// Remove the link at the end of the article $item['title'] = $article->find('a', 0)->title;
$element->find('p a', 0)->outertext = '';
$item['content'] = $element->find('p', 0)->innertext;
$this->items[] = $item; $this->items[] = $item;
}
}
} }
} }