From 15f24b3cf4b418633c2028e4318399b67b413130 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Sun, 4 Sep 2016 13:47:13 +0200 Subject: [PATCH] [Acrimed] Use internal RSS 2.0 parser --- bridges/AcrimedBridge.php | 48 ++++++++++++++------------------------- 1 file changed, 17 insertions(+), 31 deletions(-) diff --git a/bridges/AcrimedBridge.php b/bridges/AcrimedBridge.php index bee4456a..54c6f873 100644 --- a/bridges/AcrimedBridge.php +++ b/bridges/AcrimedBridge.php @@ -1,40 +1,26 @@ collectExpandableDatas("http://www.acrimed.org/spip.php?page=backend"); + } - public function collectData(){ + protected function parseItem($newsItem){ + $item = $this->parseRSS_2_0_Item($newsItem); - $this->collectExpandableDatas("http://www.acrimed.org/spip.php?page=backend"); + $hs = new HTMLSanitizer(); + $articlePage = $this->getSimpleHTMLDOM($newsItem->link); + $article = $hs->sanitize($articlePage->find('article.article1', 0)->innertext); + $article = HTMLSanitizer::defaultImageSrcTo($article, "http://www.acrimed.org/"); + $item['content'] = $article; - } - - protected function parseItem($newsItem) { - - $hs = new HTMLSanitizer(); - - $namespaces = $newsItem->getNameSpaces(true); - $dc = $newsItem->children($namespaces['dc']); - - $item = array(); - $item['uri'] = trim($newsItem->link); - $item['title'] = trim($newsItem->title); - $item['timestamp'] = strtotime($dc->date); - - $articlePage = $this->getSimpleHTMLDOM($newsItem->link); - $article = $hs->sanitize($articlePage->find('article.article1', 0)->innertext); - $article = HTMLSanitizer::defaultImageSrcTo($article, "http://www.acrimed.org/"); - - $item['content'] = $article; - - - return $item; - - } + return $item; + } public function getCacheDuration(){ return 4800; // 2 hours