1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-09-08 23:20:52 +02:00
This commit is contained in:
Dag
2023-10-13 01:02:19 +02:00
committed by GitHub
parent 44fb2c98bc
commit e379019db2
4 changed files with 72 additions and 57 deletions

View File

@@ -27,29 +27,30 @@ class NextgovBridge extends FeedExpander
public function collectData()
{
$url = self::URI . 'rss/' . $this->getInput('category') . '/';
$this->collectExpandableDatas($url, 10);
$limit = 10;
$this->collectExpandableDatas($url, $limit);
}
protected function parseItem($newsItem)
protected function parseItem($item)
{
$item = parent::parseItem($newsItem);
$item = parent::parseItem($item);
$article_thumbnail = 'https://cdn.nextgov.com/nextgov/images/logo.png';
$item['content'] = '<p><b>' . $item['content'] . '</b></p>';
$namespaces = $newsItem->getNamespaces(true);
if (isset($namespaces['media'])) {
$media = $newsItem->children($namespaces['media']);
if (isset($media->content)) {
$attributes = $media->content->attributes();
$item['content'] = '<p><img src="' . $attributes['url'] . '"></p>' . $item['content'];
$article_thumbnail = str_replace(
'large.jpg',
'small.jpg',
strval($attributes['url'])
);
}
}
// $namespaces = $newsItem->getNamespaces(true);
// if (isset($namespaces['media'])) {
// $media = $newsItem->children($namespaces['media']);
// if (isset($media->content)) {
// $attributes = $media->content->attributes();
// $item['content'] = '<p><img src="' . $attributes['url'] . '"></p>' . $item['content'];
// $article_thumbnail = str_replace(
// 'large.jpg',
// 'small.jpg',
// strval($attributes['url'])
// );
// }
// }
$item['enclosures'] = [$article_thumbnail];
$item['content'] .= $this->extractContent($item['uri']);