Skip to content

Commit

Permalink
Add Zhuzhumh
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeZeDev committed Jun 7, 2024
1 parent ab27fe8 commit f345c48
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
36 changes: 36 additions & 0 deletions web/src/engine/websites/Zhuzhumh.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Tags } from '../Tags';
import icon from './Zhuzhumh.webp';
import { DecoratableMangaScraper } from '../providers/MangaPlugin';
import * as Common from './decorators/Common';

const queryChaptersScript = `
new Promise((resolve, reject) => {
const interval = setInterval(() => {
let morebtn = document.querySelector('a#zhankai:not([style*="display"])');
if (morebtn) morebtn.click()
else {
clearInterval(interval);
const chapters = [...document.querySelectorAll('ul#mh-chapter-list-ol-0 li a')];
resolve( chapters.map(chapter => {
return { id : chapter.pathname, title : chapter.textContent.trim()}
}));
}
}, 500);
});
`;

@Common.MangaCSS(/^{origin}\/book\/[^/]+\.html$/, 'div.cy_title h1')
@Common.MangasMultiPageCSS('/sort/1-{page}.html', 'div.cy_list_mh ul li.title a')
@Common.ChaptersSinglePageJS(queryChaptersScript)
@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;
}
}
Binary file added web/src/engine/websites/Zhuzhumh.webp
Binary file not shown.
26 changes: 26 additions & 0 deletions web/src/engine/websites/Zhuzhumh_e2e.ts
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());
1 change: 1 addition & 0 deletions web/src/engine/websites/_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ export { default as Zebrack } from './Zebrack';
export { default as ZenithScans } from './ZenithScans';
export { default as ZeroScans } from './ZeroScans';
export { default as ZeurelScan } from './ZeurelScan';
export { default as Zhuzhumh } from './Zhuzhumh';
export { default as ZinManga } from './ZinManga';
export { default as ZinMangaNet } from './ZinMangaNet';
export { default as ZuiMH } from './ZuiMH';
Expand Down

0 comments on commit f345c48

Please sign in to comment.