2015-04-26 19:22:20 +02:00
|
|
|
<?php
|
2016-09-05 18:43:56 +02:00
|
|
|
class CommonDreamsBridge extends FeedExpander {
|
2015-11-03 23:28:44 +01:00
|
|
|
|
2016-08-30 11:23:55 +02:00
|
|
|
const MAINTAINER = "nyutag";
|
|
|
|
const NAME = "CommonDreams Bridge";
|
|
|
|
const URI = "http://www.commondreams.org/";
|
|
|
|
const DESCRIPTION = "Returns the newest articles.";
|
2016-08-02 14:43:59 +02:00
|
|
|
|
2016-09-05 18:43:56 +02:00
|
|
|
public function collectData(){
|
2016-09-05 20:26:45 +02:00
|
|
|
$this->collectExpandableDatas('http://www.commondreams.org/rss.xml', 10);
|
2016-09-05 18:43:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function parseItem($newsItem){
|
2016-09-12 10:42:27 +02:00
|
|
|
$item = parent::parseItem($newsItem);
|
2016-09-05 18:43:56 +02:00
|
|
|
$item['content'] = $this->CommonDreamsExtractContent($item['uri']);
|
|
|
|
return $item;
|
|
|
|
}
|
|
|
|
|
2016-08-06 16:00:56 +02:00
|
|
|
private function CommonDreamsExtractContent($url) {
|
2016-09-25 23:22:33 +02:00
|
|
|
$html3 = getSimpleHTMLDOMCached($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;
|
2016-08-02 14:43:59 +02:00
|
|
|
}
|
2015-04-26 19:22:20 +02:00
|
|
|
}
|