From e11123775a3c08e6d7ab967511c75ab5093868a2 Mon Sep 17 00:00:00 2001 From: ORelio Date: Sun, 20 Mar 2016 15:57:36 +0100 Subject: [PATCH] [ZT] Add ZoneTelechargement This is merely a proxy for fetching existing feeds. (Some feed readers weren't able to fetch their RSS feeds) --- bridges/ZoneTelechargementBridge.php | 58 ++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 bridges/ZoneTelechargementBridge.php diff --git a/bridges/ZoneTelechargementBridge.php b/bridges/ZoneTelechargementBridge.php new file mode 100644 index 00000000..0f5b2dd7 --- /dev/null +++ b/bridges/ZoneTelechargementBridge.php @@ -0,0 +1,58 @@ +maintainer = 'ORelio'; + $this->name = $this->getName(); + $this->uri = $this->getURI(); + $this->description = 'RSS proxy returning the newest releases.
You may specify a category found in RSS URLs, else main feed is selected.'; + $this->update = "2016-03-16"; + + $this->parameters[] = + '[ + { + "name" : "Category", + "identifier" : "category" + } + ]'; + } + + public function collectData(array $param) { + + function StripCDATA($string) { + $string = str_replace('', '', $string); + return $string; + } + + $category = '/'; + if (!empty($param['category'])) + $category = '/'.$param['category'].'/'; + + $url = $this->getURI().$category.'rss.xml'; + $html = file_get_html($url) or $this->returnError('Could not request Zone Telechargement: '.$url, 500); + + foreach($html->find('item') as $element) { + $item = new \Item(); + $item->title = $element->find('title', 0)->plaintext; + $item->uri = str_replace('http://', 'https://', $element->find('guid', 0)->plaintext); + $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); + $item->content = StripCDATA($element->find('description', 0)->innertext); + $this->items[] = $item; + $limit++; + } + } + + public function getName() { + return 'Zone Telechargement Bridge'; + } + + public function getURI() { + return 'https://www.zone-telechargement.com/'; + } + + public function getCacheDuration() { + return 3600; + } +}