Skip to content

Commit

Permalink
[ScarletComicBridge] Add Scarlet Comic bridge
Browse files Browse the repository at this point in the history
This bridge allows retreival of full comic pages from the RSS feed.
The comic is licensed under CC BY-NC-ND 4.0.
  • Loading branch information
Cyberax committed Nov 17, 2024
1 parent 6c86e2c commit 523b556
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions bridges/ScarletComicBridge.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

class ScarletComicBridge extends FeedExpander
{
const NAME = 'Scarlet Comic';
const URI = 'https://www.sandraandwoo.com';
const DESCRIPTION = 'Fetch the entire comic page';
const MAINTAINER = 'Cyberax';
const PARAMETERS = [
[
'limit' => [
'name' => 'limit (max 5)',
'type' => 'number',
'defaultValue' => 5,
'required' => true,
]
]
];

public function collectData()
{
$url = self::URI . '/scarlet/feed';
$limit = min(5, $this->getInput('limit'));
$this->collectExpandableDatas($url, $limit);
}

protected function parseItem($item)
{
$html = getSimpleHTMLDOMCached($item['uri']);
$comicImage = $html->find('div[id="spliced-comic"]', 0);
$item['content'] = $comicImage;

return $item;
}
}

0 comments on commit 523b556

Please sign in to comment.