-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Zhuzhumh manga-download/hakuneko#7149 * use api to get chapters
- Loading branch information
Showing
4 changed files
with
61 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,34 @@ | ||
import { Tags } from '../Tags'; | ||
import icon from './Zhuzhumh.webp'; | ||
import { Chapter, DecoratableMangaScraper, type Manga } from '../providers/MangaPlugin'; | ||
import * as Common from './decorators/Common'; | ||
import { FetchJSON } from '../platform/FetchProvider'; | ||
|
||
type APIChapter = { | ||
chaptername: string, | ||
chapterurl: string | ||
} | ||
|
||
@Common.MangaCSS(/^{origin}\/book\/[^/]+\.html$/, 'div.cy_title h1') | ||
@Common.MangasMultiPageCSS('/sort/1-{page}.html', 'div.cy_list_mh ul li.title a') | ||
@Common.PagesSinglePageJS('newImgs', 1500) | ||
@Common.ImageAjax() | ||
export default class extends DecoratableMangaScraper { | ||
|
||
public constructor() { | ||
super('zhuzhumh', `Zhuzhumh`, 'https://www.zhuzhumh.com', Tags.Language.Chinese, Tags.Media.Manga, Tags.Media.Manhua, Tags.Media.Manhwa, Tags.Source.Aggregator); | ||
} | ||
|
||
public override get Icon() { | ||
return icon; | ||
} | ||
|
||
public override async FetchChapters(manga: Manga): Promise<Chapter[]> { | ||
const chapterslist = await Common.FetchChaptersSinglePageCSS.call(this, manga, 'ul#mh-chapter-list-ol-0 li a'); | ||
const mangaid = manga.Identifier.match(/\/book\/([^.]+)\.html$/)[1]; | ||
const data = await FetchJSON<APIChapter[]>(new Request(new URL(`/api/bookchapter?id=${mangaid}&id2=1`, this.URI))); | ||
chapterslist.push(...data.map(chapter => new Chapter(this, manga, new URL(chapter.chapterurl).pathname, chapter.chaptername.trim()))); | ||
return chapterslist; | ||
} | ||
|
||
} |
Binary file not shown.
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,26 @@ | ||
import { describe } from 'vitest'; | ||
import { TestFixture } from '../../../test/WebsitesFixture'; | ||
|
||
const config = { | ||
plugin: { | ||
id: 'zhuzhumh', | ||
title: 'Zhuzhumh' | ||
}, | ||
container: { | ||
url: 'https://www.zhuzhumh.com/book/shisiruguiweijunzi.html', | ||
id: '/book/shisiruguiweijunzi.html', | ||
title: '视死如归魏君子' | ||
}, | ||
child: { | ||
id: '/chapter-redirect/shisiruguiweijunzi/1364147.html', | ||
title: '93 四大纨绔之三' | ||
}, | ||
entry: { | ||
index: 0, | ||
size: 863_947, | ||
type: 'image/jpeg' | ||
} | ||
}; | ||
|
||
const fixture = new TestFixture(config); | ||
describe(fixture.Name, async () => (await fixture.Connect()).AssertWebsite()); |
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