From 0a755496639bdd2b13af390649f1f266d40909e2 Mon Sep 17 00:00:00 2001 From: pitchoule Date: Tue, 22 Jul 2014 14:55:22 +0200 Subject: [PATCH] Create MondeDiplo.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pour répondre au post : (Le monde diplo #62)[https://github.com/sebsauvage/rss-bridge/issues/62] Voici le bridge --- bridges/MondeDiploBridge.php | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 bridges/MondeDiploBridge.php diff --git a/bridges/MondeDiploBridge.php b/bridges/MondeDiploBridge.php new file mode 100644 index 0000000..f6abe7c --- /dev/null +++ b/bridges/MondeDiploBridge.php @@ -0,0 +1,50 @@ +returnError('Could not request MondeDiplo. for : ' . $link , 404); + + foreach($html->find('div[class=grid_10 alpha omega laune]') as $element) { + $item = new Item(); + $item->uri = 'http://www.monde-diplomatique.fr'.$element->find('a', 0)->href; + $NumArticle = explode("/", $element->find('a', 0)->href); + $item->title = $element->find('h3', 0)->plaintext; + $item->content = $element->find('div[class=crayon article-intro-'.$NumArticle[4].' intro]', 0)->plaintext; + $this->items[] = $item; + } + + foreach($html->find('div.titraille') as $element) { + $item = new Item(); + $item->uri = 'http://www.monde-diplomatique.fr'.$element->find('a', 0)->href; + $item->title = $element->find('h3', 0)->plaintext; + $item->content = $element->find('div.dates_auteurs', 0)->plaintext; + $this->items[] = $item; + } + } + + public function getName(){ + return 'Monde Diplomatique'; + } + + public function getURI(){ + return 'http://www.monde-diplomatique.fr'; + } + + public function getCacheDuration(){ + return 21600; // 6 hours + } +} +