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 Comici decorator & Websites #507

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
8f2c3b0
Add ComiciViewer decorator & websites
MikeZeDev Feb 20, 2024
90aa318
add tests & tiny fixes
MikeZeDev Feb 22, 2024
15aeaaa
Comici : use site for pages referer
MikeZeDev Mar 6, 2024
3d065fe
Add MangaBANG
MikeZeDev Mar 6, 2024
fb0b692
minor code changes
MikeZeDev Mar 9, 2024
13302ec
Merge branch 'master' into Comici
MikeZeDev Mar 23, 2024
6d27413
Merge branch 'master' into Comici
MikeZeDev Mar 30, 2024
3b3a262
MagKan : now uses Comici
MikeZeDev Mar 30, 2024
f6a38a5
Comici websites : better regexp
MikeZeDev Mar 30, 2024
03fab41
Merge branch 'master' into Comici
MikeZeDev Apr 23, 2024
2813aac
update index
MikeZeDev Apr 23, 2024
1dd3a42
adjust manga selector
MikeZeDev Apr 23, 2024
b78091a
clean code
MikeZeDev Apr 23, 2024
76526d6
MangaCross > ChampionCross
MikeZeDev Apr 23, 2024
60c5d3f
update cross logo
MikeZeDev Apr 23, 2024
f9d67e7
Merge branch 'master' into Comici
MikeZeDev Apr 27, 2024
60e4002
fix case
MikeZeDev Apr 27, 2024
a2939fd
Merge branch 'master' into Comici
MikeZeDev May 7, 2024
a69a915
update tests to use vitest
MikeZeDev May 7, 2024
b2f1c2e
Merge branch 'master' into Comici
MikeZeDev May 18, 2024
cf0a080
Update _index.ts
MikeZeDev May 18, 2024
8df43ae
Merge branch 'master' into Comici
MikeZeDev Jun 15, 2024
8ae83de
code refactoring
MikeZeDev Jun 22, 2024
789111e
fix tests
MikeZeDev Jun 22, 2024
3167068
Comici : use chapter url to fetch pages
MikeZeDev Jun 25, 2024
5a8bb56
Add RimacomiPlus
MikeZeDev Jun 25, 2024
ef767c1
Youngchampion: fix mangalist
MikeZeDev Jun 25, 2024
2c2ab9b
Merge branch 'master' into Comici
MikeZeDev Jul 15, 2024
ed883e5
Merge branch 'master' into Comici
MikeZeDev Jul 28, 2024
1a2e5f9
Merge branch 'master' into Comici
MikeZeDev Aug 14, 2024
313bb0a
update bookmarkconverter
MikeZeDev Aug 14, 2024
8e5cda9
Update _index.ts
MikeZeDev Aug 14, 2024
2ab8e7d
Merge branch 'master' into Comici
MikeZeDev Aug 16, 2024
4bf6b77
Merge branch 'master' into Comici
MikeZeDev Aug 16, 2024
f575171
Merge branch 'master' into Comici
MikeZeDev Sep 9, 2024
40a869b
Update _index.ts
MikeZeDev Sep 9, 2024
8ef8d12
Merge branch 'master' into Comici
MikeZeDev Sep 28, 2024
1364ee6
use typed page
MikeZeDev Sep 28, 2024
d3c1195
Merge branch 'master' into Comici
MikeZeDev Oct 7, 2024
7cb8381
Update _index.ts
MikeZeDev Oct 7, 2024
6ae6c96
Merge branch 'master' into Comici
MikeZeDev Oct 13, 2024
69a091b
Merge branch 'master' into Comici
MikeZeDev Oct 17, 2024
c058ea7
Update _index.ts
MikeZeDev Oct 17, 2024
f2e5fa8
Merge branch 'master' into Comici
MikeZeDev Oct 27, 2024
fa65b39
update tests
MikeZeDev Oct 27, 2024
9754e52
Merge branch 'master' into Comici
MikeZeDev Nov 4, 2024
524c9b3
use values instead of html element
MikeZeDev Nov 4, 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
1 change: 1 addition & 0 deletions web/src/engine/transformers/BookmarkConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const legacyWebsiteIdentifierMap = new Map([
[ 'komikav', 'apkomik' ],
[ 'kumascans', 'retsu' ],
[ 'lyrascans', 'quantumscans' ],
[ 'mangacross', 'championcross' ],
[ 'mangamx', 'mangaoni' ],
[ 'manganel', 'manganato' ],
[ 'mangaproz', 'mangapro' ],
Expand Down
1 change: 1 addition & 0 deletions web/src/engine/transformers/BookmarkConverter_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const legacyWebsiteIdentifierMapTestCases = [
{ sourceID: 'komikav', targetID: 'apkomik' },
{ sourceID: 'kumascans', targetID: 'retsu' },
{ sourceID: 'lyrascans', targetID: 'quantumscans' },
{ sourceID: 'mangacross', targetID: 'championcross'},
{ sourceID: 'mangamx', targetID: 'mangaoni' },
{ sourceID: 'manganel', targetID: 'manganato' },
{ sourceID: 'mangaproz', targetID: 'mangapro' },
Expand Down
21 changes: 21 additions & 0 deletions web/src/engine/websites/BigComics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Tags } from '../Tags';
import icon from './BigComics.webp';
import { DecoratableMangaScraper } from '../providers/MangaPlugin';
import * as Common from './decorators/Common';
import * as Comici from './decorators/ComiciViewer';

@Common.MangaCSS(/^{origin}\/series\/[^/]+(\/)?$/, Comici.queryMangaTitleURI)
@Common.MangasMultiPageCSS(Comici.mangaListPath, Comici.queryManga, 0, 1, 0, Comici.MangaExtractor)
@Comici.ChaptersSinglePageCSS()
@Comici.PagesSinglePageAJAX()
@Comici.ImageAjax()
export default class extends DecoratableMangaScraper {

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

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

const config = {
plugin: {
id: 'bigcomics',
title: 'Big Comics'
},
container: {
url: 'https://bigcomics.jp/series/48eef350d364a',
id: '/series/48eef350d364a',
title: '岳'
},
child: {
id: '/episodes/4b87f55986ccc/',
title: '1巻-第0歩 お家'
},
entry: {
index: 0,
size: 670_778,
type: 'image/png'
}
};

new TestFixture(config).AssertWebsite();
21 changes: 21 additions & 0 deletions web/src/engine/websites/COMICMeDu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Tags } from '../Tags';
import icon from './COMICMeDu.webp';
import { DecoratableMangaScraper } from '../providers/MangaPlugin';
import * as Common from './decorators/Common';
import * as Comici from './decorators/ComiciViewer';

@Common.MangaCSS(/^{origin}\/series\/[^/]+(\/)?$/, Comici.queryMangaTitleURI)
@Common.MangasMultiPageCSS(Comici.mangaListPath, Comici.queryManga, 0, 1, 0, Comici.MangaExtractor)
@Comici.ChaptersSinglePageCSS()
@Comici.PagesSinglePageAJAX()
@Comici.ImageAjax()
export default class extends DecoratableMangaScraper {

public constructor() {
super('comicmedu', `COMIC MeDu (こみっくめづ)`, 'https://comic-medu.com', Tags.Media.Manga, Tags.Language.Japanese, Tags.Source.Official);
}

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

const config = {
plugin: {
id: 'comicmedu',
title: 'COMIC MeDu (こみっくめづ)'
},
container: {
url: 'https://comic-medu.com/series/c2f3978c40eea',
id: '/series/c2f3978c40eea',
title: 'ぱらのいあけ〜じ'
},
child: {
id: '/episodes/beaa305e9cf32/',
title: 'その(1)'
},
entry: {
index: 0,
size: 760_096,
type: 'image/png'
}
};

new TestFixture(config).AssertWebsite();
20 changes: 20 additions & 0 deletions web/src/engine/websites/ChampionCross.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Tags } from '../Tags';
import icon from './ChampionCross.webp';
import { DecoratableMangaScraper } from '../providers/MangaPlugin';
import * as Common from './decorators/Common';
import * as Comici from './decorators/ComiciViewer';

@Common.MangaCSS(/^{origin}\/series\/[^/]+(\/)?$/, Comici.queryMangaTitleURI)
@Common.MangasMultiPageCSS(Comici.mangaListPath, 'div.article-text > a', 0, 1, 0, Comici.MangaExtractor)
@Comici.ChaptersSinglePageCSS()
@Comici.PagesSinglePageAJAX()
@Comici.ImageAjax()
export default class extends DecoratableMangaScraper {
public constructor() {
super('championcross', `Champion Cross`, 'https://championcross.jp', Tags.Language.Japanese, Tags.Media.Manga, Tags.Source.Official);
}

public override get Icon() {
return icon;
}
}
Binary file added web/src/engine/websites/ChampionCross.webp
Binary file not shown.
24 changes: 24 additions & 0 deletions web/src/engine/websites/ChampionCross_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: 'championcross',
title: 'Champion Cross'
},
container: {
url: 'https://championcross.jp/series/50d8ea89cfc92/',
id: '/series/50d8ea89cfc92/',
title: 'あの頃、私たちは魔法使いでした。'
},
child: {
id: '/episodes/13d4bf3743424/',
title: '第1話 「桜が舞った日のこと」'
},
entry: {
index: 0,
size: 2_691_707,
type: 'image/png'
}
};

new TestFixture(config).AssertWebsite();
21 changes: 21 additions & 0 deletions web/src/engine/websites/ComicRide.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Tags } from '../Tags';
import icon from './ComicRide.webp';
import { DecoratableMangaScraper } from '../providers/MangaPlugin';
import * as Common from './decorators/Common';
import * as Comici from './decorators/ComiciViewer';

@Common.MangaCSS(/^{origin}\/series\/[^/]+(\/)?$/, Comici.queryMangaTitleURI)
@Common.MangasMultiPageCSS(Comici.mangaListPath, Comici.queryManga, 0, 1, 0, Comici.MangaExtractor)
@Comici.ChaptersSinglePageCSS()
@Comici.PagesSinglePageAJAX()
@Comici.ImageAjax()
export default class extends DecoratableMangaScraper {

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

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

const config = {
plugin: {
id: 'comicride',
title: 'Comic Ride'
},
container: {
url: 'https://comicride.jp/series/24a2c5eb2d433',
id: '/series/24a2c5eb2d433',
title: '呪われ侯爵様の訳ありメイド'
},
child: {
id: '/episodes/48d531d8140b5/',
title: '第1話'
},
entry: {
index: 0,
size: 3_298_112,
type: 'image/png'
}
};

new TestFixture(config).AssertWebsite();
41 changes: 7 additions & 34 deletions web/src/engine/websites/MagKan.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import { Tags } from '../Tags';
import icon from './MagKan.webp';
import { Chapter, DecoratableMangaScraper, type Manga, Page } from '../providers/MangaPlugin';
import { DecoratableMangaScraper } from '../providers/MangaPlugin';
import * as Common from './decorators/Common';
import { Fetch, FetchCSS } from '../platform/FetchProvider';
import * as Comici from './decorators/ComiciViewer';

function MangaExtractor(element: HTMLElement) {
return {
id: element.querySelector<HTMLAnchorElement>('a').pathname,
title: element.querySelector('h2.comic_name').textContent.trim()
};
}

@Common.MangaCSS(/^{origin}\/[^/]+/, 'h1.ttl')
@Common.MangasSinglePageCSS('/', 'div#main div.panel div.box div.inner', MangaExtractor)
@Common.ImageAjax()
@Common.MangaCSS(/^{origin}\/series\/[^/]+(\/)?$/, Comici.queryMangaTitleURI)
@Common.MangasMultiPageCSS(Comici.mangaListPath, Comici.queryManga, 0, 1, 0, Comici.MangaExtractor)
@Comici.ChaptersSinglePageCSS()
@Comici.PagesSinglePageAJAX()
@Comici.ImageAjax()
export default class extends DecoratableMangaScraper {

public constructor() {
Expand All @@ -24,26 +19,4 @@ export default class extends DecoratableMangaScraper {
return icon;
}

public override async FetchChapters(manga: Manga): Promise<Chapter[]> {
const request = new Request(new URL(manga.Identifier, this.URI).href);
const [mainDiv] = await FetchCSS<HTMLDivElement>(request, 'div#main');
const current = [...mainDiv.querySelectorAll<HTMLAnchorElement>('div#main div.update_summary div.exp ul.btn li a[href*="/assets/files/"]')].map(element => {
const id = element.pathname.replace(/\/HTML5\/?$/i, '');
return new Chapter(this, manga, id, element.text.replace('を読む', '').trim());
});
const previous = [...mainDiv.querySelectorAll('div#main div.sam_exp div.exp')].map(element => {
const id = element.querySelector<HTMLAnchorElement>('ul.btn li a[href*="/assets/files/"]').pathname.replace(/\/HTML5\/?$/i, '');
return new Chapter(this, manga, id, element.querySelector('div.back_number_summary div.ttl').textContent.trim());
});
return [...current, ...previous].distinct();
}

public override async FetchPages(chapter: Chapter): Promise<Page[]> {
const uri = new URL(chapter.Identifier + '/iPhone/ibook.xml', this.URI);
const response = await Fetch(new Request(uri.href));
const data = await response.text();
const pages = parseInt(data.match(/<total>(\d+)<\/total>/)[1]);
return new Array<Page>(pages).fill(null).map((_, index) => new Page(this, chapter, new URL(`${chapter.Identifier}/books/images/2/${index + 1}.jpg`, uri)));
}

}
10 changes: 5 additions & 5 deletions web/src/engine/websites/MagKan_e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ const config = {
title: 'MagKan'
},
container: {
url: 'https://kansai.mag-garden.co.jp/oshihen/',
id: '/oshihen/',
url: 'https://kansai.mag-garden.co.jp/series/76efde6cc8881/',
id: '/series/76efde6cc8881/',
title: '推し変しやがれ!!'
},
child: {
id: '/assets/files/oshihen1',
id: '/episodes/a742481ce1e89/',
title: '第零話'
},
entry: {
index: 1,
size: 317_098,
type: 'image/jpeg'
size: 3_166_820,
type: 'image/png'
}
};

Expand Down
21 changes: 21 additions & 0 deletions web/src/engine/websites/MangaBANG.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Tags } from '../Tags';
import icon from './MangaBANG.webp';
import { DecoratableMangaScraper } from '../providers/MangaPlugin';
import * as Common from './decorators/Common';
import * as Comici from './decorators/ComiciViewer';

@Common.MangaCSS(/^{origin}\/series\/[^/]+(\/)?$/, Comici.queryMangaTitleURI)
@Common.MangasMultiPageCSS(Comici.mangaListPath, Comici.queryManga, 0, 1, 0, Comici.MangaExtractor)
@Comici.ChaptersSinglePageCSS()
@Comici.PagesSinglePageAJAX()
@Comici.ImageAjax()
export default class extends DecoratableMangaScraper {

public constructor() {
super('mangabang', `MangaBANG Comics (マンガBANG コミックス)`, 'https://comics.manga-bang.com', Tags.Media.Manga, Tags.Language.Japanese, Tags.Source.Official);
}

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

const config = {
plugin: {
id: 'mangabang',
title: 'MangaBANG Comics (マンガBANG コミックス)'
},
container: {
url: 'https://comics.manga-bang.com/series/c2153a77b6019',
id: '/series/c2153a77b6019',
title: '藤崎くんちのお母さんには秘密がある'
},
child: {
id: '/episodes/fff51cc22815e/',
title: '藤崎くんちのお母さん (1)'
},
entry: {
index: 0,
size: 940_071,
type: 'image/png'
}
};

new TestFixture(config).AssertWebsite();
Loading