-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ScarletComicBridge] Add Scarlet Comic bridge
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
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |