From 7d03d72708b46e83ef0c71cb708b8449bf0383b4 Mon Sep 17 00:00:00 2001 From: nkania Date: Fri, 11 Dec 2015 11:51:27 +0100 Subject: [PATCH] Added a bridge for fier-panda.fr --- bridges/FierPandaBridge.php | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 bridges/FierPandaBridge.php diff --git a/bridges/FierPandaBridge.php b/bridges/FierPandaBridge.php new file mode 100644 index 0000000..68c27b8 --- /dev/null +++ b/bridges/FierPandaBridge.php @@ -0,0 +1,41 @@ +maintainer = "snroki"; + $this->name = "Fier Panda Bridge"; + $this->uri = "http://www.fier-panda.fr/"; + $this->description = "Returns latest articles from Fier Panda."; + $this->update = "2015-12-11"; + + } + + public function collectData(array $param){ + $link = 'http://www.fier-panda.fr/'; + + $html = file_get_html($link) or $this->returnError('Could not request Fier Panda.', 404); + + foreach($html->find('div.container-content article') as $element) { + $item = new \Item(); + $item->uri = $this->getURI().$element->find('a', 0)->href; + $item->title = trim($element->find('h2 a', 0)->innertext); + // Remove the link at the end of the article + $element->find('p a', 0)->outertext = ''; + $item->content = $element->find('p', 0)->innertext; + $this->items[] = $item; + } + } + + public function getName(){ + return 'Fier Panda'; + } + + public function getURI(){ + return 'http://www.fier-panda.fr'; + } + + public function getCacheDuration(){ + return 21600; // 6 hours + } +}