mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-04 10:04:54 +02:00
[bridges] make them FeedExpander
Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
244516f0a2
commit
8f58c9f86b
7 changed files with 190 additions and 306 deletions
|
@ -1,38 +1,22 @@
|
|||
<?php
|
||||
class KoreusBridge extends BridgeAbstract{
|
||||
class KoreusBridge extends FeedExpander {
|
||||
|
||||
const MAINTAINER = "pit-fgfjiudghdf";
|
||||
const NAME = "Koreus";
|
||||
const URI = "http://www.koreus.com/";
|
||||
const DESCRIPTION = "Returns the 5 newest posts from Koreus (full text)";
|
||||
const DESCRIPTION = "Returns the newest posts from Koreus (full text)";
|
||||
|
||||
private function KoreusStripCDATA($string) {
|
||||
$string = str_replace('<![CDATA[', '', $string);
|
||||
$string = str_replace(']]>', '', $string);
|
||||
return $string;
|
||||
}
|
||||
protected function parseItem($item) {
|
||||
$item = parent::parseItem($item);
|
||||
|
||||
private function KoreusExtractContent($url) {
|
||||
$html2 = $this->getSimpleHTMLDOM($url);
|
||||
$text = $html2->find('p[class=itemText]', 0)->innertext;
|
||||
$text = utf8_encode(preg_replace('/(Sur le m.+?)+$/i','',$text));
|
||||
return $text;
|
||||
$html = $this->getSimpleHTMLDOMCached($item['uri']);
|
||||
$text = $html->find('p.itemText', 0)->innertext;
|
||||
$item['content'] = utf8_encode($text);
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
public function collectData(){
|
||||
$html = $this->getSimpleHTMLDOM('http://feeds.feedburner.com/Koreus-articles') or $this->returnServerError('Could not request Koreus.');
|
||||
$limit = 0;
|
||||
|
||||
foreach($html->find('item') as $element) {
|
||||
if($limit < 5) {
|
||||
$item = array();
|
||||
$item['title'] = $this->KoreusStripCDATA($element->find('title', 0)->innertext);
|
||||
$item['uri'] = $this->KoreusStripCDATA($element->find('guid', 0)->plaintext);
|
||||
$item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext);
|
||||
$item['content'] = $this->KoreusExtractContent($item['uri']);
|
||||
$this->items[] = $item;
|
||||
$limit++;
|
||||
}
|
||||
}
|
||||
$this->collectExpandableDatas('http://feeds.feedburner.com/Koreus-articles');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue