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,285 +0,0 @@
1
- import type { AxiosError } from 'axios';
2
- import {
3
- type IMangaChapterPage,
4
- type IMangaInfo,
5
- type IMangaResult,
6
- type ISearch,
7
- MangaParser,
8
- MediaStatus,
9
- type ProviderContext,
10
- } from '../../models';
11
- import { createProviderContext } from '../../utils/create-provider-context';
12
-
13
- export class ComicK extends MangaParser {
14
- override readonly name = 'ComicK';
15
- protected override baseUrl = 'https://comick.app';
16
- protected override logo = 'https://th.bing.com/th/id/OIP.fw4WrmAoA2PmKitiyMzUIgAAAA?pid=ImgDet&rs=1';
17
- protected override classPath = 'MANGA.ComicK';
18
-
19
- private readonly apiUrl = 'https://api.comick.io';
20
-
21
- /** @param ctx provider context; requests go through its axios (default: `createProviderContext()`) */
22
- constructor(private readonly ctx: ProviderContext = createProviderContext()) {
23
- super();
24
- }
25
-
26
- /** GETs a path of the ComicK API through the context axios */
27
- private apiGet = (path: string) =>
28
- this.ctx.axios.get(path, {
29
- baseURL: this.apiUrl,
30
- headers: {
31
- 'User-Agent': 'Mozilla/5.0',
32
- },
33
- });
34
-
35
- /**
36
- * @description Fetches info about the manga
37
- * @param mangaId Comic slug
38
- * @returns Promise<IMangaInfo>
39
- */
40
- override fetchMangaInfo = async (mangaId: string): Promise<IMangaInfo> => {
41
- try {
42
- const req = await this.apiGet(`/comic/${mangaId}`);
43
- const data: Comic = req.data.comic;
44
-
45
- const links = Object.values(data.links ?? []).filter((link) => link !== null);
46
-
47
- const mangaInfo: IMangaInfo = {
48
- id: data.hid,
49
- title: data.title,
50
- altTitles: data.md_titles ? data.md_titles.map((title) => title.title) : [],
51
- description: data.desc,
52
- genres: data.md_comic_md_genres?.map((genre) => genre.md_genres.name),
53
- status: (data.status ?? 0 === 0) ? MediaStatus.ONGOING : MediaStatus.COMPLETED,
54
- image: `https://meo.comick.pictures${data.md_covers ? data.md_covers[0]!.b2key : ''}`,
55
- malId: data.links?.mal,
56
- links: links,
57
- chapters: [],
58
- };
59
-
60
- const allChapters: ChapterData[] = await this.fetchAllChapters(mangaId, 1);
61
- for (const chapter of allChapters) {
62
- mangaInfo.chapters?.push({
63
- id: chapter.hid,
64
- title: chapter.title ?? chapter.chap,
65
- chapterNumber: chapter.chap,
66
- volumeNumber: chapter.vol,
67
- releaseDate: chapter.created_at,
68
- });
69
- }
70
-
71
- return mangaInfo;
72
- } catch (err) {
73
- if ((err as AxiosError).code === 'ERR_BAD_REQUEST')
74
- throw new Error(`[${this.name}] Bad request. Make sure you have entered a valid query.`);
75
-
76
- throw new Error((err as Error).message);
77
- }
78
- };
79
-
80
- /**
81
- *
82
- * @param chapterId Chapter ID (HID)
83
- * @returns Promise<IMangaChapterPage[]>
84
- */
85
- override fetchChapterPages = async (chapterId: string): Promise<IMangaChapterPage[]> => {
86
- try {
87
- const { data } = await this.apiGet(`/chapter/${chapterId}`);
88
-
89
- const pages: { img: string; page: number }[] = [];
90
-
91
- data.chapter.md_images.map((image: { b2key: string; w: string }, index: number) => {
92
- pages.push({
93
- img: `https://meo.comick.pictures/${image.b2key}?width=${image.w}`,
94
- page: index,
95
- });
96
- });
97
-
98
- return pages;
99
- } catch (err) {
100
- throw new Error((err as Error).message);
101
- }
102
- };
103
-
104
- /**
105
- * @param query search query
106
- * @param page page number (default: 1)
107
- * @param limit limit of results to return (default: 20) (max: 100) (min: 1)
108
- */
109
- override search = async (query: string, page: number = 1, limit: number = 20): Promise<ISearch<IMangaResult>> => {
110
- if (page < 1) throw new Error('Page number must be greater than 1');
111
- if (limit > 300) throw new Error('Limit must be less than or equal to 300');
112
- if (limit * (page - 1) >= 10000) throw new Error('not enough results');
113
-
114
- try {
115
- const req = await this.apiGet(`/v1.0/search?q=${encodeURIComponent(query)}&limit=${limit}&page=${page}`);
116
-
117
- const results: ISearch<IMangaResult> = {
118
- currentPage: page,
119
- results: [],
120
- };
121
-
122
- const data: SearchResult[] = await req.data;
123
-
124
- for (const manga of data) {
125
- let cover: Cover | string | null = manga.md_covers ? manga.md_covers[0]! : null;
126
- if (cover && cover.b2key !== undefined) {
127
- cover = `https://meo.comick.pictures${cover.b2key}`;
128
- }
129
-
130
- results.results.push({
131
- id: manga.slug,
132
- title: manga.title ?? manga.slug,
133
- altTitles: manga.md_titles ? manga.md_titles.map((title) => title.title) : [],
134
- image: cover as string,
135
- });
136
- }
137
-
138
- return results;
139
- } catch (err) {
140
- throw new Error((err as Error).message);
141
- }
142
- };
143
-
144
- private fetchAllChapters = async (mangaId: string, page: number): Promise<any[]> => {
145
- if (page <= 0) {
146
- page = 1;
147
- }
148
- const comicId = await this.getComicId(mangaId);
149
- const req = await this.apiGet(`/comic/${comicId}/chapters?page=${page}`);
150
- return req.data.chapters;
151
- };
152
-
153
- /**
154
- * @description Fetches the comic HID from the slug
155
- * @param id Comic slug
156
- * @returns Promise<string> empty if not found
157
- */
158
- private async getComicId(id: string): Promise<string> {
159
- const req = await this.apiGet(`/comic/${id}`);
160
- const data: Comic = req.data.comic;
161
- return data ? data.hid : '';
162
- }
163
- }
164
-
165
- // (async () => {
166
- // const md = new MangaDex();
167
- // const search = await md.search('solo leveling');
168
- // const manga = await md.fetchMangaInfo(search.results[0].id);
169
- // const chapterPages = await md.fetchChapterPages(manga.chapters![0].id);
170
- // console.log(chapterPages);
171
- // })();
172
-
173
- interface SearchResult {
174
- title: string;
175
- id: number;
176
- slug: string;
177
- rating: string;
178
- rating_count: number;
179
- follow_count: number;
180
- user_follow_count: number;
181
- content_rating: string;
182
- demographic: number;
183
- md_titles: [MDTitle];
184
- md_covers: Array<Cover>;
185
- highlight: string;
186
- }
187
-
188
- interface Cover {
189
- vol: any;
190
- w: number;
191
- h: number;
192
- b2key: string;
193
- }
194
-
195
- interface MDTitle {
196
- title: string;
197
- }
198
-
199
- interface Comic {
200
- hid: string;
201
- title: string;
202
- country: string;
203
- status: number;
204
- links: ComicLinks;
205
- last_chapter: any;
206
- chapter_count: number;
207
- demographic: number;
208
- hentai: boolean;
209
- user_follow_count: number;
210
- follow_rank: number;
211
- comment_count: number;
212
- follow_count: number;
213
- desc: string;
214
- parsed: string;
215
- slug: string;
216
- mismatch: any;
217
- year: number;
218
- bayesian_rating: any;
219
- rating_count: number;
220
- content_rating: string;
221
- translation_completed: boolean;
222
- relate_from: Array<any>;
223
- mies: any;
224
- md_titles: Array<ComicTitles>;
225
- md_comic_md_genres: Array<ComicGenres>;
226
- mu_comics: {
227
- licensed_in_english: any;
228
- mu_comic_categories: Array<ComicCategories>;
229
- };
230
- md_covers: Array<Cover>;
231
- iso639_1: string;
232
- lang_name: string;
233
- lang_native: string;
234
- }
235
-
236
- interface ComicLinks {
237
- al: string;
238
- ap: string;
239
- bw: string;
240
- kt: string;
241
- mu: string;
242
- amz: string;
243
- cdj: string;
244
- ebj: string;
245
- mal: string;
246
- raw: string;
247
- }
248
-
249
- interface ComicTitles {
250
- title: string;
251
- }
252
-
253
- interface ComicGenres {
254
- md_genres: {
255
- name: string;
256
- type: string | null;
257
- slug: string;
258
- group: string;
259
- };
260
- }
261
-
262
- interface ComicCategories {
263
- mu_categories: {
264
- title: string;
265
- slug: string;
266
- };
267
- positive_vote: number;
268
- negative_vote: number;
269
- }
270
-
271
- interface ChapterData {
272
- id: number;
273
- chap: string;
274
- title: string;
275
- vol: string;
276
- slug: string | null;
277
- lang: string;
278
- created_at: string;
279
- updated_at: string;
280
- up_count: number;
281
- down_count: number;
282
- group_name: string[];
283
- hid: string;
284
- md_groups: string[];
285
- }
@@ -1,134 +0,0 @@
1
- import { load } from 'cheerio';
2
-
3
- import {
4
- MangaParser,
5
- type ISearch,
6
- type IMangaInfo,
7
- type IMangaResult,
8
- MediaStatus,
9
- type IMangaChapterPage,
10
- type IMangaChapter,
11
- type ProviderContext,
12
- } from '../../models';
13
- import { createProviderContext } from '../../utils/create-provider-context';
14
-
15
- export class MangaHost extends MangaParser {
16
- override readonly name = 'MangaHost';
17
- protected override baseUrl = 'https://mangahosted.com';
18
- protected override logo = 'https://i.imgur.com/OVlhhsR.png';
19
- protected override classPath = 'MANGA.MangaHost';
20
-
21
- /** @param ctx provider context; requests go through its axios (default: `createProviderContext()`) */
22
- constructor(private readonly ctx: ProviderContext = createProviderContext()) {
23
- super();
24
- }
25
-
26
- override fetchMangaInfo = async (mangaId: string): Promise<IMangaInfo> => {
27
- const mangaInfo: IMangaInfo = {
28
- id: mangaId,
29
- title: '',
30
- };
31
- try {
32
- const { data } = await this.ctx.axios.get(`${this.baseUrl}/manga/${mangaId}`);
33
- const $ = load(data);
34
-
35
- mangaInfo.title = $('article.ejeCg > h1.title').text();
36
- mangaInfo.altTitles = $('article.ejeCg > h3.subtitle').text();
37
- mangaInfo.description = $('div.text > div.paragraph > p').text().replace(/\n/g, '').trim();
38
- mangaInfo.headerForImage = { Referer: this.baseUrl };
39
- mangaInfo.image = $('div.widget:nth-child(1) > picture > img').attr('src');
40
- mangaInfo.genres = $('article.ejeCg:nth-child(1) > div.tags > a.tag ')
41
- .map((i, el) => $(el).text())
42
- .get();
43
-
44
- switch ($('h3.subtitle > strong').text()) {
45
- case 'Completo':
46
- mangaInfo.status = MediaStatus.COMPLETED;
47
- break;
48
- case 'Ativo':
49
- mangaInfo.status = MediaStatus.ONGOING;
50
- break;
51
- default:
52
- mangaInfo.status = MediaStatus.UNKNOWN;
53
- }
54
- mangaInfo.views = parseInt(
55
- $('div.classificacao-box-1 > div.text-block-3').text().replace(' views', '').replace(/,/g, '').trim()
56
- );
57
- mangaInfo.authors = $(
58
- 'div.w-col.w-col-6:nth-child(1) > ul.w-list-unstyled:nth-child(1) > li:nth-child(3) > div:nth-child(1)'
59
- )
60
- .map((i, el) => $(el).text().replace('Autor: ', '').trim())
61
- .get();
62
-
63
- mangaInfo.chapters = $('div.chapters > div.cap')
64
- .map((i, el): IMangaChapter => {
65
- const releasedDate = $(el)
66
- .find('div.card > div.pop-content > small')
67
- .text()
68
- .match(/Adicionado em (.+?)"/);
69
-
70
- return {
71
- id: `${$(el).find('a.btn-caps').text()}`,
72
- title: $(el).find('a.btn-caps').attr('title')!,
73
- views: null,
74
- releasedDate: releasedDate ? releasedDate[1] : '',
75
- };
76
- })
77
- .get();
78
-
79
- return mangaInfo;
80
- } catch (err) {
81
- throw new Error((err as Error).message);
82
- }
83
- };
84
-
85
- override fetchChapterPages = async (mangaId: string, chapterId: string): Promise<IMangaChapterPage[]> => {
86
- try {
87
- const url = `${this.baseUrl}/manga/${mangaId}/${chapterId}`;
88
- const { data } = await this.ctx.axios.get(url);
89
- const $ = load(data);
90
-
91
- const pages = $('section#imageWrapper > div > div.read-slideshow > a > img')
92
- .map(
93
- (i, el): IMangaChapterPage => ({
94
- img: $(el).attr('src')!,
95
- page: i,
96
- title: `Page ${i + 1}`,
97
- headerForImage: { Referer: this.baseUrl },
98
- })
99
- )
100
- .get();
101
-
102
- return pages;
103
- } catch (err) {
104
- throw new Error((err as Error).message);
105
- }
106
- };
107
-
108
- /**
109
- *
110
- * @param query Search query
111
- */
112
- override search = async (query: string): Promise<ISearch<IMangaResult>> => {
113
- try {
114
- const { data } = await this.ctx.axios.get(`${this.baseUrl}/find/${query.replace(/ /g, '+')}`);
115
- const $ = load(data);
116
-
117
- const results = $('body > div.w-container > main > table > tbody > tr')
118
- .map(
119
- (i, row): IMangaResult => ({
120
- id: $(row).find('td > a.pull-left').attr('href')?.split('/')[4]!,
121
- title: $(row).find('td > h4.entry-title > a').text(),
122
- image: $(row).find('td > a.pull-left > picture > img.manga').attr('src'),
123
- headerForImage: { Referer: this.baseUrl },
124
- })
125
- )
126
- .get();
127
- return {
128
- results: results,
129
- };
130
- } catch (err) {
131
- throw new Error((err as Error).message);
132
- }
133
- };
134
- }
@@ -1,115 +0,0 @@
1
- import { load } from 'cheerio';
2
-
3
- import {
4
- MangaParser,
5
- type ISearch,
6
- type IMangaInfo,
7
- type IMangaResult,
8
- type IMangaChapterPage,
9
- type IMangaChapter,
10
- type ProviderContext,
11
- } from '../../models';
12
- import { createProviderContext } from '../../utils/create-provider-context';
13
-
14
- export class Mangapark extends MangaParser {
15
- override readonly name = 'Mangapark';
16
- protected override baseUrl = 'https://v2.mangapark.net';
17
- protected override logo =
18
- 'https://raw.githubusercontent.com/tachiyomiorg/tachiyomi-extensions/repo/icon/tachiyomi-en.mangapark-v1.3.23.png';
19
- protected override classPath = 'MANGA.Mangapark';
20
-
21
- /** @param ctx provider context; requests go through its axios (default: `createProviderContext()`) */
22
- constructor(private readonly ctx: ProviderContext = createProviderContext()) {
23
- super();
24
- }
25
-
26
- override fetchMangaInfo = async (mangaId: string, ...args: any): Promise<IMangaInfo> => {
27
- const mangaInfo: IMangaInfo = { id: mangaId, title: '' };
28
- const url = `${this.baseUrl}/manga/${mangaId}`;
29
-
30
- try {
31
- const { data } = await this.ctx.axios.get(url);
32
- const $ = load(data);
33
-
34
- mangaInfo.title = $('div.pb-1.mb-2.line-b-f.hd h2 a').text();
35
- mangaInfo.image = $('img.w-100').attr('src');
36
- mangaInfo.description = $('.limit-html.summary').text();
37
-
38
- mangaInfo.chapters = $('.py-1.item')
39
- .get()
40
- .map(
41
- (chapter): IMangaChapter => ({
42
- /*
43
- See below: if inside of [], removed; if inside of {}, chapterId.
44
- [https://v2.mangapark.net/manga/] {bungou-stray-dogs/i2573185} [/c87/1]
45
- */
46
- id:
47
- `${mangaId}/` +
48
- $(chapter)
49
- .find('a.ml-1.visited.ch')
50
- .attr('href')!
51
- .split(`/manga/${mangaId}/`)
52
- .toString()
53
- .replace(',', '')
54
- .split('/')[0],
55
- // Get ch.xyz + chapter title, trim l/t whitespace on latter, concatenate.
56
- title:
57
- $(chapter).find('.ml-1.visited.ch').text() +
58
- $(chapter).find('div.d-none.d-md-flex.align-items-center.ml-0.ml-md-1.txt').text().trim(),
59
- // Get 'x time ago' and remove l/t whitespace.
60
- releaseDate: $(chapter).find('span.time').text().trim(),
61
- })
62
- );
63
-
64
- return mangaInfo;
65
- } catch (err) {
66
- throw new Error((err as Error).message);
67
- }
68
- };
69
-
70
- override fetchChapterPages = async (chapterId: string, ...args: any): Promise<IMangaChapterPage[]> => {
71
- const regex = /var _load_pages = \[(.*)\]/gm;
72
-
73
- // Fetches manga with all pages; no /cx/y after.
74
- const url = `${this.baseUrl}/manga/${chapterId}`;
75
-
76
- try {
77
- const { data } = await this.ctx.axios.get(url);
78
-
79
- const varLoadPages: string = data.match(regex)[0];
80
- const loadPagesJson = JSON.parse(varLoadPages.replace('var _load_pages = ', ''));
81
-
82
- const pages: IMangaChapterPage[] = loadPagesJson.map((page: { n: string; u: string }) => {
83
- return { page: page.n, img: page.u };
84
- });
85
-
86
- return pages;
87
- } catch (err) {
88
- throw new Error((err as Error).message);
89
- }
90
- };
91
-
92
- override search = async (query: string, page: number = 1, ...args: any[]): Promise<ISearch<IMangaResult>> => {
93
- const url = `${this.baseUrl}/search?q=${query}&page=${page}`;
94
-
95
- try {
96
- const { data } = await this.ctx.axios.get(url);
97
- const $ = load(data);
98
-
99
- const results: IMangaResult[] = $('.item')
100
- .get()
101
- .map((item) => {
102
- const cover = $(item).find('.cover');
103
- return {
104
- id: `${cover.attr('href')?.replace('/manga/', '')}`,
105
- title: `${cover.attr('title')}`,
106
- image: `${$(cover).find('img').attr('src')}}`,
107
- };
108
- });
109
-
110
- return { results: results };
111
- } catch (err) {
112
- throw new Error((err as Error).message);
113
- }
114
- };
115
- }
@@ -1,132 +0,0 @@
1
- import { load } from 'cheerio';
2
-
3
- import {
4
- MangaParser,
5
- type ISearch,
6
- type IMangaInfo,
7
- type IMangaResult,
8
- type IMangaChapterPage,
9
- type IMangaChapter,
10
- type ProviderContext,
11
- } from '../../models';
12
- import { createProviderContext } from '../../utils/create-provider-context';
13
-
14
- export class MangaReader extends MangaParser {
15
- override readonly name = 'MangaReader';
16
- protected override baseUrl = 'https://mangareader.to';
17
- protected override logo = 'https://pbs.twimg.com/profile_images/1437311892905545728/TO0hFfUr_400x400.jpg';
18
- protected override classPath = 'MANGA.MangaReader';
19
-
20
- /** @param ctx provider context; requests go through its axios (default: `createProviderContext()`) */
21
- constructor(private readonly ctx: ProviderContext = createProviderContext()) {
22
- super();
23
- }
24
-
25
- /**
26
- *
27
- * @param query Search query
28
- */
29
- override search = async (query: string): Promise<ISearch<IMangaResult>> => {
30
- try {
31
- const { data } = await this.ctx.axios.get(`${this.baseUrl}/search?keyword=${query}`);
32
- const $ = load(data);
33
-
34
- const results = $('div.manga_list-sbs div.mls-wrap div.item')
35
- .map(
36
- (i, el): IMangaResult => ({
37
- id: $(el).find('a.manga-poster').attr('href')?.split('/')[1]!,
38
- title: $(el).find('div.manga-detail h3.manga-name a').text().trim(),
39
- image: $(el).find('a.manga-poster img').attr('src'),
40
- genres: $(el)
41
- .find(`div.manga-detail div.fd-infor span > a`)
42
- .map((i, genre) => $(genre).text())
43
- .get(),
44
- })
45
- )
46
- .get();
47
-
48
- return {
49
- results: results,
50
- };
51
- } catch (err) {
52
- // console.log(err);
53
- throw new Error((err as Error).message);
54
- }
55
- };
56
-
57
- override fetchMangaInfo = async (mangaId: string): Promise<IMangaInfo> => {
58
- const mangaInfo: IMangaInfo = {
59
- id: mangaId,
60
- title: '',
61
- };
62
- try {
63
- const { data } = await this.ctx.axios.get(`${this.baseUrl}/${mangaId}`);
64
- const $ = load(data);
65
-
66
- const container = $('div.container');
67
-
68
- mangaInfo.title = container.find('div.anisc-detail h2.manga-name').text().trim();
69
- mangaInfo.image = container.find('img.manga-poster-img').attr('src');
70
- mangaInfo.description = $('div.modal-body div.description-modal').text().split('\n').join(' ').trim();
71
- mangaInfo.genres = container
72
- .find('div.sort-desc div.genres a')
73
- .map((i, genre) => $(genre).text().trim())
74
- .get();
75
-
76
- mangaInfo.chapters = container
77
- .find(`div.chapters-list-ul ul li`)
78
- .map(
79
- (i, el): IMangaChapter => ({
80
- id: $(el).find('a').attr('href')?.split('/read/')[1]!,
81
- title: $(el).find('a').attr('title')!.trim(),
82
- chapter: $(el).find('a span.name').text().split('Chapter ')[1]!.split(':')[0],
83
- })
84
- )
85
- .get();
86
-
87
- return mangaInfo;
88
- } catch (err) {
89
- throw new Error((err as Error).message);
90
- }
91
- };
92
-
93
- override fetchChapterPages = async (chapterId: string): Promise<IMangaChapterPage[]> => {
94
- try {
95
- const { data } = await this.ctx.axios.get(`${this.baseUrl}/read/${chapterId}`);
96
- const $ = load(data);
97
-
98
- const readingId = $('div#wrapper').attr('data-reading-id');
99
-
100
- if (!readingId) {
101
- throw new Error('Unable to find pages');
102
- }
103
-
104
- const ajaxURL = `https://mangareader.to/ajax/image/list/chap/${readingId}?mode=vertical&quality=high`;
105
- const { data: pagesData } = await this.ctx.axios.get(ajaxURL);
106
- const $PagesHTML = load(pagesData.html);
107
-
108
- const pagesSelector = $PagesHTML('div#main-wrapper div.container-reader-chapter div.iv-card');
109
-
110
- const pages = pagesSelector
111
- .map(
112
- (i, el): IMangaChapterPage => ({
113
- img: $(el).attr('data-url')!.replace('&amp;', '&'),
114
- page: i + 1,
115
- })
116
- )
117
- .get();
118
-
119
- return pages;
120
- } catch (err) {
121
- throw new Error((err as Error).message);
122
- }
123
- };
124
- }
125
-
126
- // (async () => {
127
- // const manga = new MangaReader();
128
- // const search = await manga.search('one piece');
129
- // const info = await manga.fetchMangaInfo(search.results[0].id);
130
- // const pages = await manga.fetchChapterPages(info.chapters![0].id);
131
- // console.log(pages);
132
- // })();