Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Speedbinb Decorator and websites #179

Open
wants to merge 129 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
39508c6
Add Speedbind Decorator and websites
MikeZeDev Jul 15, 2023
a2bd26f
Update SpeedBind.ts
MikeZeDev Jul 15, 2023
165ce5d
Merge branch 'master' into SpeedBind
MikeZeDev Aug 8, 2023
ba1439c
add ComicPolaris && 123Hon
MikeZeDev Sep 20, 2023
78f8bbc
Merge branch 'master' into SpeedBind
MikeZeDev Sep 20, 2023
6e1574b
Merge branch 'master' into SpeedBind
MikeZeDev Sep 28, 2023
e54cd12
typo
MikeZeDev Oct 1, 2023
618806a
move files to websites
MikeZeDev Oct 1, 2023
9e30242
add getsuaku
MikeZeDev Oct 1, 2023
2460a0f
Merge branch 'master' into SpeedBind
MikeZeDev Oct 1, 2023
bc2ed43
Update _index.ts
MikeZeDev Oct 1, 2023
b4ce106
Merge branch 'master' into SpeedBind
MikeZeDev Oct 4, 2023
c64a616
Update _index.ts
MikeZeDev Oct 4, 2023
d7e3da0
fix calls
MikeZeDev Oct 4, 2023
468746a
Merge branch 'master' into SpeedBind
MikeZeDev Oct 4, 2023
edcf4c2
speedbinb : small fixes and create tests
MikeZeDev Oct 5, 2023
bbc41a6
Merge branch 'master' into SpeedBind
MikeZeDev Oct 15, 2023
0c68ea2
Update _index.ts
MikeZeDev Oct 15, 2023
0afeeae
fix spacing and use new error in decorator
MikeZeDev Oct 15, 2023
f7a8e5c
use quality from settings
MikeZeDev Oct 21, 2023
f605522
Merge branch 'master' into SpeedBind
MikeZeDev Oct 21, 2023
920984d
Update _index.ts
MikeZeDev Oct 21, 2023
a0e90f4
Merge branch 'master' into SpeedBind
MikeZeDev Oct 23, 2023
786bbf4
better regexp
MikeZeDev Oct 24, 2023
811bea2
Merge branch 'master' into SpeedBind
MikeZeDev Oct 29, 2023
20081f3
Merge branch 'master' into SpeedBind
MikeZeDev Oct 31, 2023
dbf26c3
Merge branch 'master' into SpeedBind
MikeZeDev Nov 2, 2023
db8af24
Update _index.ts
MikeZeDev Nov 2, 2023
dd94ec2
Merge branch 'master' into SpeedBind
MikeZeDev Nov 12, 2023
3d5b471
use origin placeholder
MikeZeDev Nov 12, 2023
855caf8
Merge branch 'master' into SpeedBind
MikeZeDev Nov 27, 2023
f79b1bd
Update _index.ts
MikeZeDev Nov 27, 2023
73eebd5
[futabanet] reflect website changes
MikeZeDev Dec 1, 2023
513c06e
Add Yanmaga
MikeZeDev Dec 12, 2023
556d00d
add YoungJump && Speebinb improvements
MikeZeDev Dec 12, 2023
55d8ef8
Merge branch 'master' into SpeedBind
MikeZeDev Dec 13, 2023
a258412
Update _index.ts
MikeZeDev Dec 13, 2023
800d1c5
SpeedBinb : fix cookies problem
MikeZeDev Dec 13, 2023
684071d
YoungJump : Fix ClipBoard
MikeZeDev Dec 13, 2023
f456d8a
SpeedBinb : use DeScramble
MikeZeDev Dec 13, 2023
15be172
fix tests and delete ComiRide
MikeZeDev Dec 13, 2023
9916cfa
Update Yanmaga.ts
MikeZeDev Dec 15, 2023
17a1afd
Merge branch 'master' into SpeedBind
MikeZeDev Dec 21, 2023
a40151b
Update _index.ts
MikeZeDev Dec 21, 2023
3beb3df
Update YoungJump_e2e.ts
MikeZeDev Dec 23, 2023
34e7468
cmoa : fix paginated chapters and manga regex
MikeZeDev Dec 29, 2023
e435299
Merge branch 'master' into SpeedBind
MikeZeDev Dec 30, 2023
2fb4e05
Update _index.ts
MikeZeDev Dec 30, 2023
68ea901
Merge branch 'master' into SpeedBind
MikeZeDev Jan 5, 2024
65ea78b
123Hon : remove debug
MikeZeDev Jan 14, 2024
b2bb34e
booklive : fix chapter gathering
MikeZeDev Jan 14, 2024
f381c7c
Cmoa fixes manga id
MikeZeDev Jan 14, 2024
dae7b90
Fix ComicPolaris icon
MikeZeDev Jan 14, 2024
0a5e74b
ComicValkyrie : small code chanages
MikeZeDev Jan 14, 2024
12551a8
SpeedBinb : code refactoring
MikeZeDev Jan 14, 2024
050bd9d
Speedbind: minor modifications
MikeZeDev Jan 15, 2024
e233864
Add Smanga
MikeZeDev Jan 15, 2024
2d2a226
Merge branch 'master' into SpeedBind
MikeZeDev Jan 16, 2024
81e5dbe
improve platform abstraction
MikeZeDev Jan 16, 2024
5bf5eed
Add BookHodai
MikeZeDev Jan 24, 2024
3e0523f
Update BookHodai.ts
MikeZeDev Jan 24, 2024
2272353
SpeedBinb : tweak decorator
MikeZeDev Jan 25, 2024
a2dce3e
BookHodai : use script and fix test
MikeZeDev Jan 25, 2024
c702f69
Add MangaPlaza
MikeZeDev Jan 25, 2024
21425e1
fix el = undefined
MikeZeDev Feb 2, 2024
3d5b090
Add Televi-kun Superhero Comics
MikeZeDev Feb 2, 2024
c5a2186
Merge branch 'master' into SpeedBind
MikeZeDev Feb 3, 2024
e202388
Update _index.ts
MikeZeDev Feb 3, 2024
4e719f7
Merge branch 'master' into SpeedBind
MikeZeDev Feb 5, 2024
1b2a46b
Update _index.ts
MikeZeDev Feb 5, 2024
e680a5f
Add ComicPorta
MikeZeDev Feb 8, 2024
a2e5700
Merge branch 'master' into SpeedBind
MikeZeDev Feb 26, 2024
60b65fb
Update _index.ts
MikeZeDev Feb 26, 2024
164b251
Add YoManga
MikeZeDev Mar 7, 2024
6f450de
code refactoring
MikeZeDev Mar 9, 2024
8b7397f
Merge branch 'master' into SpeedBind
MikeZeDev Mar 23, 2024
84aaba5
Merge branch 'master' into SpeedBind
MikeZeDev Apr 17, 2024
2651630
fix cmoa test
MikeZeDev Apr 17, 2024
c8ab1d6
Merge branch 'master' into SpeedBind
MikeZeDev Apr 26, 2024
034a307
Merge branch 'master' into SpeedBind
MikeZeDev Apr 27, 2024
38f2b91
use correct cases
MikeZeDev Apr 27, 2024
1063cbf
Merge branch 'master' into SpeedBind
MikeZeDev May 7, 2024
63a1c94
Update _index.ts
MikeZeDev May 7, 2024
c6f9d89
update e2e tests to use vitest
MikeZeDev May 7, 2024
ad29f55
fix yanmaga icon
MikeZeDev May 7, 2024
0d43890
Merge branch 'master' into SpeedBind
MikeZeDev May 18, 2024
387932a
Update _index.ts
MikeZeDev May 18, 2024
e7cdf3b
Merge branch 'master' into SpeedBind
MikeZeDev May 23, 2024
583dec7
Update _index.ts
MikeZeDev May 23, 2024
8bba279
Futabanet: accept futabanex & filter app chapters
MikeZeDev May 23, 2024
881df68
rename FetchImage into FetchImageAjax
MikeZeDev May 23, 2024
6fa366c
Futabanet : handle non-SpeedBinb chapters
MikeZeDev May 23, 2024
dc7f086
Merge branch 'master' into SpeedBind
MikeZeDev Jun 10, 2024
de34371
dont use href on new Request
MikeZeDev Jun 10, 2024
7e32543
fix bookhodai manga list and "chapters"
MikeZeDev Jun 10, 2024
b3e0ef2
Add MichiKusa
MikeZeDev Jun 10, 2024
a25fca2
Merge branch 'master' into SpeedBind
MikeZeDev Jul 11, 2024
5b5cf2d
Update _index.ts
MikeZeDev Jul 11, 2024
fcc0995
starting to introduce versioned decorators
MikeZeDev Jul 27, 2024
7683ae1
Remove Getsuaku
MikeZeDev Jul 27, 2024
5ff8bdf
massive rework (again)
MikeZeDev Jul 28, 2024
19f311d
Merge branch 'master' into SpeedBind
MikeZeDev Jul 28, 2024
b69e2af
Update _index.ts
MikeZeDev Jul 28, 2024
bd28dc3
Merge branch 'master' into SpeedBind
MikeZeDev Jul 28, 2024
89674d7
Update SpeedBinb.ts
MikeZeDev Jul 29, 2024
802526b
Merge branch 'master' into SpeedBind
MikeZeDev Aug 14, 2024
db95ad4
Update _index.ts
MikeZeDev Aug 14, 2024
b76a024
fix lint errors
MikeZeDev Aug 14, 2024
29b9b2f
Merge branch 'master' into SpeedBind
MikeZeDev Aug 16, 2024
291f99d
Merge branch 'master' into SpeedBind
MikeZeDev Sep 9, 2024
89d3ad8
Update _index.ts
MikeZeDev Sep 9, 2024
3488c99
remove useless errors from catches
MikeZeDev Sep 23, 2024
a1baa88
Merge branch 'master' into SpeedBind
MikeZeDev Sep 28, 2024
4ca1624
Update _index.ts
MikeZeDev Sep 28, 2024
c2eb351
Merge branch 'master' into SpeedBind
MikeZeDev Oct 7, 2024
c6d8316
Merge branch 'master' into SpeedBind
MikeZeDev Oct 13, 2024
ff6b398
Merge branch 'master' into SpeedBind
MikeZeDev Oct 17, 2024
438484e
Update _index.ts
MikeZeDev Oct 17, 2024
db56a27
Merge branch 'master' into SpeedBind
MikeZeDev Oct 27, 2024
0e913f6
update tests
MikeZeDev Oct 27, 2024
dc20bc3
Update Futabanet_e2e.ts
MikeZeDev Oct 27, 2024
4e65bee
Merge branch 'master' into SpeedBind
MikeZeDev Nov 16, 2024
26462eb
update
MikeZeDev Nov 16, 2024
008b2cd
fix promise
MikeZeDev Nov 16, 2024
4aef846
Merge branch 'master' into SpeedBind
MikeZeDev Nov 17, 2024
226ad8e
fix clipboard on futaba
MikeZeDev Nov 22, 2024
4dcc88e
refactor SpeedBinb
MikeZeDev Nov 22, 2024
c9e5b31
Merge branch 'master' into SpeedBind
MikeZeDev Nov 26, 2024
c979b01
Update _index.ts
MikeZeDev Nov 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions web/src/engine/websites/BookHodai.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { Tags } from '../Tags';
import icon from './BookHodai.webp';
import { Chapter, DecoratableMangaScraper, type Manga, type MangaPlugin } from '../providers/MangaPlugin';
import * as Common from './decorators/Common';
import * as SpeedBinb from './decorators/SpeedBinb';
import { FetchHTML } from '../platform/FetchProvider';
import { SBVersion } from './decorators/SpeedBinb';

function MangaLabelExtractor(element: HTMLElement): string {
return element.textContent.split('>').pop().trim() || element.textContent.trim();
}

@Common.MangaCSS(/^{origin}\/[^/]+\/backnumber\/\d+$/, 'ol.c-breadcrumb li:last-of-type a, div.p-book-overview__detail h2.p-book-overview__detail-bookname', MangaLabelExtractor)
@SpeedBinb.PagesSinglePageAjax(SBVersion.v016130)
@SpeedBinb.ImageAjax()
export default class extends DecoratableMangaScraper {

public constructor() {
super('bookhodai', `BookHodai`, 'https://bookhodai.jp', Tags.Language.Japanese, Tags.Media.Manga, Tags.Source.Official);
}

public override get Icon() {
return icon;
}

public override async FetchMangas(provider: MangaPlugin): Promise<Manga[]> {
const paths = ['magazine', 'magazine_pop', 'manga', 'manga_pop'];
const mangaList: Manga[] = [];
for (const path of paths) {
const mangas = await Common.FetchMangasMultiPageCSS.call(this, provider, `/search/${path}?page={page}`, '.p-bookdetail-contents__title a');
mangaList.push(...mangas);
}
return mangaList.distinct();
}

public override async FetchChapters(manga: Manga): Promise<Chapter[]> {
const chapters: Chapter[] = [];
const dom = await FetchHTML(new Request(new URL(manga.Identifier, this.URI)));

//get first "chapter" (book) details
const bookdetails = dom.querySelector<HTMLDivElement>('section.p-book-overview');
let title = (bookdetails.querySelector('span.p-book-overview__detail-volnumber') ?? bookdetails.querySelector('h2.p-book-overview__detail-vol')).textContent.replaceAll('\n', '').trim();
title = title.replace(manga.Title, '').trim() != '' ? title.replace(manga.Title, '').trim() : title;
const chapterlinkNode = bookdetails.querySelector<HTMLAnchorElement>('a[href*="viewer"');
if (chapterlinkNode) chapters.push(new Chapter(this, manga, chapterlinkNode.pathname + chapterlinkNode.search, title));

const chaptersNodes = [...dom.querySelectorAll<HTMLElement>('div.p-book-backnumber-series__item')];
for (const chapter of chaptersNodes) {
const title = (chapter.querySelector('.p-book-backnumber-series__volnumber') ?? chapter.querySelector('.p-book-backnumber-series__book-nm')).textContent.trim();
const link = chapter.querySelector<HTMLAnchorElement>('a[href*="viewer"]');
chapters.push(new Chapter(this, manga, link.pathname + link.search, title.replace(manga.Title, '').trim()));
}
return chapters.distinct();
}
}
Binary file added web/src/engine/websites/BookHodai.webp
Binary file not shown.
52 changes: 52 additions & 0 deletions web/src/engine/websites/BookHodai_e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { TestFixture } from '../../../test/WebsitesFixture';

new TestFixture({
plugin: {
id: 'bookhodai',
title: 'BookHodai'
},
container: {
url: 'https://bookhodai.jp/magazine/backnumber/1029551',
id: '/magazine/backnumber/1029551',
title: 'comicグラスト',
timeout: 15000

},
child: {
id: '/viewer?book_id=2000035407&branch_no=01&book_type=3',
title: 'vol.85',
timeout: 20000
},
entry: {
index: 0,
size: 3_984_399,
type: 'image/png',
timeout: 30000

}
}).AssertWebsite();

new TestFixture({
plugin: {
id: 'bookhodai',
title: 'BookHodai'
},
container: {
url: 'https://bookhodai.jp/manga/backnumber/62789',
id: '/manga/backnumber/62789',
title: '風光る',
timeout: 15000

},
child: {
id: '/viewer?book_id=3000099022&branch_no=01&book_type=4',
title: '1 ~ 44',
timeout: 20000
},
entry: {
index: 0,
size: 4_011_228,
type: 'image/png',
timeout: 30000
}
}).AssertWebsite();
29 changes: 29 additions & 0 deletions web/src/engine/websites/BookLive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Tags } from '../Tags';
import icon from './BookLive.webp';
import { DecoratableMangaScraper } from '../providers/MangaPlugin';
import * as Common from './decorators/Common';
import * as SpeedBinb from './decorators/SpeedBinb';
import { SBVersion } from './decorators/SpeedBinb';
function ChapterExtractor(anchor: HTMLAnchorElement) {
return {
id: '/bviewer/s/?cid=' + anchor.dataset.title + '_' + anchor.dataset.vol,
title: anchor.closest('.series_list_detail').querySelector<HTMLAnchorElement>('a[class*=sl-title]').text.trim()
};
}

@Common.MangaCSS(/^{origin}\/product\/index\/title_id\/\d+\/vol_no\/\d+$/, 'li.contents span.book_title')
@Common.MangasNotSupported()
@Common.ChaptersSinglePageCSS('div#slide_up_top li.item div.buttons a.bl-bviewer[data-title][data-vol]', ChapterExtractor)
@SpeedBinb.PagesSinglePageAjax(SBVersion.v016130)
@SpeedBinb.ImageAjax()

export default class extends DecoratableMangaScraper {

public constructor() {
super('booklive', `BookLive`, 'https://booklive.jp', Tags.Language.Japanese, Tags.Media.Manga, Tags.Source.Official);
}

public override get Icon() {
return icon;
}
}
24 changes: 24 additions & 0 deletions web/src/engine/websites/BookLive_e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { TestFixture, type Config } from '../../../test/WebsitesFixture';

const config: Config = {
plugin: {
id: 'booklive',
title: 'BookLive'
},
container: {
url: 'https://booklive.jp/product/index/title_id/20063601/vol_no/001',
id: '/product/index/title_id/20063601/vol_no/001',
title: '火の神さまの掃除人ですが、いつの間にか花嫁として溺愛されています【単話】'
},
child: {
id: '/bviewer/s/?cid=20063601_001',
title: '1'
},
entry: {
index: 0,
size: 2_219_447,
type: 'image/png'
}
};

new TestFixture(config).AssertWebsite();
52 changes: 52 additions & 0 deletions web/src/engine/websites/Cmoa.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { Tags } from '../Tags';
import icon from './Cmoa.webp';
import { Chapter, DecoratableMangaScraper, type MangaPlugin, type Manga } from '../providers/MangaPlugin';
import * as Common from './decorators/Common';
import * as SpeedBinb from './decorators/SpeedBinb';
import { FetchCSS } from '../platform/FetchProvider';
import { SBVersion } from './decorators/SpeedBinb';

@Common.MangasNotSupported()
@SpeedBinb.PagesSinglePageAjax(SBVersion.v016452)
@SpeedBinb.ImageAjax()
export default class extends DecoratableMangaScraper {
public constructor() {
super('cmoa', `コミックシーモア (Cmoa)`, 'https://www.cmoa.jp', Tags.Language.Japanese, Tags.Media.Manga, Tags.Source.Official);
}
public override get Icon() {
return icon;
}

public override ValidateMangaURL(url: string): boolean {
return /https:\/\/www\.cmoa\.jp\/title\/\d+\/(vol\/\d+\/)?$/.test(url);
}

public override async FetchManga(provider: MangaPlugin, url: string): Promise<Manga> {
const newUrl = url.replace(/\/vol\/\d+\/$/, '/');
return await Common.FetchMangaCSS.call(this, provider, newUrl, '#GA_this_page_title_name');
}

public override async FetchChapters(manga: Manga): Promise<Chapter[]> {
const pages = await FetchCSS<HTMLAnchorElement>(new Request(new URL(manga.Identifier, this.URI).href), '#comic_list > .pagination:nth-child(1) li:nth-last-child(2) a');
const chapters = [];
const totalPage = pages.length == 0 ? 1 : parseInt(new URL(pages[0].href).searchParams.get('page'));
for (let i = 0; i < totalPage; i++) {
const uri = new URL(manga.Identifier, this.URI);
uri.searchParams.set('page', String(i + 1));
const pageRequest = new Request(uri);
const data = await FetchCSS(pageRequest, '.title_vol_vox_vols .title_vol_vox_vols_i');
for (const element of data) {
const chapterLink = element.querySelector<HTMLAnchorElement>('a[href^="/reader/"]');
if (!chapterLink) {
continue;
}
const chapterUrl = new URL(chapterLink.href, this.URI);
const id = chapterUrl.searchParams.get('content_id');
const u0 = chapterUrl.pathname.startsWith('/reader/sample') ? 1 : 0;
const title = element.querySelector('.title_details_title_name_h2').textContent.trim();
chapters.push(new Chapter(this, manga, `/bib/speedreader/?cid=${id.slice(1, 11)}_jp_${id.slice(11, 15)}&u0=${u0}&u1=0`, title.replace('NEW\n', '').trim()));
}
}
return chapters;
}
}
Binary file added web/src/engine/websites/Cmoa.webp
Binary file not shown.
24 changes: 24 additions & 0 deletions web/src/engine/websites/Cmoa_e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { TestFixture, type Config } from '../../../test/WebsitesFixture';

const config: Config = {
plugin: {
id: 'cmoa',
title: 'コミックシーモア (Cmoa)'
},
container: {
url: 'https://www.cmoa.jp/title/151961/vol/24/',
id: '/title/151961/',
title: '呪術廻戦'
},
child: {
id: '/bib/speedreader/?cid=0000151961_jp_0021&u0=1&u1=0',
title: '呪術廻戦 21'
},
entry: {
index: 0,
size: 2_880_733,
type: 'image/png'
}
};

new TestFixture(config).AssertWebsite();
28 changes: 28 additions & 0 deletions web/src/engine/websites/ComicBrise.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Tags } from '../Tags';
import icon from './ComicBrise.webp';
import { Chapter, DecoratableMangaScraper, type Manga } from '../providers/MangaPlugin';
import * as Common from './decorators/Common';
import * as SpeedBinb from './decorators/SpeedBinb';
import { FetchCSS } from '../platform/FetchProvider';
import { SBVersion } from './decorators/SpeedBinb';

@Common.MangaCSS(/^{origin}\/contents\/[^/]+\/$/, '.post-title')
@Common.MangasSinglePageCSS('/titlelist', '.list-works a')
@SpeedBinb.PagesSinglePageAjax(SBVersion.v016061)
@SpeedBinb.ImageAjax()
export default class extends DecoratableMangaScraper {
public constructor() {
super('comicbrise', `Comic-Brise`, 'https://www.comic-brise.com', Tags.Language.Japanese, Tags.Media.Manga, Tags.Source.Official);
}

public override get Icon() {
return icon;
}

public override async FetchChapters(manga: Manga): Promise<Chapter[]> {
return (await FetchCSS(new Request(new URL(manga.Identifier, this.URI)), '.modal.modal-chapter .modal-body'))
.reverse()
//.filter(e => e.querySelector(".banner-trial img").getAttribute("alt") == "FREE") //dont filter for free chapter
.map(element => new Chapter(this, manga, element.querySelector<HTMLAnchorElement>('.banner-trial a').pathname, element.querySelector('.primary-title').textContent.trim()));
}
}
25 changes: 25 additions & 0 deletions web/src/engine/websites/ComicBrise_e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { TestFixture, type Config } from '../../../test/WebsitesFixture';

const config: Config = {
plugin: {
id: 'comicbrise',
title: 'Comic-Brise'
},
container: {
url: 'https://www.comic-brise.com/contents/mobu/',
id: '/contents/mobu/',
title: 'モブ顔令嬢~乙女ゲー世界の悪役令嬢に転生したのにどうしてこうなった~'
},
child: {
id: '/comic_ep/mobu_ep1',
title: '第1話'
},
entry: {
index: 0,
size: 4_607_990,
type: 'image/png',
timeout: 10000
}
};

new TestFixture(config).AssertWebsite();
40 changes: 40 additions & 0 deletions web/src/engine/websites/ComicMeteor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Tags } from '../Tags';
import icon from './ComicMeteor.webp';
import { Chapter, DecoratableMangaScraper, type Manga } from '../providers/MangaPlugin';
import * as Common from './decorators/Common';
import * as SpeedBinb from './decorators/SpeedBinb';
import { FetchCSS } from '../platform/FetchProvider';
import { SBVersion } from './decorators/SpeedBinb';

function MangaExtractor(anchor: HTMLAnchorElement) {
return {
id: anchor.pathname,
title: anchor.querySelector('img').getAttribute('alt').trim()
};
}

@Common.MangaCSS(/^{origin}\/[^/]+\/$/, 'div.h2ttl_other')
@Common.MangasMultiPageCSS('/wp-admin/admin-ajax.php?action=get_flex_titles_for_toppage&get_num=64&page={page}', 'div.update_work_size div.update_work_info_img a', 1, 1, 0, MangaExtractor)
@SpeedBinb.PagesSinglePageAjax(SBVersion.v016061)
@SpeedBinb.ImageAjax()
export default class extends DecoratableMangaScraper {
public constructor() {
super('comicmeteor', `COMICメテオ (COMIC Meteor)`, 'https://comic-meteor.jp', Tags.Language.Japanese, Tags.Media.Manga, Tags.Source.Official);
}
public override get Icon() {
return icon;
}

public override async FetchChapters(manga: Manga): Promise<Chapter[]> {
const [ data ] = await FetchCSS(new Request(new URL(manga.Identifier, this.URI)), 'div#contents');

let chapterList = [...data.querySelectorAll<HTMLAnchorElement>('div.work_episode div.work_episode_box div.work_episode_table div.work_episode_link_btn.work_episode_link_orange a')]
.map(element => new Chapter(this, manga, element.pathname, element.closest('div.work_episode_table').querySelector<HTMLDivElement>('div.work_episode_txt').innerText.replace(manga.Title, '').trim()));

if (chapterList.length == 0) {
chapterList = [...data.querySelectorAll<HTMLAnchorElement>('div.latest_info_box div.latest_info_link_btn01 a')]
.map(element => new Chapter(this, manga, element.pathname, element.text.replace('読む', '').trim()));
}
return chapterList;
}
}
24 changes: 24 additions & 0 deletions web/src/engine/websites/ComicMeteor_e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { TestFixture, type Config } from '../../../test/WebsitesFixture';

const config: Config = {
plugin: {
id: 'comicmeteor',
title: 'COMICメテオ (COMIC Meteor)'
},
container: {
url: 'https://comic-meteor.jp/isekaiseihukuki/',
id: '/isekaiseihukuki/',
title: '異世界征服記~不遇種族たちの最強国家~'
},
child: {
id: '/ptdata/isekaiseihukuki/0001/',
title: '第1話'
},
entry: {
index: 0,
size: 3_860_271,
type: 'image/png'
}
};

new TestFixture(config).AssertWebsite();
Loading