rss-bridge/bridges/OglafBridge.php
tillcash 5ab1924c4f
Add WorldbankBridge and OglafBridge (#3862)
* Add WorldbankBridge and OglafBridge

* Update OglafBridge.php

Remove redundant parent call to parseItem and rename formal argument to improve code clarity.

* Update WorldbankBridge.php

fix lint
2023-12-28 13:50:34 +01:00

35 lines
874 B
PHP

<?php
class OglafBridge extends FeedExpander
{
const NAME = 'Oglaf';
const URI = 'https://www.oglaf.com/';
const DESCRIPTION = 'Fetch the entire comic image';
const MAINTAINER = 'tillcash';
const PARAMETERS = [
[
'limit' => [
'name' => 'limit (max 20)',
'type' => 'number',
'defaultValue' => 10,
'required' => true,
]
]
];
public function collectData()
{
$url = self::URI . 'feeds/rss/';
$limit = min(20, $this->getInput('limit'));
$this->collectExpandableDatas($url, $limit);
}
protected function parseItem($item)
{
$html = getSimpleHTMLDOMCached($item['uri']);
$comicImage = $html->find('img[id="strip"]', 0);
$item['content'] = $comicImage;
return $item;
}
}