react-native-consumet 2.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/consumet/HttpRequestModule.kt +88 -33
- package/android/src/main/java/com/consumet/WebViewTask.kt +18 -3
- package/ios/Consumet.mm +172 -72
- package/lib/commonjs/NativeConsumet.ts +11 -5
- package/lib/commonjs/extension-registry.json +6 -6
- package/lib/commonjs/extension-registry.json.sig +1 -1
- package/lib/commonjs/extractors/kwik.js +28 -29
- package/lib/commonjs/extractors/kwik.js.map +1 -1
- package/lib/commonjs/index.js +18 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/types.js +6 -0
- package/lib/commonjs/models/types.js.map +1 -1
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js +12 -13
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/commonjs/providers/manga/asurascans.js +160 -96
- package/lib/commonjs/providers/manga/asurascans.js.map +1 -1
- package/lib/commonjs/providers/manga/flamescans.js +173 -91
- package/lib/commonjs/providers/manga/flamescans.js.map +1 -1
- package/lib/commonjs/providers/manga/index.js +1 -15
- package/lib/commonjs/providers/manga/index.js.map +1 -1
- package/lib/commonjs/providers/manga/mangadex.js +234 -227
- package/lib/commonjs/providers/manga/mangadex.js.map +1 -1
- package/lib/commonjs/providers/manga/mangahere.js +279 -135
- package/lib/commonjs/providers/manga/mangahere.js.map +1 -1
- package/lib/commonjs/providers/manga/mangakakalot.js +206 -107
- package/lib/commonjs/providers/manga/mangakakalot.js.map +1 -1
- package/lib/commonjs/providers/manga/mangapill.js +126 -38
- package/lib/commonjs/providers/manga/mangapill.js.map +1 -1
- package/lib/commonjs/providers/meta/anilist.js +41 -12
- package/lib/commonjs/providers/meta/anilist.js.map +1 -1
- package/lib/commonjs/utils/index.js +19 -0
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/manga.js +60 -0
- package/lib/commonjs/utils/manga.js.map +1 -0
- package/lib/module/NativeConsumet.ts +11 -5
- package/lib/module/extension-registry.json +6 -6
- package/lib/module/extension-registry.json.sig +1 -1
- package/lib/module/extractors/kwik.js +28 -29
- package/lib/module/extractors/kwik.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/types.js +9 -0
- package/lib/module/models/types.js.map +1 -1
- package/lib/module/providers/anime/animepahe/create-animepahe.js +12 -13
- package/lib/module/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/module/providers/manga/asurascans.js +161 -96
- package/lib/module/providers/manga/asurascans.js.map +1 -1
- package/lib/module/providers/manga/flamescans.js +174 -91
- package/lib/module/providers/manga/flamescans.js.map +1 -1
- package/lib/module/providers/manga/index.js +1 -15
- package/lib/module/providers/manga/index.js.map +1 -1
- package/lib/module/providers/manga/mangadex.js +236 -228
- package/lib/module/providers/manga/mangadex.js.map +1 -1
- package/lib/module/providers/manga/mangahere.js +276 -132
- package/lib/module/providers/manga/mangahere.js.map +1 -1
- package/lib/module/providers/manga/mangakakalot.js +207 -107
- package/lib/module/providers/manga/mangakakalot.js.map +1 -1
- package/lib/module/providers/manga/mangapill.js +128 -39
- package/lib/module/providers/manga/mangapill.js.map +1 -1
- package/lib/module/providers/meta/anilist.js +41 -12
- package/lib/module/providers/meta/anilist.js.map +1 -1
- package/lib/module/utils/index.js +1 -0
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/manga.js +54 -0
- package/lib/module/utils/manga.js.map +1 -0
- package/lib/typescript/commonjs/src/NativeConsumet.d.ts +11 -5
- package/lib/typescript/commonjs/src/NativeConsumet.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/kwik.d.ts +1 -1
- package/lib/typescript/commonjs/src/extractors/kwik.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +2 -2
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/types.d.ts +38 -5
- package/lib/typescript/commonjs/src/models/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/manga/asurascans.d.ts +14 -4
- package/lib/typescript/commonjs/src/providers/manga/asurascans.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/manga/flamescans.d.ts +18 -3
- package/lib/typescript/commonjs/src/providers/manga/flamescans.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/manga/index.d.ts +0 -14
- package/lib/typescript/commonjs/src/providers/manga/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/manga/mangadex.d.ts +22 -5
- package/lib/typescript/commonjs/src/providers/manga/mangadex.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/manga/mangahere.d.ts +15 -3
- package/lib/typescript/commonjs/src/providers/manga/mangahere.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/manga/mangakakalot.d.ts +26 -4
- package/lib/typescript/commonjs/src/providers/manga/mangakakalot.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/manga/mangapill.d.ts +16 -2
- package/lib/typescript/commonjs/src/providers/manga/mangapill.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/meta/anilist.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/manga.d.ts +19 -0
- package/lib/typescript/commonjs/src/utils/manga.d.ts.map +1 -0
- package/lib/typescript/module/src/NativeConsumet.d.ts +11 -5
- package/lib/typescript/module/src/NativeConsumet.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/kwik.d.ts +1 -1
- package/lib/typescript/module/src/extractors/kwik.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +2 -2
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/models/types.d.ts +38 -5
- package/lib/typescript/module/src/models/types.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/manga/asurascans.d.ts +14 -4
- package/lib/typescript/module/src/providers/manga/asurascans.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/manga/flamescans.d.ts +18 -3
- package/lib/typescript/module/src/providers/manga/flamescans.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/manga/index.d.ts +0 -14
- package/lib/typescript/module/src/providers/manga/index.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/manga/mangadex.d.ts +22 -5
- package/lib/typescript/module/src/providers/manga/mangadex.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/manga/mangahere.d.ts +15 -3
- package/lib/typescript/module/src/providers/manga/mangahere.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/manga/mangakakalot.d.ts +26 -4
- package/lib/typescript/module/src/providers/manga/mangakakalot.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/manga/mangapill.d.ts +16 -2
- package/lib/typescript/module/src/providers/manga/mangapill.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/meta/anilist.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/index.d.ts +1 -0
- package/lib/typescript/module/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/manga.d.ts +19 -0
- package/lib/typescript/module/src/utils/manga.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/NativeConsumet.ts +11 -5
- package/src/extension-registry.json +6 -6
- package/src/extension-registry.json.sig +1 -1
- package/src/extractors/kwik.ts +30 -43
- package/src/index.tsx +6 -0
- package/src/models/types.ts +38 -3
- package/src/providers/anime/animepahe/create-animepahe.ts +15 -14
- package/src/providers/manga/asurascans.ts +200 -135
- package/src/providers/manga/flamescans.ts +221 -118
- package/src/providers/manga/index.ts +0 -14
- package/src/providers/manga/mangadex.ts +335 -282
- package/src/providers/manga/mangahere.ts +309 -156
- package/src/providers/manga/mangakakalot.ts +249 -152
- package/src/providers/manga/mangapill.ts +163 -64
- package/src/providers/meta/anilist.ts +50 -14
- package/src/utils/index.ts +1 -0
- package/src/utils/manga.ts +58 -0
- package/lib/commonjs/providers/manga/brmangas.js +0 -110
- package/lib/commonjs/providers/manga/brmangas.js.map +0 -1
- package/lib/commonjs/providers/manga/comick.js +0 -154
- package/lib/commonjs/providers/manga/comick.js.map +0 -1
- package/lib/commonjs/providers/manga/mangahost.js +0 -113
- package/lib/commonjs/providers/manga/mangahost.js.map +0 -1
- package/lib/commonjs/providers/manga/mangapark.js +0 -97
- package/lib/commonjs/providers/manga/mangapark.js.map +0 -1
- package/lib/commonjs/providers/manga/mangareader.js +0 -106
- package/lib/commonjs/providers/manga/mangareader.js.map +0 -1
- package/lib/commonjs/providers/manga/mangasee123.js +0 -161
- package/lib/commonjs/providers/manga/mangasee123.js.map +0 -1
- package/lib/commonjs/providers/manga/readmanga.js +0 -269
- package/lib/commonjs/providers/manga/readmanga.js.map +0 -1
- package/lib/commonjs/providers/manga/vyvymanga.js +0 -166
- package/lib/commonjs/providers/manga/vyvymanga.js.map +0 -1
- package/lib/module/providers/manga/brmangas.js +0 -105
- package/lib/module/providers/manga/brmangas.js.map +0 -1
- package/lib/module/providers/manga/comick.js +0 -149
- package/lib/module/providers/manga/comick.js.map +0 -1
- package/lib/module/providers/manga/mangahost.js +0 -108
- package/lib/module/providers/manga/mangahost.js.map +0 -1
- package/lib/module/providers/manga/mangapark.js +0 -92
- package/lib/module/providers/manga/mangapark.js.map +0 -1
- package/lib/module/providers/manga/mangareader.js +0 -101
- package/lib/module/providers/manga/mangareader.js.map +0 -1
- package/lib/module/providers/manga/mangasee123.js +0 -156
- package/lib/module/providers/manga/mangasee123.js.map +0 -1
- package/lib/module/providers/manga/readmanga.js +0 -264
- package/lib/module/providers/manga/readmanga.js.map +0 -1
- package/lib/module/providers/manga/vyvymanga.js +0 -161
- package/lib/module/providers/manga/vyvymanga.js.map +0 -1
- package/lib/typescript/commonjs/src/providers/manga/brmangas.d.ts +0 -18
- package/lib/typescript/commonjs/src/providers/manga/brmangas.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/manga/comick.d.ts +0 -39
- package/lib/typescript/commonjs/src/providers/manga/comick.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/manga/mangahost.d.ts +0 -18
- package/lib/typescript/commonjs/src/providers/manga/mangahost.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/manga/mangapark.d.ts +0 -14
- package/lib/typescript/commonjs/src/providers/manga/mangapark.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/manga/mangareader.d.ts +0 -18
- package/lib/typescript/commonjs/src/providers/manga/mangareader.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/manga/mangasee123.d.ts +0 -17
- package/lib/typescript/commonjs/src/providers/manga/mangasee123.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/manga/readmanga.d.ts +0 -31
- package/lib/typescript/commonjs/src/providers/manga/readmanga.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/manga/vyvymanga.d.ts +0 -17
- package/lib/typescript/commonjs/src/providers/manga/vyvymanga.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/manga/brmangas.d.ts +0 -18
- package/lib/typescript/module/src/providers/manga/brmangas.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/manga/comick.d.ts +0 -39
- package/lib/typescript/module/src/providers/manga/comick.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/manga/mangahost.d.ts +0 -18
- package/lib/typescript/module/src/providers/manga/mangahost.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/manga/mangapark.d.ts +0 -14
- package/lib/typescript/module/src/providers/manga/mangapark.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/manga/mangareader.d.ts +0 -18
- package/lib/typescript/module/src/providers/manga/mangareader.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/manga/mangasee123.d.ts +0 -17
- package/lib/typescript/module/src/providers/manga/mangasee123.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/manga/readmanga.d.ts +0 -31
- package/lib/typescript/module/src/providers/manga/readmanga.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/manga/vyvymanga.d.ts +0 -17
- package/lib/typescript/module/src/providers/manga/vyvymanga.d.ts.map +0 -1
- package/src/providers/manga/brmangas.ts +0 -148
- package/src/providers/manga/comick.ts +0 -285
- package/src/providers/manga/mangahost.ts +0 -134
- package/src/providers/manga/mangapark.ts +0 -115
- package/src/providers/manga/mangareader.ts +0 -132
- package/src/providers/manga/mangasee123.ts +0 -187
- package/src/providers/manga/readmanga.ts +0 -380
- package/src/providers/manga/vyvymanga.ts +0 -237
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { load } from 'cheerio';
|
|
2
|
-
import { isText } from 'domhandler';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
MangaParser,
|
|
6
|
-
type ISearch,
|
|
7
|
-
type IMangaInfo,
|
|
8
|
-
type IMangaResult,
|
|
9
|
-
type IMangaChapterPage,
|
|
10
|
-
type IMangaChapter,
|
|
11
|
-
type ProviderContext,
|
|
12
|
-
} from '../../models';
|
|
13
|
-
import { createProviderContext } from '../../utils/create-provider-context';
|
|
14
|
-
|
|
15
|
-
export class Mangasee123 extends MangaParser {
|
|
16
|
-
override readonly name = 'MangaSee';
|
|
17
|
-
protected override baseUrl = 'https://mangasee123.com';
|
|
18
|
-
protected override logo =
|
|
19
|
-
'https://scontent.fman4-1.fna.fbcdn.net/v/t1.6435-1/80033336_1830005343810810_419412485691408384_n.png?stp=dst-png_p148x148&_nc_cat=104&ccb=1-7&_nc_sid=1eb0c7&_nc_ohc=XpeoABDI-sEAX-5hLFV&_nc_ht=scontent.fman4-1.fna&oh=00_AT9nIRz5vPiNqqzNpSg2bJymX22rZ1JumYTKBqg_cD0Alg&oe=6317290E';
|
|
20
|
-
protected override classPath = 'MANGA.Mangasee123';
|
|
21
|
-
|
|
22
|
-
/** @param ctx provider context; requests go through its axios (default: `createProviderContext()`) */
|
|
23
|
-
constructor(private readonly ctx: ProviderContext = createProviderContext()) {
|
|
24
|
-
super();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// private readonly sgProxy = 'https://cors.consumet.stream';
|
|
28
|
-
|
|
29
|
-
override fetchMangaInfo = async (mangaId: string, ...args: any): Promise<IMangaInfo> => {
|
|
30
|
-
const mangaInfo: IMangaInfo = {
|
|
31
|
-
id: mangaId,
|
|
32
|
-
title: '',
|
|
33
|
-
};
|
|
34
|
-
const url = `${this.baseUrl}/manga`;
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
const { data } = await this.ctx.axios.get(`${url}/${mangaId}`);
|
|
38
|
-
const $ = load(data);
|
|
39
|
-
|
|
40
|
-
const schemaScript = $('body > script:nth-child(15)').get()[0]!.children[0];
|
|
41
|
-
if (isText(schemaScript!)) {
|
|
42
|
-
const mainEntity = JSON.parse(schemaScript.data).mainEntity;
|
|
43
|
-
|
|
44
|
-
mangaInfo.title = mainEntity.name;
|
|
45
|
-
mangaInfo.altTitles = mainEntity.alternateName;
|
|
46
|
-
mangaInfo.genres = mainEntity.genre;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
mangaInfo.image = $('img.bottom-5').attr('src');
|
|
50
|
-
mangaInfo.headerForImage = { Referer: this.baseUrl };
|
|
51
|
-
mangaInfo.description = $('.top-5 .Content').text();
|
|
52
|
-
|
|
53
|
-
const contentScript = $('body > script:nth-child(16)').get()[0]!.children[0];
|
|
54
|
-
if (isText(contentScript!)) {
|
|
55
|
-
const chaptersData = this.processScriptTagVariable(contentScript.data, 'vm.Chapters = ');
|
|
56
|
-
|
|
57
|
-
mangaInfo.chapters = chaptersData.map(
|
|
58
|
-
(i: { [x: string]: any }): IMangaChapter => ({
|
|
59
|
-
id: `${mangaId}-chapter-${this.processChapterNumber(i.Chapter)}`,
|
|
60
|
-
title: `${i.ChapterName ?? `Chapter ${this.processChapterNumber(i.Chapter)}`}`,
|
|
61
|
-
releaseDate: i.Date,
|
|
62
|
-
})
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return mangaInfo;
|
|
67
|
-
} catch (err) {
|
|
68
|
-
throw new Error((err as Error).message);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
override fetchChapterPages = async (chapterId: string, ...args: any): Promise<IMangaChapterPage[]> => {
|
|
73
|
-
const images: string[] = [];
|
|
74
|
-
const url = `${this.baseUrl}/read-online/${chapterId}-page-1.html`;
|
|
75
|
-
|
|
76
|
-
try {
|
|
77
|
-
const { data } = await this.ctx.axios.get(`${url}`);
|
|
78
|
-
const $ = load(data);
|
|
79
|
-
|
|
80
|
-
const chapterScript = $('body > script:nth-child(19)').get()[0]!.children[0];
|
|
81
|
-
if (isText(chapterScript!)) {
|
|
82
|
-
const curChapter = this.processScriptTagVariable(chapterScript.data, 'vm.CurChapter = ');
|
|
83
|
-
const imageHost = this.processScriptTagVariable(chapterScript.data, 'vm.CurPathName = ');
|
|
84
|
-
const curChapterLength = Number(curChapter.Page);
|
|
85
|
-
|
|
86
|
-
for (let i = 0; i < curChapterLength; i++) {
|
|
87
|
-
const chapter = this.processChapterForImageUrl(chapterId.replace(/[^0-9.]/g, ''));
|
|
88
|
-
const page = `${i + 1}`.padStart(3, '0');
|
|
89
|
-
const mangaId = chapterId.split('-chapter-', 1)[0];
|
|
90
|
-
const imagePath = `https://${imageHost}/manga/${mangaId}/${chapter}-${page}.png`;
|
|
91
|
-
|
|
92
|
-
images.push(imagePath);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const pages = images.map(
|
|
97
|
-
(image, i): IMangaChapterPage => ({
|
|
98
|
-
page: i + 1,
|
|
99
|
-
img: image,
|
|
100
|
-
headerForImage: { Referer: this.baseUrl },
|
|
101
|
-
})
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
return pages;
|
|
105
|
-
} catch (err) {
|
|
106
|
-
throw new Error((err as Error).message);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
override search = async (query: string, ...args: any[]): Promise<ISearch<IMangaResult>> => {
|
|
111
|
-
const matches = [];
|
|
112
|
-
const sanitizedQuery = query.replace(/\s/g, '').toLowerCase();
|
|
113
|
-
|
|
114
|
-
try {
|
|
115
|
-
const { data } = await this.ctx.axios.get(`https://mangasee123.com/_search.php`);
|
|
116
|
-
|
|
117
|
-
for (const i in data) {
|
|
118
|
-
const sanitizedAlts: string[] = [];
|
|
119
|
-
|
|
120
|
-
const item = data[i];
|
|
121
|
-
const altTitles: string[] = data[i].a;
|
|
122
|
-
|
|
123
|
-
for (const alt of altTitles) {
|
|
124
|
-
sanitizedAlts.push(alt.replace(/\s/g, '').toLowerCase());
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (
|
|
128
|
-
item.s.replace(/\s/g, '').toLowerCase().includes(sanitizedQuery) ||
|
|
129
|
-
sanitizedAlts.includes(sanitizedQuery)
|
|
130
|
-
) {
|
|
131
|
-
matches.push(item);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const results = matches.map(
|
|
136
|
-
(val): IMangaResult => ({
|
|
137
|
-
id: val.i,
|
|
138
|
-
title: val.s,
|
|
139
|
-
altTitles: val.a,
|
|
140
|
-
image: `https://temp.compsci88.com/cover/${val.i}.jpg`,
|
|
141
|
-
headerForImage: { Referer: this.baseUrl },
|
|
142
|
-
})
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
return { results: results };
|
|
146
|
-
} catch (err) {
|
|
147
|
-
throw new Error((err as Error).message);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
private processScriptTagVariable = (script: string, variable: string) => {
|
|
152
|
-
const chopFront = script.substring(script.search(variable) + variable.length, script.length);
|
|
153
|
-
const chapters = JSON.parse(chopFront.substring(0, chopFront.search(';')));
|
|
154
|
-
|
|
155
|
-
return chapters;
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
// e.g. 102055 => [1]--[0205]--[5]
|
|
159
|
-
// ? chap dec
|
|
160
|
-
private processChapterNumber = (chapter: string): string => {
|
|
161
|
-
const decimal = chapter.substring(chapter.length - 1, chapter.length);
|
|
162
|
-
chapter = chapter.replace(chapter[0]!, '').slice(0, -1);
|
|
163
|
-
if (decimal === '0') return `${+chapter}`;
|
|
164
|
-
|
|
165
|
-
if (chapter.startsWith('0')) chapter = chapter.replace(chapter[0]!, '');
|
|
166
|
-
|
|
167
|
-
return `${+chapter}.${decimal}`;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
private processChapterForImageUrl = (chapter: string): string => {
|
|
171
|
-
if (!chapter.includes('.')) return chapter.padStart(4, '0');
|
|
172
|
-
|
|
173
|
-
const values = chapter.split('.');
|
|
174
|
-
const pad = values[0]!.padStart(4, '0');
|
|
175
|
-
|
|
176
|
-
return `${pad}.${values[1]}`;
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// (async () => {
|
|
181
|
-
// const manga = new Mangasee123();
|
|
182
|
-
// const mediaInfo = await manga.search('oyasumi');
|
|
183
|
-
// const mangaInfo = await manga.fetchMangaInfo(mediaInfo.results[0].id);
|
|
184
|
-
// const chapterPages = await manga.fetchChapterPages(mangaInfo.chapters![0].id);
|
|
185
|
-
// console.log(chapterPages);
|
|
186
|
-
// console.log(mediaInfo, mangaInfo);
|
|
187
|
-
// })();
|
|
@@ -1,380 +0,0 @@
|
|
|
1
|
-
import { type CheerioAPI, load } from 'cheerio';
|
|
2
|
-
import {
|
|
3
|
-
type IMangaChapter,
|
|
4
|
-
type IMangaChapterPage,
|
|
5
|
-
type IMangaInfo,
|
|
6
|
-
type IMangaResult,
|
|
7
|
-
type ISearch,
|
|
8
|
-
MangaParser,
|
|
9
|
-
MediaStatus,
|
|
10
|
-
type ProviderContext,
|
|
11
|
-
} from '../../models';
|
|
12
|
-
import { createProviderContext } from '../../utils/create-provider-context';
|
|
13
|
-
import type { AxiosResponse } from 'axios';
|
|
14
|
-
|
|
15
|
-
interface ReadMangaSearchResultData {
|
|
16
|
-
overview: string;
|
|
17
|
-
original_title: string;
|
|
18
|
-
link: string;
|
|
19
|
-
image: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface ReadMangaSearchResult {
|
|
23
|
-
results: ReadMangaSearchResultData[];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
enum RankingType {
|
|
27
|
-
TOPRATED = 'top-rated',
|
|
28
|
-
NEW = 'new',
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface RatingResultTitles {
|
|
32
|
-
title: string;
|
|
33
|
-
link: string;
|
|
34
|
-
img: string;
|
|
35
|
-
description: string;
|
|
36
|
-
status: MediaStatus;
|
|
37
|
-
categories: string[];
|
|
38
|
-
type: string; // should be ENUM
|
|
39
|
-
views: number;
|
|
40
|
-
rate: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
interface RatingResult {
|
|
44
|
-
titles: RatingResultTitles[];
|
|
45
|
-
currentPage: string;
|
|
46
|
-
previousPage: string;
|
|
47
|
-
nextPage: string;
|
|
48
|
-
lastPage: string;
|
|
49
|
-
hasNextLink: boolean;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Not working, and not exported from `MANGA`: readmanga.app doesn't respond, which hasn't been
|
|
54
|
-
* confirmed as a permanent shutdown. Kept so it can be restored if the site comes back; delete it
|
|
55
|
-
* if it doesn't.
|
|
56
|
-
*/
|
|
57
|
-
export class ReadManga extends MangaParser {
|
|
58
|
-
override readonly name = 'ReadManga';
|
|
59
|
-
protected override baseUrl: string = 'https://readmanga.app';
|
|
60
|
-
protected override logo = 'https://readmanga.app/assets/new/images/readmangapp-light.png'; // light logo
|
|
61
|
-
protected override classPath = 'MANGA.ReadManga';
|
|
62
|
-
override readonly isWorking = false;
|
|
63
|
-
protected darkLogo = 'https://readmanga.app/assets/new/images/readmangaapp-dark.png';
|
|
64
|
-
|
|
65
|
-
/** @param ctx provider context; requests go through its axios (default: `createProviderContext()`) */
|
|
66
|
-
constructor(private readonly ctx: ProviderContext = createProviderContext()) {
|
|
67
|
-
super();
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
* @param query Search query
|
|
73
|
-
*/
|
|
74
|
-
|
|
75
|
-
override search = async (query: string): Promise<ISearch<IMangaResult>> => {
|
|
76
|
-
try {
|
|
77
|
-
const { data }: AxiosResponse = await this.ctx.axios.get(
|
|
78
|
-
`${this.baseUrl}/search/autocomplete?dataType=json&query=${query}`,
|
|
79
|
-
{
|
|
80
|
-
headers: {
|
|
81
|
-
Referer: this.baseUrl,
|
|
82
|
-
},
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
const result: ISearch<IMangaResult> = {
|
|
87
|
-
currentPage: 1,
|
|
88
|
-
hasNextPage: false,
|
|
89
|
-
totalPages: 1,
|
|
90
|
-
totalResults: (data as ReadMangaSearchResult).results.length,
|
|
91
|
-
results: this.formatSearchResultData((data as ReadMangaSearchResult).results),
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
return result;
|
|
95
|
-
} catch (err) {
|
|
96
|
-
throw new Error((err as Error).message);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
fetchNewManga = async (page: number = 1): Promise<ISearch<IMangaResult>> => {
|
|
101
|
-
if (page < 1) {
|
|
102
|
-
throw new Error('please provide a page number that is greater than- or equal to 1');
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
try {
|
|
106
|
-
const { data }: AxiosResponse = await this.ctx.axios.get(`${this.baseUrl}/ranking/${RankingType.NEW}/${page}`, {
|
|
107
|
-
headers: {
|
|
108
|
-
'accept': 'application/json, text/javascript, */*; q=0.01',
|
|
109
|
-
'accept-language': 'en-US,en;q=0.9',
|
|
110
|
-
'sec-ch-ua': '"Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"',
|
|
111
|
-
'sec-ch-ua-mobile': '?0',
|
|
112
|
-
'sec-ch-ua-platform': '"Windows"',
|
|
113
|
-
'sec-fetch-dest': 'empty',
|
|
114
|
-
'sec-fetch-mode': 'cors',
|
|
115
|
-
'sec-fetch-site': 'same-origin',
|
|
116
|
-
'x-requested-with': 'XMLHttpRequest',
|
|
117
|
-
'Referer': this.baseUrl,
|
|
118
|
-
'Referrer-Policy': 'strict-origin-when-cross-origin',
|
|
119
|
-
},
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
const result = this.getRankingTitleCardData(data, page);
|
|
123
|
-
|
|
124
|
-
return result;
|
|
125
|
-
} catch (err) {
|
|
126
|
-
throw new Error((err as Error).message);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
fetchTopRatedManga = async (page: number = 1): Promise<ISearch<IMangaResult>> => {
|
|
131
|
-
if (page < 1) {
|
|
132
|
-
throw new Error('please provide a page number that is greater than- or equal to 1');
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
try {
|
|
136
|
-
const { data }: AxiosResponse = await this.ctx.axios.get(
|
|
137
|
-
`${this.baseUrl}/ranking/${RankingType.TOPRATED}/${page}`,
|
|
138
|
-
{
|
|
139
|
-
headers: {
|
|
140
|
-
'accept': 'application/json, text/javascript, */*; q=0.01',
|
|
141
|
-
'accept-language': 'en-US,en;q=0.9',
|
|
142
|
-
'sec-ch-ua': '"Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"',
|
|
143
|
-
'sec-ch-ua-mobile': '?0',
|
|
144
|
-
'sec-ch-ua-platform': '"Windows"',
|
|
145
|
-
'sec-fetch-dest': 'empty',
|
|
146
|
-
'sec-fetch-mode': 'cors',
|
|
147
|
-
'sec-fetch-site': 'same-origin',
|
|
148
|
-
'x-requested-with': 'XMLHttpRequest',
|
|
149
|
-
'Referer': this.baseUrl,
|
|
150
|
-
'Referrer-Policy': 'strict-origin-when-cross-origin',
|
|
151
|
-
},
|
|
152
|
-
}
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
const result = this.getRankingTitleCardData(data, page);
|
|
156
|
-
|
|
157
|
-
return result;
|
|
158
|
-
} catch (err) {
|
|
159
|
-
throw new Error((err as Error).message);
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
override fetchMangaInfo = async (mangaId: string): Promise<IMangaInfo> => {
|
|
164
|
-
try {
|
|
165
|
-
const { data } = await this.ctx.axios.get(`${this.baseUrl}/${mangaId}`, {
|
|
166
|
-
headers: {
|
|
167
|
-
'accept': 'application/json, text/javascript, */*; q=0.01',
|
|
168
|
-
'accept-language': 'en-US,en;q=0.9',
|
|
169
|
-
'sec-ch-ua': '"Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"',
|
|
170
|
-
'sec-ch-ua-mobile': '?0',
|
|
171
|
-
'sec-ch-ua-platform': '"Windows"',
|
|
172
|
-
'sec-fetch-dest': 'empty',
|
|
173
|
-
'sec-fetch-mode': 'cors',
|
|
174
|
-
'sec-fetch-site': 'same-origin',
|
|
175
|
-
'x-requested-with': 'XMLHttpRequest',
|
|
176
|
-
'Referer': this.baseUrl,
|
|
177
|
-
'Referrer-Policy': 'strict-origin-when-cross-origin',
|
|
178
|
-
},
|
|
179
|
-
});
|
|
180
|
-
const $: CheerioAPI = load(data);
|
|
181
|
-
|
|
182
|
-
const dom = $('html');
|
|
183
|
-
const title = dom.find('.section-header.mb-2 > .section-header-title.me-auto > h2').text().trim();
|
|
184
|
-
const image = dom.find('.novels-detail > .novels-detail-left > img').attr('src');
|
|
185
|
-
|
|
186
|
-
const altTitles = dom
|
|
187
|
-
.find('.novels-detail > .novels-detail-right > ul > li:nth-child(1) > div:nth-child(2) > span')
|
|
188
|
-
.text()
|
|
189
|
-
.split(',');
|
|
190
|
-
const status = dom
|
|
191
|
-
.find('.novels-detail > .novels-detail-right > ul > li:nth-child(2) > div:nth-child(2)')
|
|
192
|
-
.text()
|
|
193
|
-
.trim();
|
|
194
|
-
const genres = dom
|
|
195
|
-
.find('.novels-detail > .novels-detail-right > ul > li:nth-child(3) > div:nth-child(2) > a')
|
|
196
|
-
.map((index, ele) => $(ele).text().trim())
|
|
197
|
-
.get();
|
|
198
|
-
const type = dom
|
|
199
|
-
.find('.novels-detail > .novels-detail-right > ul > li:nth-child(4) > div:nth-child(2) > span')
|
|
200
|
-
.text()
|
|
201
|
-
.trim();
|
|
202
|
-
const rating = dom
|
|
203
|
-
.find('.novels-detail > .novels-detail-right > ul > li:nth-child(5) > div:nth-child(2) > span')
|
|
204
|
-
.text()
|
|
205
|
-
.trim();
|
|
206
|
-
const authors = dom
|
|
207
|
-
.find('.novels-detail > .novels-detail-right > ul > li:nth-child(6) > div:nth-child(2) > a')
|
|
208
|
-
.map((index, ele) => $(ele).text().trim())
|
|
209
|
-
.get();
|
|
210
|
-
const artists = dom
|
|
211
|
-
.find('.novels-detail > .novels-detail-right > ul > li:nth-child(7) > div:nth-child(2)')
|
|
212
|
-
.text()
|
|
213
|
-
.trim();
|
|
214
|
-
const views = dom
|
|
215
|
-
.find('.novels-detail > .novels-detail-right > ul > li:nth-child(8) > div:nth-child(2)')
|
|
216
|
-
.text()
|
|
217
|
-
.trim();
|
|
218
|
-
const description = dom.find('.col-md-12.mb-3 > .empty-box > p').text();
|
|
219
|
-
const chapters = dom
|
|
220
|
-
.find('div > .cm-tabs-content > ul > li > a')
|
|
221
|
-
.map((index, ele) => {
|
|
222
|
-
// link to chapter is not always baseUrl -> id = entire link
|
|
223
|
-
const chapter: IMangaChapter = {
|
|
224
|
-
id: ele.attribs.href!,
|
|
225
|
-
title: $(ele).text().trim(),
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
return chapter;
|
|
229
|
-
})
|
|
230
|
-
.get();
|
|
231
|
-
|
|
232
|
-
const result: IMangaInfo = {
|
|
233
|
-
authors,
|
|
234
|
-
genres,
|
|
235
|
-
chapters,
|
|
236
|
-
id: mangaId,
|
|
237
|
-
title,
|
|
238
|
-
altTitles,
|
|
239
|
-
image,
|
|
240
|
-
description,
|
|
241
|
-
status: this.getStatus(status),
|
|
242
|
-
rating,
|
|
243
|
-
artists,
|
|
244
|
-
type,
|
|
245
|
-
views,
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
return result;
|
|
249
|
-
} catch (err) {
|
|
250
|
-
throw new Error((err as Error).message);
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
override fetchChapterPages = async (chapterId: string): Promise<IMangaChapterPage[]> => {
|
|
255
|
-
try {
|
|
256
|
-
const { data } = await this.ctx.axios.get(chapterId, {
|
|
257
|
-
headers: {
|
|
258
|
-
'accept': 'application/json, text/javascript, */*; q=0.01',
|
|
259
|
-
'accept-language': 'en-US,en;q=0.9',
|
|
260
|
-
'sec-ch-ua': '"Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"',
|
|
261
|
-
'sec-ch-ua-mobile': '?0',
|
|
262
|
-
'sec-ch-ua-platform': '"Windows"',
|
|
263
|
-
'sec-fetch-dest': 'empty',
|
|
264
|
-
'sec-fetch-mode': 'cors',
|
|
265
|
-
'sec-fetch-site': 'same-origin',
|
|
266
|
-
'x-requested-with': 'XMLHttpRequest',
|
|
267
|
-
'Referer': this.baseUrl,
|
|
268
|
-
'Referrer-Policy': 'strict-origin-when-cross-origin',
|
|
269
|
-
},
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
const $: CheerioAPI = load(data);
|
|
273
|
-
const dom = $('html');
|
|
274
|
-
|
|
275
|
-
const imageSources = dom
|
|
276
|
-
.find('.chapter-detail-novel-big-image.text-center > img')
|
|
277
|
-
.map((index, ele) => {
|
|
278
|
-
const chapterPage: IMangaChapterPage = {
|
|
279
|
-
img: ele.attribs.src!,
|
|
280
|
-
page: index + 1,
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
return chapterPage;
|
|
284
|
-
})
|
|
285
|
-
.get();
|
|
286
|
-
|
|
287
|
-
return imageSources;
|
|
288
|
-
} catch (err) {
|
|
289
|
-
throw new Error((err as Error).message);
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
private getRankingTitleCardData = (text: string, page: number): ISearch<IMangaResult> => {
|
|
294
|
-
const $: CheerioAPI = load(text);
|
|
295
|
-
const dom = $('html');
|
|
296
|
-
|
|
297
|
-
const titles = dom
|
|
298
|
-
.find('.category-items.ranking-category.cm-list > ul > li')
|
|
299
|
-
.map((index, ele) => {
|
|
300
|
-
return {
|
|
301
|
-
title: $(ele).find('.category-name > a').text().trim(),
|
|
302
|
-
id: ($(ele).find('div > a').attr('href') as string).replace('/', ''),
|
|
303
|
-
img: $(ele).find('div:nth-child(2) > div > a > img').attr('src'),
|
|
304
|
-
description: $(ele)
|
|
305
|
-
.find('div:nth-child(2) > div:nth-child(2) > div > a > span')
|
|
306
|
-
.text()
|
|
307
|
-
.split('\n')
|
|
308
|
-
.join(' ')
|
|
309
|
-
.trim(),
|
|
310
|
-
status: this.getStatus(
|
|
311
|
-
$(ele).find('div:nth-child(2) > div:nth-child(2) > ul > li:nth-child(1) > span').text().trim()
|
|
312
|
-
),
|
|
313
|
-
categories: $(ele)
|
|
314
|
-
.find('div:nth-child(2) > div:nth-child(2) > ul > li:nth-child(2) > a')
|
|
315
|
-
.map((index, str) => $(str).text())
|
|
316
|
-
.get(),
|
|
317
|
-
type: $(ele).find('div:nth-child(2) > div:nth-child(2) > ul > li:nth-child(3) > span').text(),
|
|
318
|
-
views: parseInt($(ele).find('div:nth-child(2) > div:nth-child(2) > ul > li:nth-child(4) > span').text()),
|
|
319
|
-
rate: parseInt($(ele).find('div:nth-child(2) > div:nth-child(2) > ul > li:nth-child(5) > span').text()),
|
|
320
|
-
};
|
|
321
|
-
})
|
|
322
|
-
.get();
|
|
323
|
-
|
|
324
|
-
const totalPages =
|
|
325
|
-
dom.find('nav.cm-pagination > a:last-child').attr('href') === '#'
|
|
326
|
-
? page
|
|
327
|
-
: this.getTotalPages(dom.find('nav.cm-pagination > a:last-child').attr('href') as string, '/');
|
|
328
|
-
|
|
329
|
-
const result: ISearch<IMangaResult> = {
|
|
330
|
-
results: titles,
|
|
331
|
-
currentPage: page,
|
|
332
|
-
totalPages: totalPages,
|
|
333
|
-
hasNextPage: !(dom.find('nav.cm-pagination > a:last-child').attr('href') === '#'),
|
|
334
|
-
};
|
|
335
|
-
return result;
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
private getTotalPages = (str: string, splitOn: string): number => {
|
|
339
|
-
const split = str.split(splitOn);
|
|
340
|
-
|
|
341
|
-
return parseInt(split[split.length - 1]!);
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
private formatSearchResultData = (results: ReadMangaSearchResultData[]): IMangaResult[] => {
|
|
345
|
-
const formattedResults: IMangaResult[] = results.map((result) => {
|
|
346
|
-
const split = result.link.split('/');
|
|
347
|
-
const id = split[split.length - 1];
|
|
348
|
-
return {
|
|
349
|
-
id: id!,
|
|
350
|
-
title: result.original_title,
|
|
351
|
-
altTitles: result.overview,
|
|
352
|
-
image: result.image,
|
|
353
|
-
};
|
|
354
|
-
});
|
|
355
|
-
|
|
356
|
-
return formattedResults;
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
private getStatus = (statusStr: string): MediaStatus => {
|
|
360
|
-
switch (statusStr) {
|
|
361
|
-
case MediaStatus.CANCELLED:
|
|
362
|
-
return MediaStatus.CANCELLED;
|
|
363
|
-
|
|
364
|
-
case MediaStatus.COMPLETED:
|
|
365
|
-
return MediaStatus.COMPLETED;
|
|
366
|
-
|
|
367
|
-
case MediaStatus.HIATUS:
|
|
368
|
-
return MediaStatus.HIATUS;
|
|
369
|
-
|
|
370
|
-
case MediaStatus.NOT_YET_AIRED:
|
|
371
|
-
return MediaStatus.NOT_YET_AIRED;
|
|
372
|
-
|
|
373
|
-
case MediaStatus.ONGOING:
|
|
374
|
-
return MediaStatus.ONGOING;
|
|
375
|
-
|
|
376
|
-
default:
|
|
377
|
-
return MediaStatus.UNKNOWN;
|
|
378
|
-
}
|
|
379
|
-
};
|
|
380
|
-
}
|