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