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)
|
|
|
|
{
|
2022-12-13 23:04:57 +03:00
|
|
|
$dom = getSimpleHTMLDOMCached($url);
|
|
|
|
$summary = $dom->find('div.node__body', 0);
|
|
|
|
$text = $summary->innertext;
|
|
|
|
$dom->clear();
|
|
|
|
unset($dom);
|
2022-07-01 16:10:30 +03:00
|
|
|
return $text;
|
|
|
|
}
|
2015-04-26 20:22:20 +03:00
|
|
|
}
|