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.
Files changed (211) hide show
  1. package/android/src/main/java/com/consumet/HttpRequestModule.kt +88 -33
  2. package/android/src/main/java/com/consumet/WebViewTask.kt +18 -3
  3. package/ios/Consumet.mm +172 -72
  4. package/lib/commonjs/NativeConsumet.ts +11 -5
  5. package/lib/commonjs/extension-registry.json +6 -6
  6. package/lib/commonjs/extension-registry.json.sig +1 -1
  7. package/lib/commonjs/extractors/kwik.js +28 -29
  8. package/lib/commonjs/extractors/kwik.js.map +1 -1
  9. package/lib/commonjs/index.js +18 -0
  10. package/lib/commonjs/index.js.map +1 -1
  11. package/lib/commonjs/models/types.js +6 -0
  12. package/lib/commonjs/models/types.js.map +1 -1
  13. package/lib/commonjs/providers/anime/animepahe/create-animepahe.js +12 -13
  14. package/lib/commonjs/providers/anime/animepahe/create-animepahe.js.map +1 -1
  15. package/lib/commonjs/providers/manga/asurascans.js +160 -96
  16. package/lib/commonjs/providers/manga/asurascans.js.map +1 -1
  17. package/lib/commonjs/providers/manga/flamescans.js +173 -91
  18. package/lib/commonjs/providers/manga/flamescans.js.map +1 -1
  19. package/lib/commonjs/providers/manga/index.js +1 -15
  20. package/lib/commonjs/providers/manga/index.js.map +1 -1
  21. package/lib/commonjs/providers/manga/mangadex.js +234 -227
  22. package/lib/commonjs/providers/manga/mangadex.js.map +1 -1
  23. package/lib/commonjs/providers/manga/mangahere.js +279 -135
  24. package/lib/commonjs/providers/manga/mangahere.js.map +1 -1
  25. package/lib/commonjs/providers/manga/mangakakalot.js +206 -107
  26. package/lib/commonjs/providers/manga/mangakakalot.js.map +1 -1
  27. package/lib/commonjs/providers/manga/mangapill.js +126 -38
  28. package/lib/commonjs/providers/manga/mangapill.js.map +1 -1
  29. package/lib/commonjs/providers/meta/anilist.js +41 -12
  30. package/lib/commonjs/providers/meta/anilist.js.map +1 -1
  31. package/lib/commonjs/utils/index.js +19 -0
  32. package/lib/commonjs/utils/index.js.map +1 -1
  33. package/lib/commonjs/utils/manga.js +60 -0
  34. package/lib/commonjs/utils/manga.js.map +1 -0
  35. package/lib/module/NativeConsumet.ts +11 -5
  36. package/lib/module/extension-registry.json +6 -6
  37. package/lib/module/extension-registry.json.sig +1 -1
  38. package/lib/module/extractors/kwik.js +28 -29
  39. package/lib/module/extractors/kwik.js.map +1 -1
  40. package/lib/module/index.js +2 -2
  41. package/lib/module/index.js.map +1 -1
  42. package/lib/module/models/types.js +9 -0
  43. package/lib/module/models/types.js.map +1 -1
  44. package/lib/module/providers/anime/animepahe/create-animepahe.js +12 -13
  45. package/lib/module/providers/anime/animepahe/create-animepahe.js.map +1 -1
  46. package/lib/module/providers/manga/asurascans.js +161 -96
  47. package/lib/module/providers/manga/asurascans.js.map +1 -1
  48. package/lib/module/providers/manga/flamescans.js +174 -91
  49. package/lib/module/providers/manga/flamescans.js.map +1 -1
  50. package/lib/module/providers/manga/index.js +1 -15
  51. package/lib/module/providers/manga/index.js.map +1 -1
  52. package/lib/module/providers/manga/mangadex.js +236 -228
  53. package/lib/module/providers/manga/mangadex.js.map +1 -1
  54. package/lib/module/providers/manga/mangahere.js +276 -132
  55. package/lib/module/providers/manga/mangahere.js.map +1 -1
  56. package/lib/module/providers/manga/mangakakalot.js +207 -107
  57. package/lib/module/providers/manga/mangakakalot.js.map +1 -1
  58. package/lib/module/providers/manga/mangapill.js +128 -39
  59. package/lib/module/providers/manga/mangapill.js.map +1 -1
  60. package/lib/module/providers/meta/anilist.js +41 -12
  61. package/lib/module/providers/meta/anilist.js.map +1 -1
  62. package/lib/module/utils/index.js +1 -0
  63. package/lib/module/utils/index.js.map +1 -1
  64. package/lib/module/utils/manga.js +54 -0
  65. package/lib/module/utils/manga.js.map +1 -0
  66. package/lib/typescript/commonjs/src/NativeConsumet.d.ts +11 -5
  67. package/lib/typescript/commonjs/src/NativeConsumet.d.ts.map +1 -1
  68. package/lib/typescript/commonjs/src/extractors/kwik.d.ts +1 -1
  69. package/lib/typescript/commonjs/src/extractors/kwik.d.ts.map +1 -1
  70. package/lib/typescript/commonjs/src/index.d.ts +2 -2
  71. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  72. package/lib/typescript/commonjs/src/models/types.d.ts +38 -5
  73. package/lib/typescript/commonjs/src/models/types.d.ts.map +1 -1
  74. package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
  75. package/lib/typescript/commonjs/src/providers/manga/asurascans.d.ts +14 -4
  76. package/lib/typescript/commonjs/src/providers/manga/asurascans.d.ts.map +1 -1
  77. package/lib/typescript/commonjs/src/providers/manga/flamescans.d.ts +18 -3
  78. package/lib/typescript/commonjs/src/providers/manga/flamescans.d.ts.map +1 -1
  79. package/lib/typescript/commonjs/src/providers/manga/index.d.ts +0 -14
  80. package/lib/typescript/commonjs/src/providers/manga/index.d.ts.map +1 -1
  81. package/lib/typescript/commonjs/src/providers/manga/mangadex.d.ts +22 -5
  82. package/lib/typescript/commonjs/src/providers/manga/mangadex.d.ts.map +1 -1
  83. package/lib/typescript/commonjs/src/providers/manga/mangahere.d.ts +15 -3
  84. package/lib/typescript/commonjs/src/providers/manga/mangahere.d.ts.map +1 -1
  85. package/lib/typescript/commonjs/src/providers/manga/mangakakalot.d.ts +26 -4
  86. package/lib/typescript/commonjs/src/providers/manga/mangakakalot.d.ts.map +1 -1
  87. package/lib/typescript/commonjs/src/providers/manga/mangapill.d.ts +16 -2
  88. package/lib/typescript/commonjs/src/providers/manga/mangapill.d.ts.map +1 -1
  89. package/lib/typescript/commonjs/src/providers/meta/anilist.d.ts.map +1 -1
  90. package/lib/typescript/commonjs/src/utils/index.d.ts +1 -0
  91. package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -1
  92. package/lib/typescript/commonjs/src/utils/manga.d.ts +19 -0
  93. package/lib/typescript/commonjs/src/utils/manga.d.ts.map +1 -0
  94. package/lib/typescript/module/src/NativeConsumet.d.ts +11 -5
  95. package/lib/typescript/module/src/NativeConsumet.d.ts.map +1 -1
  96. package/lib/typescript/module/src/extractors/kwik.d.ts +1 -1
  97. package/lib/typescript/module/src/extractors/kwik.d.ts.map +1 -1
  98. package/lib/typescript/module/src/index.d.ts +2 -2
  99. package/lib/typescript/module/src/index.d.ts.map +1 -1
  100. package/lib/typescript/module/src/models/types.d.ts +38 -5
  101. package/lib/typescript/module/src/models/types.d.ts.map +1 -1
  102. package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
  103. package/lib/typescript/module/src/providers/manga/asurascans.d.ts +14 -4
  104. package/lib/typescript/module/src/providers/manga/asurascans.d.ts.map +1 -1
  105. package/lib/typescript/module/src/providers/manga/flamescans.d.ts +18 -3
  106. package/lib/typescript/module/src/providers/manga/flamescans.d.ts.map +1 -1
  107. package/lib/typescript/module/src/providers/manga/index.d.ts +0 -14
  108. package/lib/typescript/module/src/providers/manga/index.d.ts.map +1 -1
  109. package/lib/typescript/module/src/providers/manga/mangadex.d.ts +22 -5
  110. package/lib/typescript/module/src/providers/manga/mangadex.d.ts.map +1 -1
  111. package/lib/typescript/module/src/providers/manga/mangahere.d.ts +15 -3
  112. package/lib/typescript/module/src/providers/manga/mangahere.d.ts.map +1 -1
  113. package/lib/typescript/module/src/providers/manga/mangakakalot.d.ts +26 -4
  114. package/lib/typescript/module/src/providers/manga/mangakakalot.d.ts.map +1 -1
  115. package/lib/typescript/module/src/providers/manga/mangapill.d.ts +16 -2
  116. package/lib/typescript/module/src/providers/manga/mangapill.d.ts.map +1 -1
  117. package/lib/typescript/module/src/providers/meta/anilist.d.ts.map +1 -1
  118. package/lib/typescript/module/src/utils/index.d.ts +1 -0
  119. package/lib/typescript/module/src/utils/index.d.ts.map +1 -1
  120. package/lib/typescript/module/src/utils/manga.d.ts +19 -0
  121. package/lib/typescript/module/src/utils/manga.d.ts.map +1 -0
  122. package/package.json +1 -1
  123. package/src/NativeConsumet.ts +11 -5
  124. package/src/extension-registry.json +6 -6
  125. package/src/extension-registry.json.sig +1 -1
  126. package/src/extractors/kwik.ts +30 -43
  127. package/src/index.tsx +6 -0
  128. package/src/models/types.ts +38 -3
  129. package/src/providers/anime/animepahe/create-animepahe.ts +15 -14
  130. package/src/providers/manga/asurascans.ts +200 -135
  131. package/src/providers/manga/flamescans.ts +221 -118
  132. package/src/providers/manga/index.ts +0 -14
  133. package/src/providers/manga/mangadex.ts +335 -282
  134. package/src/providers/manga/mangahere.ts +309 -156
  135. package/src/providers/manga/mangakakalot.ts +249 -152
  136. package/src/providers/manga/mangapill.ts +163 -64
  137. package/src/providers/meta/anilist.ts +50 -14
  138. package/src/utils/index.ts +1 -0
  139. package/src/utils/manga.ts +58 -0
  140. package/lib/commonjs/providers/manga/brmangas.js +0 -110
  141. package/lib/commonjs/providers/manga/brmangas.js.map +0 -1
  142. package/lib/commonjs/providers/manga/comick.js +0 -154
  143. package/lib/commonjs/providers/manga/comick.js.map +0 -1
  144. package/lib/commonjs/providers/manga/mangahost.js +0 -113
  145. package/lib/commonjs/providers/manga/mangahost.js.map +0 -1
  146. package/lib/commonjs/providers/manga/mangapark.js +0 -97
  147. package/lib/commonjs/providers/manga/mangapark.js.map +0 -1
  148. package/lib/commonjs/providers/manga/mangareader.js +0 -106
  149. package/lib/commonjs/providers/manga/mangareader.js.map +0 -1
  150. package/lib/commonjs/providers/manga/mangasee123.js +0 -161
  151. package/lib/commonjs/providers/manga/mangasee123.js.map +0 -1
  152. package/lib/commonjs/providers/manga/readmanga.js +0 -269
  153. package/lib/commonjs/providers/manga/readmanga.js.map +0 -1
  154. package/lib/commonjs/providers/manga/vyvymanga.js +0 -166
  155. package/lib/commonjs/providers/manga/vyvymanga.js.map +0 -1
  156. package/lib/module/providers/manga/brmangas.js +0 -105
  157. package/lib/module/providers/manga/brmangas.js.map +0 -1
  158. package/lib/module/providers/manga/comick.js +0 -149
  159. package/lib/module/providers/manga/comick.js.map +0 -1
  160. package/lib/module/providers/manga/mangahost.js +0 -108
  161. package/lib/module/providers/manga/mangahost.js.map +0 -1
  162. package/lib/module/providers/manga/mangapark.js +0 -92
  163. package/lib/module/providers/manga/mangapark.js.map +0 -1
  164. package/lib/module/providers/manga/mangareader.js +0 -101
  165. package/lib/module/providers/manga/mangareader.js.map +0 -1
  166. package/lib/module/providers/manga/mangasee123.js +0 -156
  167. package/lib/module/providers/manga/mangasee123.js.map +0 -1
  168. package/lib/module/providers/manga/readmanga.js +0 -264
  169. package/lib/module/providers/manga/readmanga.js.map +0 -1
  170. package/lib/module/providers/manga/vyvymanga.js +0 -161
  171. package/lib/module/providers/manga/vyvymanga.js.map +0 -1
  172. package/lib/typescript/commonjs/src/providers/manga/brmangas.d.ts +0 -18
  173. package/lib/typescript/commonjs/src/providers/manga/brmangas.d.ts.map +0 -1
  174. package/lib/typescript/commonjs/src/providers/manga/comick.d.ts +0 -39
  175. package/lib/typescript/commonjs/src/providers/manga/comick.d.ts.map +0 -1
  176. package/lib/typescript/commonjs/src/providers/manga/mangahost.d.ts +0 -18
  177. package/lib/typescript/commonjs/src/providers/manga/mangahost.d.ts.map +0 -1
  178. package/lib/typescript/commonjs/src/providers/manga/mangapark.d.ts +0 -14
  179. package/lib/typescript/commonjs/src/providers/manga/mangapark.d.ts.map +0 -1
  180. package/lib/typescript/commonjs/src/providers/manga/mangareader.d.ts +0 -18
  181. package/lib/typescript/commonjs/src/providers/manga/mangareader.d.ts.map +0 -1
  182. package/lib/typescript/commonjs/src/providers/manga/mangasee123.d.ts +0 -17
  183. package/lib/typescript/commonjs/src/providers/manga/mangasee123.d.ts.map +0 -1
  184. package/lib/typescript/commonjs/src/providers/manga/readmanga.d.ts +0 -31
  185. package/lib/typescript/commonjs/src/providers/manga/readmanga.d.ts.map +0 -1
  186. package/lib/typescript/commonjs/src/providers/manga/vyvymanga.d.ts +0 -17
  187. package/lib/typescript/commonjs/src/providers/manga/vyvymanga.d.ts.map +0 -1
  188. package/lib/typescript/module/src/providers/manga/brmangas.d.ts +0 -18
  189. package/lib/typescript/module/src/providers/manga/brmangas.d.ts.map +0 -1
  190. package/lib/typescript/module/src/providers/manga/comick.d.ts +0 -39
  191. package/lib/typescript/module/src/providers/manga/comick.d.ts.map +0 -1
  192. package/lib/typescript/module/src/providers/manga/mangahost.d.ts +0 -18
  193. package/lib/typescript/module/src/providers/manga/mangahost.d.ts.map +0 -1
  194. package/lib/typescript/module/src/providers/manga/mangapark.d.ts +0 -14
  195. package/lib/typescript/module/src/providers/manga/mangapark.d.ts.map +0 -1
  196. package/lib/typescript/module/src/providers/manga/mangareader.d.ts +0 -18
  197. package/lib/typescript/module/src/providers/manga/mangareader.d.ts.map +0 -1
  198. package/lib/typescript/module/src/providers/manga/mangasee123.d.ts +0 -17
  199. package/lib/typescript/module/src/providers/manga/mangasee123.d.ts.map +0 -1
  200. package/lib/typescript/module/src/providers/manga/readmanga.d.ts +0 -31
  201. package/lib/typescript/module/src/providers/manga/readmanga.d.ts.map +0 -1
  202. package/lib/typescript/module/src/providers/manga/vyvymanga.d.ts +0 -17
  203. package/lib/typescript/module/src/providers/manga/vyvymanga.d.ts.map +0 -1
  204. package/src/providers/manga/brmangas.ts +0 -148
  205. package/src/providers/manga/comick.ts +0 -285
  206. package/src/providers/manga/mangahost.ts +0 -134
  207. package/src/providers/manga/mangapark.ts +0 -115
  208. package/src/providers/manga/mangareader.ts +0 -132
  209. package/src/providers/manga/mangasee123.ts +0 -187
  210. package/src/providers/manga/readmanga.ts +0 -380
  211. 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 { data } = await this.ctx.axios.get(`${this.baseUrl}/search?q=${encodeURIComponent(query)}`);
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
- (i, el): IMangaResult => ({
38
- id: $(el).find('a').attr('href')?.split('/manga/')[1]!,
39
- title: $(el).find('div > a > div').text().trim(),
40
- image: $(el).find('a img').attr('data-src'),
41
- })
42
- )
43
- .get();
44
-
45
- return {
46
- results: results,
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
- mangaInfo.title = $('div.container div.my-3 div.flex-col div.mb-3 h1').text().trim();
64
- mangaInfo.description = $('div.container div.my-3 div.flex-col p.text--secondary').text().split('\n').join(' ')!;
65
- mangaInfo.releaseDate = $('div.container div.my-3 div.flex-col div.gap-3.mb-3 div:contains("Year")')
66
- .text()
67
- .split('Year\n')[1]!
68
- .trim();
69
- mangaInfo.genres = $('div.container div.my-3 div.flex-col div.mb-3:contains("Genres")')
70
- .text()
71
- .split('\n')
72
- .filter((genre: string) => genre !== 'Genres' && genre !== '')
73
- .map((genre) => genre.trim());
74
-
75
- mangaInfo.chapters = $('div.container div.border-border div#chapters div.grid-cols-1 a')
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
- const chapterSelector = $('chapter-page');
97
-
98
- const pages = chapterSelector
99
- .map(
100
- (i, el): IMangaChapterPage => ({
101
- img: $(el).find('div picture img').attr('data-src')!,
102
- page: parseFloat($(el).find(`div[data-summary] > div`).text().split('page ')[1]!),
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
- // (async () => {
115
- // const manga = new MangaPill();
116
- // const search = await manga.search('one piece');
117
- // const info = await manga.fetchMangaInfo(search.results[1].id);
118
- // const pages = await manga.fetchChapterPages(info.chapters![0].id);
119
- // console.log(pages);
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 { Mangasee123 } from '../manga/mangasee123';
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
- // Sort by similarity score
625
- uniqueResults.sort((a, b) => (b.similarity || 0) - (a.similarity || 0));
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 (mangadex, mangasee, etc)
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 Mangasee123();
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 = [...chapters].reverse();
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
- const possibleManga = results.find(
1214
- (manga: IMangaResult) =>
1215
- title.toLowerCase() === (typeof manga.title === 'string' ? manga.title.toLowerCase() : '')
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;
@@ -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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