From 195ba94115244345ec5363ab5b991967d22a7844 Mon Sep 17 00:00:00 2001 From: Ginko-Aloe Date: Tue, 19 Jan 2016 19:20:21 +0100 Subject: [PATCH] Create JapanExpoBridge.php --- bridges/JapanExpoBridge.php | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 bridges/JapanExpoBridge.php diff --git a/bridges/JapanExpoBridge.php b/bridges/JapanExpoBridge.php new file mode 100644 index 00000000..c9ebbbaa --- /dev/null +++ b/bridges/JapanExpoBridge.php @@ -0,0 +1,42 @@ +maintainer = "Ginko"; + $this->name = "JapanExpo"; + $this->uri = "http://www.japan-expo-paris.com/fr/actualites"; + $this->description = "Returns most recent results from Japan Expo actualités."; + $this->update = "2016-01-19"; + + } + + public function collectData(array $param){ + $link = 'http://www.japan-expo-paris.com/fr/actualites'; + + $html = file_get_html($link) or $this->returnError('Could not request JapanExpo. for : ' . $link , 404); + + foreach($html->find('a._tile2') as $element) { + $item = new Item(); + $item->uri = $element->href; + $item->title = $element->find('span._title', 0)->plaintext; + $style = $element->find('img.rspvimgset', 0)->style; + preg_match('/url\(([^)]+)\)/', $style, $match); + $item->content = "
".$element->find('span.date', 0)->plaintext; + $this->items[] = $item; + } + + } + + public function getName(){ + return 'Japan Expo Actualités'; + } + + public function getURI(){ + return 'http://www.japan-expo-paris.com/fr/actualites'; + } + + public function getCacheDuration(){ + return 86400; // 1 day + } +}