react-native-consumet 2.0.0 → 3.0.0
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/lib/commonjs/extension-registry.json.sig +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/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/extension-registry.json.sig +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/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/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/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/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/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/extension-registry.json.sig +1 -1
- package/src/index.tsx +6 -0
- package/src/models/types.ts +38 -3
- 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,7 +1,8 @@
|
|
|
1
|
-
import { load } from 'cheerio';
|
|
1
|
+
import { load, type CheerioAPI } from 'cheerio';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
MangaParser,
|
|
5
|
+
MediaStatus,
|
|
5
6
|
type ISearch,
|
|
6
7
|
type IMangaInfo,
|
|
7
8
|
type IMangaResult,
|
|
@@ -10,6 +11,34 @@ import {
|
|
|
10
11
|
type ProviderContext,
|
|
11
12
|
} from '../../models';
|
|
12
13
|
import { createProviderContext } from '../../utils/create-provider-context';
|
|
14
|
+
import { parseChapterNumber, sortChaptersForReading } from '../../utils/manga';
|
|
15
|
+
|
|
16
|
+
// The status labels MangaPill uses (its search filter lists the same five).
|
|
17
|
+
const STATUSES: Record<string, MediaStatus> = {
|
|
18
|
+
'publishing': MediaStatus.ONGOING,
|
|
19
|
+
'finished': MediaStatus.COMPLETED,
|
|
20
|
+
'on hiatus': MediaStatus.HIATUS,
|
|
21
|
+
'discontinued': MediaStatus.CANCELLED,
|
|
22
|
+
'not yet published': MediaStatus.NOT_YET_AIRED,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const toStatus = (text: string): MediaStatus | undefined =>
|
|
26
|
+
text ? (STATUSES[text.toLowerCase()] ?? MediaStatus.UNKNOWN) : undefined;
|
|
27
|
+
|
|
28
|
+
const toYear = (text: string): number | undefined => (/^\d{4}$/.test(text) ? Number(text) : undefined);
|
|
29
|
+
|
|
30
|
+
/** Plain text: whitespace within a line collapses to one space, paragraph breaks stay. */
|
|
31
|
+
const cleanText = (text: string): string =>
|
|
32
|
+
text
|
|
33
|
+
.split('\n')
|
|
34
|
+
.map((line) => line.replace(/\s+/g, ' ').trim())
|
|
35
|
+
.join('\n')
|
|
36
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
37
|
+
.trim();
|
|
38
|
+
|
|
39
|
+
/** Copies only the fields that have a value, so missing ones are left out rather than `undefined`. */
|
|
40
|
+
const defined = <T extends object>(fields: T): T =>
|
|
41
|
+
Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== undefined)) as T;
|
|
13
42
|
|
|
14
43
|
export class MangaPill extends MangaParser {
|
|
15
44
|
override readonly name = 'MangaPill';
|
|
@@ -24,97 +53,167 @@ export class MangaPill extends MangaParser {
|
|
|
24
53
|
}
|
|
25
54
|
|
|
26
55
|
/**
|
|
27
|
-
*
|
|
28
56
|
* @param query Search query
|
|
57
|
+
* @param page Page number (default: `1`); the site lists 50 titles a page
|
|
29
58
|
*/
|
|
30
|
-
override search = async (query: string): Promise<ISearch<IMangaResult>> => {
|
|
59
|
+
override search = async (query: string, page: number = 1): Promise<ISearch<IMangaResult>> => {
|
|
31
60
|
try {
|
|
32
|
-
const
|
|
61
|
+
const pageQuery = page > 1 ? `&page=${page}` : '';
|
|
62
|
+
const { data } = await this.ctx.axios.get(`${this.baseUrl}/search?q=${encodeURIComponent(query)}${pageQuery}`);
|
|
33
63
|
const $ = load(data);
|
|
34
64
|
|
|
35
65
|
const results = $('div.container div.my-3.justify-end > div')
|
|
36
|
-
.map(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
66
|
+
.map((_, el): IMangaResult | undefined => {
|
|
67
|
+
const card = $(el);
|
|
68
|
+
const link = card.find('div.flex-col > a[href^="/manga/"]').first();
|
|
69
|
+
const id = this.mangaId(link.attr('href') ?? card.find('a[href^="/manga/"]').attr('href'));
|
|
70
|
+
const title = link.children('div').first().text().trim();
|
|
71
|
+
if (!id || !title) return undefined;
|
|
72
|
+
|
|
73
|
+
const altTitle = link.children('div').eq(1).text().trim();
|
|
74
|
+
// Type, year and status badges ("manga", "1997", "publishing").
|
|
75
|
+
const badges = card
|
|
76
|
+
.find('div.flex-col > div.flex-wrap')
|
|
77
|
+
.first()
|
|
78
|
+
.children('div')
|
|
79
|
+
.map((__, badge) => $(badge).text().trim())
|
|
80
|
+
.get();
|
|
81
|
+
const status = badges.find((badge) => STATUSES[badge.toLowerCase()]);
|
|
82
|
+
const image = this.absoluteUrl(card.find('a img').attr('data-src') ?? card.find('a img').attr('src'));
|
|
83
|
+
|
|
84
|
+
return defined({
|
|
85
|
+
id,
|
|
86
|
+
title,
|
|
87
|
+
altTitles: altTitle && altTitle !== title ? [altTitle] : undefined,
|
|
88
|
+
image,
|
|
89
|
+
headerForImage: image ? this.imageHeaders() : undefined,
|
|
90
|
+
url: `${this.baseUrl}/manga/${id}`,
|
|
91
|
+
status: status ? toStatus(status) : undefined,
|
|
92
|
+
releaseDate: badges.map(toYear).find((year) => year !== undefined),
|
|
93
|
+
});
|
|
94
|
+
})
|
|
95
|
+
.get()
|
|
96
|
+
.filter((result): result is IMangaResult => result !== undefined);
|
|
97
|
+
|
|
98
|
+
const hasNextPage =
|
|
99
|
+
$('a[href^="/search"]').filter((_, a) => $(a).text().trim().toLowerCase() === 'next').length > 0;
|
|
100
|
+
|
|
101
|
+
return { currentPage: page, hasNextPage, results };
|
|
48
102
|
} catch (err) {
|
|
49
|
-
// console.log(err);
|
|
50
103
|
throw new Error((err as Error).message);
|
|
51
104
|
}
|
|
52
105
|
};
|
|
53
106
|
|
|
107
|
+
/**
|
|
108
|
+
* @param mangaId Manga id from the search results (e.g. `2/one-piece`)
|
|
109
|
+
*/
|
|
54
110
|
override fetchMangaInfo = async (mangaId: string): Promise<IMangaInfo> => {
|
|
55
|
-
const mangaInfo: IMangaInfo = {
|
|
56
|
-
id: mangaId,
|
|
57
|
-
title: '',
|
|
58
|
-
};
|
|
59
111
|
try {
|
|
60
112
|
const { data } = await this.ctx.axios.get(`${this.baseUrl}/manga/${mangaId}`);
|
|
61
113
|
const $ = load(data);
|
|
114
|
+
// The cover and the details beside it: title, alt title, synopsis, type/status/year, genres.
|
|
115
|
+
const header = $('div.container div.my-3')
|
|
116
|
+
.filter((_, el) => $(el).find('h1').length > 0)
|
|
117
|
+
.first();
|
|
118
|
+
// The value under a label of the details grid ("Type", "Status", "Year").
|
|
119
|
+
const detail = (label: string) =>
|
|
120
|
+
header
|
|
121
|
+
.find('label')
|
|
122
|
+
.filter((_, el) => $(el).text().trim() === label)
|
|
123
|
+
.first()
|
|
124
|
+
.next('div')
|
|
125
|
+
.text()
|
|
126
|
+
.trim();
|
|
127
|
+
|
|
128
|
+
const heading = header.find('h1').first();
|
|
129
|
+
const title = heading.text().trim();
|
|
130
|
+
const altTitle = heading.nextAll('div').first().text().trim();
|
|
131
|
+
const cover = header.find('img').first();
|
|
132
|
+
const image = this.absoluteUrl(cover.attr('data-src') ?? cover.attr('src'));
|
|
133
|
+
const description = cleanText(header.find('p.text--secondary').first().text());
|
|
134
|
+
const genres = header
|
|
135
|
+
.find('a[href*="genre="]')
|
|
136
|
+
.map((_, a) => $(a).text().trim())
|
|
137
|
+
.get()
|
|
138
|
+
.filter(Boolean);
|
|
62
139
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
.map(
|
|
77
|
-
(i, el): IMangaChapter => ({
|
|
78
|
-
id: $(el).attr('href')?.split('/chapters/')[1]!,
|
|
79
|
-
title: $(el).text().trim(),
|
|
80
|
-
chapter: $(el).text().split('Chapter ')[1],
|
|
81
|
-
})
|
|
82
|
-
)
|
|
83
|
-
.get();
|
|
84
|
-
|
|
85
|
-
return mangaInfo;
|
|
140
|
+
return defined({
|
|
141
|
+
id: mangaId,
|
|
142
|
+
title,
|
|
143
|
+
altTitles: altTitle && altTitle !== title ? [altTitle] : undefined,
|
|
144
|
+
image,
|
|
145
|
+
headerForImage: image ? this.imageHeaders() : undefined,
|
|
146
|
+
description: description || undefined,
|
|
147
|
+
status: toStatus(detail('Status')),
|
|
148
|
+
releaseDate: toYear(detail('Year')),
|
|
149
|
+
url: `${this.baseUrl}/manga/${mangaId}`,
|
|
150
|
+
genres: genres.length ? genres : undefined,
|
|
151
|
+
chapters: this.parseChapters($),
|
|
152
|
+
});
|
|
86
153
|
} catch (err) {
|
|
87
154
|
throw new Error((err as Error).message);
|
|
88
155
|
}
|
|
89
156
|
};
|
|
90
157
|
|
|
158
|
+
/**
|
|
159
|
+
* @param chapterId Chapter id from the manga info (e.g. `2-11069000/one-piece-chapter-1069`)
|
|
160
|
+
*/
|
|
91
161
|
override fetchChapterPages = async (chapterId: string): Promise<IMangaChapterPage[]> => {
|
|
92
162
|
try {
|
|
93
163
|
const { data } = await this.ctx.axios.get(`${this.baseUrl}/chapters/${chapterId}`);
|
|
94
164
|
const $ = load(data);
|
|
95
165
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
)
|
|
105
|
-
.get();
|
|
106
|
-
|
|
107
|
-
return pages;
|
|
166
|
+
return $('chapter-page')
|
|
167
|
+
.map((_, el) => {
|
|
168
|
+
const img = $(el).find('img').first();
|
|
169
|
+
return this.absoluteUrl(img.attr('data-src') ?? img.attr('src'));
|
|
170
|
+
})
|
|
171
|
+
.get()
|
|
172
|
+
.filter((img): img is string => Boolean(img))
|
|
173
|
+
.map((img, i): IMangaChapterPage => ({ img, page: i + 1, headerForImage: this.imageHeaders() }));
|
|
108
174
|
} catch (err) {
|
|
109
175
|
throw new Error((err as Error).message);
|
|
110
176
|
}
|
|
111
177
|
};
|
|
112
|
-
}
|
|
113
178
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
179
|
+
/** The site lists chapters newest first; they are returned first chapter first. */
|
|
180
|
+
private parseChapters($: CheerioAPI): IMangaChapter[] {
|
|
181
|
+
const chapters = $('div#chapters a[href^="/chapters/"]')
|
|
182
|
+
.map((_, el): IMangaChapter | undefined => {
|
|
183
|
+
const id = $(el).attr('href')!.split('/chapters/')[1];
|
|
184
|
+
if (!id) return undefined;
|
|
185
|
+
const label = $(el).text().replace(/\s+/g, ' ').trim();
|
|
186
|
+
// The label is "Chapter 1053.4"; the slug ("one-piece-chapter-1053.4") names it too.
|
|
187
|
+
const chapterNumber = parseChapterNumber(label) ?? parseChapterNumber(id.split('/')[1]);
|
|
188
|
+
return defined({
|
|
189
|
+
id,
|
|
190
|
+
title: label || (chapterNumber !== undefined ? `Chapter ${chapterNumber}` : id),
|
|
191
|
+
chapterNumber,
|
|
192
|
+
url: `${this.baseUrl}/chapters/${id}`,
|
|
193
|
+
});
|
|
194
|
+
})
|
|
195
|
+
.get()
|
|
196
|
+
.filter((chapter): chapter is IMangaChapter => chapter !== undefined);
|
|
197
|
+
|
|
198
|
+
return sortChaptersForReading(chapters.reverse());
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** The image CDN answers 403 to requests without a MangaPill Referer, covers and pages alike. */
|
|
202
|
+
private imageHeaders(): Record<string, string> {
|
|
203
|
+
return { Referer: `${this.baseUrl}/` };
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** `/manga/2/one-piece` → `2/one-piece`. */
|
|
207
|
+
private mangaId(href: string | undefined): string | undefined {
|
|
208
|
+
return href?.split('/manga/')[1] || undefined;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** Image URLs are absolute today; resolve site-relative ones anyway (Hermes' global URL is incomplete). */
|
|
212
|
+
private absoluteUrl(url: string | undefined): string | undefined {
|
|
213
|
+
const value = url?.trim();
|
|
214
|
+
if (!value) return undefined;
|
|
215
|
+
if (/^https?:\/\//i.test(value)) return value;
|
|
216
|
+
if (value.startsWith('//')) return `https:${value}`;
|
|
217
|
+
return `${this.baseUrl}/${value.replace(/^\/+/, '')}`;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
@@ -42,7 +42,8 @@ import { Zoro } from '../anime/zoro/zoro';
|
|
|
42
42
|
import { AnimeKai } from '../anime/animekai/animekai';
|
|
43
43
|
import { AnimePahe } from '../anime/animepahe/animepahe';
|
|
44
44
|
import { AniKoto } from '../anime/anikoto/anikoto';
|
|
45
|
-
import {
|
|
45
|
+
import { MangaDex } from '../manga/mangadex';
|
|
46
|
+
import { sortChaptersForReading } from '../../utils/manga';
|
|
46
47
|
import { ANIFY_URL, findSimilarTitles } from '../../utils/utils';
|
|
47
48
|
|
|
48
49
|
/** A failed AniList request as a MetaError, keeping its status, with a readable message for 404 and 429. */
|
|
@@ -286,6 +287,35 @@ const timeOf = (date: unknown): number | undefined => {
|
|
|
286
287
|
const episodeUniqueId = (anilistId: string, { episode, aniDbKey }: MergedEpisode, index: number) =>
|
|
287
288
|
`${anilistId}$ep=${aniDbKey ?? toEpisodeNumber(episode.number) ?? index + 1}`;
|
|
288
289
|
|
|
290
|
+
/** An AniList format as providers name the type: `MOVIE` → `movie`, `TV_SHORT` → `tv`. */
|
|
291
|
+
const providerType = (format?: string) => (format === 'TV_SHORT' ? 'tv' : format?.toLowerCase());
|
|
292
|
+
|
|
293
|
+
/** The numbers in a title, ignoring anything in parentheses: "Jujutsu Kaisen 0" → {0}, "2nd Season" → {2}. */
|
|
294
|
+
const titleNumbers = (title?: string) => new Set((title ?? '').replace(/\([^)]*\)/g, '').match(/\d+/g) ?? []);
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* How well a provider search result matches the AniList entry. Title similarity alone ranks "Jujutsu Kaisen (TV)"
|
|
298
|
+
* above "Jujutsu Kaisen 0 Movie" for "JUJUTSU KAISEN 0", since the part in parentheses is ignored. So a result also
|
|
299
|
+
* gains when its type is the AniList format, loses when only one of the two is a movie, and loses when its numbers
|
|
300
|
+
* don't match the title's.
|
|
301
|
+
*/
|
|
302
|
+
const matchScore = (result: { title?: string; type?: string; similarity?: number }, title: ITitle, format?: string) => {
|
|
303
|
+
let score = result.similarity ?? 0;
|
|
304
|
+
|
|
305
|
+
const wanted = providerType(format);
|
|
306
|
+
const type = result.type?.toLowerCase();
|
|
307
|
+
if (wanted && type) {
|
|
308
|
+
if (type === wanted) score += 0.1;
|
|
309
|
+
else if (type === 'movie' || wanted === 'movie') score -= 0.15;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const expected = titleNumbers(title.english || title.romaji);
|
|
313
|
+
const found = titleNumbers(result.title);
|
|
314
|
+
if ([...expected].some((n) => !found.has(n)) || (!expected.size && found.size)) score -= 0.2;
|
|
315
|
+
|
|
316
|
+
return score;
|
|
317
|
+
};
|
|
318
|
+
|
|
289
319
|
type FillerEpisode = { 'number': string; 'filler-bool': boolean };
|
|
290
320
|
|
|
291
321
|
/**
|
|
@@ -442,6 +472,7 @@ class Anilist extends AnimeParser {
|
|
|
442
472
|
const title = mapTitle(data.data.Media.title);
|
|
443
473
|
animeInfo.episodes = await this.fetchDefaultEpisodeList({
|
|
444
474
|
idMal: animeInfo.malId! as number,
|
|
475
|
+
format: data.data.Media.format,
|
|
445
476
|
season: data.data.Media.season,
|
|
446
477
|
startDate: { year: parseInt(animeInfo.releaseDate!) },
|
|
447
478
|
title: {
|
|
@@ -602,7 +633,7 @@ class Anilist extends AnimeParser {
|
|
|
602
633
|
}
|
|
603
634
|
};
|
|
604
635
|
|
|
605
|
-
private findAnimeRaw = async (title: ITitle) => {
|
|
636
|
+
private findAnimeRaw = async (title: ITitle, format?: string) => {
|
|
606
637
|
const searchTerm = title?.romaji || title?.english || title?.userPreferred || '';
|
|
607
638
|
const findAnime = (await this.provider.search(searchTerm)) as ISearch<IAnimeResult>;
|
|
608
639
|
|
|
@@ -621,8 +652,8 @@ class Anilist extends AnimeParser {
|
|
|
621
652
|
(str) => JSON.parse(str)
|
|
622
653
|
);
|
|
623
654
|
|
|
624
|
-
//
|
|
625
|
-
uniqueResults.sort((a, b) => (b
|
|
655
|
+
// Best match first: title similarity, corrected by the format and the numbers in the title
|
|
656
|
+
uniqueResults.sort((a, b) => matchScore(b, title, format) - matchScore(a, title, format));
|
|
626
657
|
const mappings: any = {};
|
|
627
658
|
for (const obj of uniqueResults) {
|
|
628
659
|
const match = obj.title.replace(/\(TV\)/g, '').match(/\(([^)0-9]+)\)/);
|
|
@@ -715,13 +746,14 @@ class Anilist extends AnimeParser {
|
|
|
715
746
|
|
|
716
747
|
private fetchDefaultEpisodeList = async (Media: {
|
|
717
748
|
idMal: number;
|
|
749
|
+
format?: string;
|
|
718
750
|
title: { english: string; romaji: string };
|
|
719
751
|
season: string;
|
|
720
752
|
startDate: { year: number };
|
|
721
753
|
externalLinks?: any;
|
|
722
754
|
}) => {
|
|
723
755
|
try {
|
|
724
|
-
return await this.findAnimeRaw({ english: Media.title?.english!, romaji: Media.title?.romaji! });
|
|
756
|
+
return await this.findAnimeRaw({ english: Media.title?.english!, romaji: Media.title?.romaji! }, Media.format);
|
|
725
757
|
} catch (err) {
|
|
726
758
|
throw MetaError.from('provider', err);
|
|
727
759
|
}
|
|
@@ -748,7 +780,7 @@ class Anilist extends AnimeParser {
|
|
|
748
780
|
data: { Media },
|
|
749
781
|
},
|
|
750
782
|
} = await anilistQuery(
|
|
751
|
-
`query($id: Int){ Media(id: $id){ idMal externalLinks { site url } title { romaji english } status season episodes startDate { year month day } endDate { year month day } coverImage {extraLarge large medium} } }`,
|
|
783
|
+
`query($id: Int){ Media(id: $id){ idMal format externalLinks { site url } title { romaji english } status season episodes startDate { year month day } endDate { year month day } coverImage {extraLarge large medium} } }`,
|
|
752
784
|
{ id: Number(id) }
|
|
753
785
|
).catch((err) => {
|
|
754
786
|
throw anilistError(err);
|
|
@@ -1096,11 +1128,11 @@ class Anilist extends AnimeParser {
|
|
|
1096
1128
|
provider: MangaParser;
|
|
1097
1129
|
|
|
1098
1130
|
/**
|
|
1099
|
-
* Maps anilist manga to any manga provider (
|
|
1100
|
-
* @param provider MangaParser
|
|
1131
|
+
* Maps anilist manga to any manga provider (MangaDex, MangaPill, etc)
|
|
1132
|
+
* @param provider MangaParser (default: MangaDex)
|
|
1101
1133
|
*/
|
|
1102
1134
|
constructor(provider?: MangaParser) {
|
|
1103
|
-
this.provider = provider || new
|
|
1135
|
+
this.provider = provider || new MangaDex();
|
|
1104
1136
|
}
|
|
1105
1137
|
|
|
1106
1138
|
/**
|
|
@@ -1151,7 +1183,7 @@ class Anilist extends AnimeParser {
|
|
|
1151
1183
|
.catch((err) => {
|
|
1152
1184
|
throw MetaError.from('provider', err);
|
|
1153
1185
|
});
|
|
1154
|
-
mangaInfo.chapters =
|
|
1186
|
+
mangaInfo.chapters = sortChaptersForReading(chapters);
|
|
1155
1187
|
|
|
1156
1188
|
return mangaInfo;
|
|
1157
1189
|
} catch (error) {
|
|
@@ -1208,11 +1240,15 @@ class Anilist extends AnimeParser {
|
|
|
1208
1240
|
const { results = [] } = ((await provider.search(slug)) ?? {}) as Partial<ISearch<IMangaResult>>;
|
|
1209
1241
|
|
|
1210
1242
|
if (results.length === 0) return undefined;
|
|
1211
|
-
// TODO: use much better way than this
|
|
1212
1243
|
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1244
|
+
// Providers may show an English title and keep the romaji one in altTitles, so match either.
|
|
1245
|
+
const wanted = title.toLowerCase();
|
|
1246
|
+
const names = (manga: IMangaResult) => [
|
|
1247
|
+
...(typeof manga.title === 'string' ? [manga.title] : []),
|
|
1248
|
+
...(manga.altTitles ?? []),
|
|
1249
|
+
];
|
|
1250
|
+
const possibleManga = results.find((manga: IMangaResult) =>
|
|
1251
|
+
names(manga).some((name) => name.toLowerCase() === wanted)
|
|
1216
1252
|
);
|
|
1217
1253
|
|
|
1218
1254
|
return (await provider.fetchMangaInfo((possibleManga ?? results[0]!).id)) as IMangaInfo;
|
package/src/utils/index.ts
CHANGED
|
@@ -82,6 +82,7 @@ export type { RegistrySignatureErrorCode, RegistrySignatureOptions } from './reg
|
|
|
82
82
|
export { createExtractorContext } from './create-extractor-context';
|
|
83
83
|
export { defaultAxios, defaultExtractorContext, defaultExtractors } from './extension-utils';
|
|
84
84
|
export { PolyURL, PolyURLSearchParams } from './url-polyfill';
|
|
85
|
+
export { parseChapterNumber, parseVolumeNumber, sortChaptersForReading } from './manga';
|
|
85
86
|
export type {
|
|
86
87
|
AnimeProvider,
|
|
87
88
|
MovieProvider,
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { IMangaChapter } from '../models/types';
|
|
2
|
+
|
|
3
|
+
// "Chapter 12", "Ch. 10.5", "chap 3", "Episode 7", "#41"; the number that names the chapter.
|
|
4
|
+
// Word boundaries keep "Witch 3" or "Rev 2" from reading as a chapter or volume number.
|
|
5
|
+
const CHAPTER_NUMBER = /(?:\b(?:chapter|chap|ch|episode|ep)\.?|#)\s*(\d+(?:[.,]\d+)?)/i;
|
|
6
|
+
const VOLUME_NUMBER = /\b(?:volume|vol|v)\.?\s*(\d+(?:[.,]\d+)?)/i;
|
|
7
|
+
// Text that is only a number ("12", "10.5"), as some sites list chapters.
|
|
8
|
+
const BARE_NUMBER = /^\s*(\d+(?:[.,]\d+)?)\s*$/;
|
|
9
|
+
|
|
10
|
+
const toNumber = (digits: string | undefined): number | undefined => {
|
|
11
|
+
if (digits === undefined) return undefined;
|
|
12
|
+
const value = Number(digits.replace(',', '.'));
|
|
13
|
+
return Number.isFinite(value) ? value : undefined;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The chapter number in a site's chapter label or URL slug: `Chapter 10.5: Title` → 10.5,
|
|
18
|
+
* `Vol.2 Ch.15` → 15, `12` → 12, `chapter-7` → 7. Undefined when the text names no chapter
|
|
19
|
+
* number (a volume number alone doesn't count).
|
|
20
|
+
*/
|
|
21
|
+
export function parseChapterNumber(text: string | undefined | null): number | undefined {
|
|
22
|
+
if (!text) return undefined;
|
|
23
|
+
const normalized = String(text).replace(/[-_]+/g, ' ');
|
|
24
|
+
return toNumber(CHAPTER_NUMBER.exec(normalized)?.[1] ?? BARE_NUMBER.exec(normalized)?.[1]);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** The volume number in a chapter label: `Vol.2 Ch.15` → 2, `Volume 3` → 3. */
|
|
28
|
+
export function parseVolumeNumber(text: string | undefined | null): number | undefined {
|
|
29
|
+
if (!text) return undefined;
|
|
30
|
+
return toNumber(VOLUME_NUMBER.exec(String(text).replace(/[-_]+/g, ' '))?.[1]);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Chapters in reading order: first chapter first. When every chapter has a `chapterNumber`, they
|
|
35
|
+
* are sorted by volume (only if every chapter has one, since some sites restart chapter numbers
|
|
36
|
+
* each volume), then chapter number, then release date; equal chapters (several scanlations or
|
|
37
|
+
* languages) keep the provider's order. When some chapter has no number there is nothing reliable
|
|
38
|
+
* to sort by, so the provider's order is returned: the provider must then list chapters first to
|
|
39
|
+
* last itself.
|
|
40
|
+
*/
|
|
41
|
+
export function sortChaptersForReading<T extends IMangaChapter>(chapters: readonly T[]): T[] {
|
|
42
|
+
if (!chapters.every((chapter) => typeof chapter.chapterNumber === 'number')) return [...chapters];
|
|
43
|
+
const byVolume = chapters.every((chapter) => typeof chapter.volumeNumber === 'number');
|
|
44
|
+
const time = (chapter: T) => {
|
|
45
|
+
const value = chapter.releaseDate ? Date.parse(chapter.releaseDate) : NaN;
|
|
46
|
+
return Number.isNaN(value) ? Number.MAX_SAFE_INTEGER : value;
|
|
47
|
+
};
|
|
48
|
+
return chapters
|
|
49
|
+
.map((chapter, index) => ({ chapter, index }))
|
|
50
|
+
.sort(
|
|
51
|
+
(a, b) =>
|
|
52
|
+
(byVolume ? a.chapter.volumeNumber! - b.chapter.volumeNumber! : 0) ||
|
|
53
|
+
a.chapter.chapterNumber! - b.chapter.chapterNumber! ||
|
|
54
|
+
time(a.chapter) - time(b.chapter) ||
|
|
55
|
+
a.index - b.index
|
|
56
|
+
)
|
|
57
|
+
.map(({ chapter }) => chapter);
|
|
58
|
+
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.BRMangas = void 0;
|
|
7
|
-
var _cheerio = require("cheerio");
|
|
8
|
-
var _index = require("../../models/index.js");
|
|
9
|
-
var _createProviderContext = require("../../utils/create-provider-context.js");
|
|
10
|
-
class BRMangas extends _index.MangaParser {
|
|
11
|
-
name = 'BRMangas';
|
|
12
|
-
baseUrl = 'https://www.brmangas.net';
|
|
13
|
-
logo = 'https://www.brmangas.net/wp-content/themes/brmangasnew/images/svg/logo.svg';
|
|
14
|
-
classPath = 'MANGA.BRMangas';
|
|
15
|
-
|
|
16
|
-
/** @param ctx provider context; requests go through its axios (default: `createProviderContext()`) */
|
|
17
|
-
constructor(ctx = (0, _createProviderContext.createProviderContext)()) {
|
|
18
|
-
super();
|
|
19
|
-
this.ctx = ctx;
|
|
20
|
-
}
|
|
21
|
-
fetchMangaInfo = async mangaId => {
|
|
22
|
-
const mangaInfo = {
|
|
23
|
-
id: mangaId,
|
|
24
|
-
title: ''
|
|
25
|
-
};
|
|
26
|
-
try {
|
|
27
|
-
const {
|
|
28
|
-
data
|
|
29
|
-
} = await this.ctx.axios.get(`${this.baseUrl}/manga/${mangaId}`);
|
|
30
|
-
const $ = (0, _cheerio.load)(data);
|
|
31
|
-
const title = $('body > div.scroller-inner > div.wrapper > main > section > div > h1.titulo').text();
|
|
32
|
-
const descriptionAndAltTitles = $('body > div.scroller-inner > div.wrapper > main > div > div > div.col > div.serie-texto > div > p:nth-child(3)').text().split('\n');
|
|
33
|
-
mangaInfo.title = title.slice(3, title.length - 7).trim();
|
|
34
|
-
mangaInfo.altTitles = descriptionAndAltTitles.filter((_, i) => i > 0);
|
|
35
|
-
mangaInfo.description = descriptionAndAltTitles[0];
|
|
36
|
-
mangaInfo.headerForImage = {
|
|
37
|
-
Referer: this.baseUrl
|
|
38
|
-
};
|
|
39
|
-
mangaInfo.image = $('body > div.scroller-inner > div.wrapper > main > div > div > div.serie-geral > div.infoall > div.serie-capa > img').attr('src');
|
|
40
|
-
mangaInfo.genres = $('body > div.scroller-inner > div.wrapper > main > div > div > div.serie-geral > div.infoall > div.serie-infos > ul > li:nth-child(3)').text().slice(11).split(',').map(genre => genre.trim());
|
|
41
|
-
mangaInfo.status = _index.MediaStatus.UNKNOWN;
|
|
42
|
-
mangaInfo.views = null;
|
|
43
|
-
mangaInfo.authors = [$('body > div.scroller-inner > div.wrapper > main > div > div > div.serie-geral > div.infoall > div.serie-infos > ul > li:nth-child(2)').text().replace('Autor: ', '').trim()];
|
|
44
|
-
mangaInfo.chapters = $('body > div.scroller-inner > div.wrapper > main > div > div > div:nth-child(2) > div.manga > div.container_t > div.lista_manga > ul > li').map((i, el) => {
|
|
45
|
-
return {
|
|
46
|
-
id: `${$(el).find('a').attr('href')?.split('/')[4]}`,
|
|
47
|
-
title: $(el).find('a').text(),
|
|
48
|
-
views: null,
|
|
49
|
-
releasedDate: null
|
|
50
|
-
};
|
|
51
|
-
}).get();
|
|
52
|
-
return mangaInfo;
|
|
53
|
-
} catch (err) {
|
|
54
|
-
throw new Error(err.message);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
fetchChapterPages = async chapterId => {
|
|
58
|
-
try {
|
|
59
|
-
const url = `${this.baseUrl}/ler/${chapterId}`;
|
|
60
|
-
const {
|
|
61
|
-
data
|
|
62
|
-
} = await this.ctx.axios.get(url);
|
|
63
|
-
const $ = (0, _cheerio.load)(data);
|
|
64
|
-
const script = $('script');
|
|
65
|
-
const pageURLs = JSON.parse(script.filter((i, el) => $(el).text().includes('imageArray')).text().trim().slice(13, -2).replace(/\\/g, ''));
|
|
66
|
-
|
|
67
|
-
//console.log(pageURLs.images);
|
|
68
|
-
|
|
69
|
-
const pages = pageURLs.images.map((img, i) => ({
|
|
70
|
-
img: img,
|
|
71
|
-
page: i,
|
|
72
|
-
title: `Page ${i + 1}`,
|
|
73
|
-
headerForImage: {
|
|
74
|
-
Referer: this.baseUrl
|
|
75
|
-
}
|
|
76
|
-
}));
|
|
77
|
-
return pages;
|
|
78
|
-
} catch (err) {
|
|
79
|
-
throw new Error(err.message);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
*
|
|
85
|
-
* @param query Search query
|
|
86
|
-
*/
|
|
87
|
-
search = async query => {
|
|
88
|
-
try {
|
|
89
|
-
const {
|
|
90
|
-
data
|
|
91
|
-
} = await this.ctx.axios.get(`${this.baseUrl}/?s=${query.replace(/ /g, '+')}`);
|
|
92
|
-
const $ = (0, _cheerio.load)(data);
|
|
93
|
-
const results = $('body > div.scroller-inner > div.wrapper > main > div.container > div.listagem > div.col').map((i, row) => ({
|
|
94
|
-
id: $(row).find('div.item > a').attr('href')?.split('/')[4],
|
|
95
|
-
title: $(row).find('div.item > a > h2').text(),
|
|
96
|
-
image: $(row).find('div.item > a > div > img').attr('src'),
|
|
97
|
-
headerForImage: {
|
|
98
|
-
Referer: this.baseUrl
|
|
99
|
-
}
|
|
100
|
-
})).get();
|
|
101
|
-
return {
|
|
102
|
-
results: results
|
|
103
|
-
};
|
|
104
|
-
} catch (err) {
|
|
105
|
-
throw new Error(err.message);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
exports.BRMangas = BRMangas;
|
|
110
|
-
//# sourceMappingURL=brmangas.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_cheerio","require","_index","_createProviderContext","BRMangas","MangaParser","name","baseUrl","logo","classPath","constructor","ctx","createProviderContext","fetchMangaInfo","mangaId","mangaInfo","id","title","data","axios","get","$","load","text","descriptionAndAltTitles","split","slice","length","trim","altTitles","filter","_","i","description","headerForImage","Referer","image","attr","genres","map","genre","status","MediaStatus","UNKNOWN","views","authors","replace","chapters","el","find","releasedDate","err","Error","message","fetchChapterPages","chapterId","url","script","pageURLs","JSON","parse","includes","pages","images","img","page","search","query","results","row","exports"],"sourceRoot":"../../../../src","sources":["providers/manga/brmangas.ts"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAUA,IAAAE,sBAAA,GAAAF,OAAA;AAEO,MAAMG,QAAQ,SAASC,kBAAW,CAAC;EACtBC,IAAI,GAAG,UAAU;EAChBC,OAAO,GAAG,0BAA0B;EACpCC,IAAI,GAAG,4EAA4E;EACnFC,SAAS,GAAG,gBAAgB;;EAE/C;EACAC,WAAWA,CAAkBC,GAAoB,GAAG,IAAAC,4CAAqB,EAAC,CAAC,EAAE;IAC3E,KAAK,CAAC,CAAC;IAAC,KADmBD,GAAoB,GAApBA,GAAoB;EAEjD;EAESE,cAAc,GAAG,MAAOC,OAAe,IAA0B;IACxE,MAAMC,SAAqB,GAAG;MAC5BC,EAAE,EAAEF,OAAO;MACXG,KAAK,EAAE;IACT,CAAC;IACD,IAAI;MACF,MAAM;QAAEC;MAAK,CAAC,GAAG,MAAM,IAAI,CAACP,GAAG,CAACQ,KAAK,CAACC,GAAG,CAAC,G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