Rss-Bridge/bridges/CommonDreamsBridge.php

27 lines
737 B
PHP
Raw Normal View History

2015-04-26 19:22:20 +02:00
<?php
class CommonDreamsBridge extends FeedExpander {
const MAINTAINER = "nyutag";
const NAME = "CommonDreams Bridge";
const URI = "http://www.commondreams.org/";
const DESCRIPTION = "Returns the newest articles.";
public function collectData(){
$this->collectExpandableDatas('http://www.commondreams.org/rss.xml');
}
protected function parseItem($newsItem){
$item = $this->parseRSS_2_0_Item($newsItem);
$item['content'] = $this->CommonDreamsExtractContent($item['uri']);
return $item;
}
private function CommonDreamsExtractContent($url) {
$html3 = $this->get_cached($url);
2015-04-26 19:22:20 +02:00
$text = $html3->find('div[class=field--type-text-with-summary]', 0)->innertext;
2015-05-05 20:30:26 +02:00
$html3->clear();
unset ($html3);
2015-04-26 19:22:20 +02:00
return $text;
}
2015-04-26 19:22:20 +02:00
}