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
|
|
|
|
2023-10-13 02:59:05 +03:00
|
|
|
protected function parseItem(array $item)
|
2022-07-01 16:10:30 +03:00
|
|
|
{
|
|
|
|
$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
|
|
|
}
|