2015-04-26 20:22:20 +03:00
|
|
|
<?php
|
2016-09-05 19:43:56 +03:00
|
|
|
class CommonDreamsBridge extends FeedExpander {
|
2015-11-04 01:28:44 +03:00
|
|
|
|
2016-08-30 12:23:55 +03:00
|
|
|
const MAINTAINER = "nyutag";
|
|
|
|
const NAME = "CommonDreams Bridge";
|
|
|
|
const URI = "http://www.commondreams.org/";
|
|
|
|
const DESCRIPTION = "Returns the newest articles.";
|
2016-08-02 15:43:59 +03:00
|
|
|
|
2016-09-05 19:43:56 +03:00
|
|
|
public function collectData(){
|
2016-09-05 21:26:45 +03:00
|
|
|
$this->collectExpandableDatas('http://www.commondreams.org/rss.xml', 10);
|
2016-09-05 19:43:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function parseItem($newsItem){
|
|
|
|
$item = $this->parseRSS_2_0_Item($newsItem);
|
|
|
|
$item['content'] = $this->CommonDreamsExtractContent($item['uri']);
|
|
|
|
return $item;
|
|
|
|
}
|
|
|
|
|
2016-08-06 17:00:56 +03:00
|
|
|
private function CommonDreamsExtractContent($url) {
|
2016-09-10 20:11:09 +03:00
|
|
|
$html3 = $this->getSimpleHTMLDOMCached($url);
|
2015-04-26 20:22:20 +03:00
|
|
|
$text = $html3->find('div[class=field--type-text-with-summary]', 0)->innertext;
|
2015-05-05 21:30:26 +03:00
|
|
|
$html3->clear();
|
|
|
|
unset ($html3);
|
2015-04-26 20:22:20 +03:00
|
|
|
return $text;
|
2016-08-02 15:43:59 +03:00
|
|
|
}
|
2015-04-26 20:22:20 +03:00
|
|
|
}
|