Skip to content

Commit

Permalink
feat: new bridge MangaReader (RSS-Bridge#3795)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvikan authored Nov 10, 2023
1 parent e76b060 commit b347a92
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions bridges/MangaReaderBridge.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

class MangaReaderBridge extends BridgeAbstract
{
const NAME = 'MangaReader Bridge';
const URI = 'https://mangareader.to';
const DESCRIPTION = 'Fetches the latest chapters from MangaReader.to.';
const MAINTAINER = 'cubethethird';
const PARAMETERS = [
[
'url' => [
'name' => 'Manga URL',
'type' => 'text',
'required' => true,
'title' => 'The URL of the manga on MangaReader',
'pattern' => '^https:\/\/mangareader\.to\/[^\/]+$',
'exampleValue' => 'https://mangareader.to/bleach-1623',
],
'lang' => [
'name' => 'Chapter Language',
'title' => 'two-letter language code (example "en", "jp", "fr")',
'exampleValue' => 'en',
'required' => true,
'pattern' => '^[a-z][a-z]$',
]
]
];

public function collectData()
{
$url = $this->getInput('url');
$lang = $this->getInput('lang');
$dom = getSimpleHTMLDOM($url);
$chapters = $dom->getElementById($lang . '-chapters');

foreach ($chapters->getElementsByTagName('li') as $chapter) {
$a = $chapter->getElementsByTagName('a')[0];
$item = [];
$item['title'] = $a->getAttribute('title');
$item['uri'] = self::URI . $a->getAttribute('href');
$this->items[] = $item;
}
}
}

0 comments on commit b347a92

Please sign in to comment.