-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
66 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,43 @@ | ||
import { Tags } from '../Tags'; | ||
import icon from './NovaManga.webp'; | ||
import { DecoratableMangaScraper, Manga, type MangaPlugin } from '../providers/MangaPlugin'; | ||
import * as Common from './decorators/Common'; | ||
import { FetchCSS } from '../platform/FetchProvider'; | ||
|
||
function ChapterExtractor(anchor: HTMLAnchorElement) { | ||
return { | ||
id: anchor.pathname, | ||
title: anchor.querySelector<HTMLParagraphElement>('p').textContent.trim() | ||
}; | ||
} | ||
|
||
@Common.MangaCSS(/^{origin}\/series\/[^/]+$/, 'title', (element: HTMLTitleElement) => element.textContent.split('|').at(0).trim()) | ||
@Common.ChaptersSinglePageCSS('div.grid a.recentCardItem', ChapterExtractor) | ||
@Common.PagesSinglePageCSS('div.content img[data-src]') | ||
@Common.ImageAjax() | ||
export default class extends DecoratableMangaScraper { | ||
|
||
public constructor() { | ||
super('novamanga', 'Nova Manga', 'https://novamanga.com', Tags.Media.Manhwa, Tags.Media.Manhua, Tags.Media.Manga, Tags.Language.English, Tags.Source.Scanlator); | ||
} | ||
|
||
public override get Icon() { | ||
return icon; | ||
} | ||
|
||
public override async FetchMangas(provider: MangaPlugin): Promise<Manga[]> { | ||
const mangaList: Manga[] = []; | ||
for (let page = 0, run = true; run; page++) { | ||
const mangas = await this.GetMangasFromPage(page, provider); | ||
mangas.length > 0 ? mangaList.push(...mangas) : run = false; | ||
} | ||
return mangaList; | ||
} | ||
|
||
private async GetMangasFromPage(page: number, provider: MangaPlugin): Promise<Manga[]> { | ||
const links = await FetchCSS<HTMLAnchorElement>(new Request(new URL(`./search?page=${page}`, this.URI), { | ||
method: 'POST' | ||
}), 'div.grid a[href*="/series/"]'); | ||
return links.map(item => new Manga(this, provider, item.pathname, item.querySelector<HTMLParagraphElement>('div div p').textContent.trim())); | ||
} | ||
} |
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,22 @@ | ||
import { TestFixture } from '../../../test/WebsitesFixture'; | ||
|
||
new TestFixture({ | ||
plugin: { | ||
id: 'novamanga', | ||
title: 'Nova Manga' | ||
}, | ||
container: { | ||
url: 'https://novamanga.com/series/seirei-gensouki-konna-sekai-de-deaeta-kimi-ni-minazuki-futago', | ||
id: '/series/seirei-gensouki-konna-sekai-de-deaeta-kimi-ni-minazuki-futago', | ||
title: 'Seirei Gensouki - Konna Sekai de Deaeta Kimi ni (MINAZUKI Futago)' | ||
}, | ||
child: { | ||
id: '/read/seirei-gensouki-konna-sekai-de-deaeta-kimi-ni-minazuki-futago-chapter-56-5', | ||
title: 'Chapter 56.5' | ||
}, | ||
entry: { | ||
index: 0, | ||
size: 674_658, | ||
type: 'image/webp' | ||
} | ||
}).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