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.
Files changed (182) hide show
  1. package/lib/commonjs/extension-registry.json.sig +1 -1
  2. package/lib/commonjs/index.js +18 -0
  3. package/lib/commonjs/index.js.map +1 -1
  4. package/lib/commonjs/models/types.js +6 -0
  5. package/lib/commonjs/models/types.js.map +1 -1
  6. package/lib/commonjs/providers/manga/asurascans.js +160 -96
  7. package/lib/commonjs/providers/manga/asurascans.js.map +1 -1
  8. package/lib/commonjs/providers/manga/flamescans.js +173 -91
  9. package/lib/commonjs/providers/manga/flamescans.js.map +1 -1
  10. package/lib/commonjs/providers/manga/index.js +1 -15
  11. package/lib/commonjs/providers/manga/index.js.map +1 -1
  12. package/lib/commonjs/providers/manga/mangadex.js +234 -227
  13. package/lib/commonjs/providers/manga/mangadex.js.map +1 -1
  14. package/lib/commonjs/providers/manga/mangahere.js +279 -135
  15. package/lib/commonjs/providers/manga/mangahere.js.map +1 -1
  16. package/lib/commonjs/providers/manga/mangakakalot.js +206 -107
  17. package/lib/commonjs/providers/manga/mangakakalot.js.map +1 -1
  18. package/lib/commonjs/providers/manga/mangapill.js +126 -38
  19. package/lib/commonjs/providers/manga/mangapill.js.map +1 -1
  20. package/lib/commonjs/providers/meta/anilist.js +41 -12
  21. package/lib/commonjs/providers/meta/anilist.js.map +1 -1
  22. package/lib/commonjs/utils/index.js +19 -0
  23. package/lib/commonjs/utils/index.js.map +1 -1
  24. package/lib/commonjs/utils/manga.js +60 -0
  25. package/lib/commonjs/utils/manga.js.map +1 -0
  26. package/lib/module/extension-registry.json.sig +1 -1
  27. package/lib/module/index.js +2 -2
  28. package/lib/module/index.js.map +1 -1
  29. package/lib/module/models/types.js +9 -0
  30. package/lib/module/models/types.js.map +1 -1
  31. package/lib/module/providers/manga/asurascans.js +161 -96
  32. package/lib/module/providers/manga/asurascans.js.map +1 -1
  33. package/lib/module/providers/manga/flamescans.js +174 -91
  34. package/lib/module/providers/manga/flamescans.js.map +1 -1
  35. package/lib/module/providers/manga/index.js +1 -15
  36. package/lib/module/providers/manga/index.js.map +1 -1
  37. package/lib/module/providers/manga/mangadex.js +236 -228
  38. package/lib/module/providers/manga/mangadex.js.map +1 -1
  39. package/lib/module/providers/manga/mangahere.js +276 -132
  40. package/lib/module/providers/manga/mangahere.js.map +1 -1
  41. package/lib/module/providers/manga/mangakakalot.js +207 -107
  42. package/lib/module/providers/manga/mangakakalot.js.map +1 -1
  43. package/lib/module/providers/manga/mangapill.js +128 -39
  44. package/lib/module/providers/manga/mangapill.js.map +1 -1
  45. package/lib/module/providers/meta/anilist.js +41 -12
  46. package/lib/module/providers/meta/anilist.js.map +1 -1
  47. package/lib/module/utils/index.js +1 -0
  48. package/lib/module/utils/index.js.map +1 -1
  49. package/lib/module/utils/manga.js +54 -0
  50. package/lib/module/utils/manga.js.map +1 -0
  51. package/lib/typescript/commonjs/src/index.d.ts +2 -2
  52. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  53. package/lib/typescript/commonjs/src/models/types.d.ts +38 -5
  54. package/lib/typescript/commonjs/src/models/types.d.ts.map +1 -1
  55. package/lib/typescript/commonjs/src/providers/manga/asurascans.d.ts +14 -4
  56. package/lib/typescript/commonjs/src/providers/manga/asurascans.d.ts.map +1 -1
  57. package/lib/typescript/commonjs/src/providers/manga/flamescans.d.ts +18 -3
  58. package/lib/typescript/commonjs/src/providers/manga/flamescans.d.ts.map +1 -1
  59. package/lib/typescript/commonjs/src/providers/manga/index.d.ts +0 -14
  60. package/lib/typescript/commonjs/src/providers/manga/index.d.ts.map +1 -1
  61. package/lib/typescript/commonjs/src/providers/manga/mangadex.d.ts +22 -5
  62. package/lib/typescript/commonjs/src/providers/manga/mangadex.d.ts.map +1 -1
  63. package/lib/typescript/commonjs/src/providers/manga/mangahere.d.ts +15 -3
  64. package/lib/typescript/commonjs/src/providers/manga/mangahere.d.ts.map +1 -1
  65. package/lib/typescript/commonjs/src/providers/manga/mangakakalot.d.ts +26 -4
  66. package/lib/typescript/commonjs/src/providers/manga/mangakakalot.d.ts.map +1 -1
  67. package/lib/typescript/commonjs/src/providers/manga/mangapill.d.ts +16 -2
  68. package/lib/typescript/commonjs/src/providers/manga/mangapill.d.ts.map +1 -1
  69. package/lib/typescript/commonjs/src/providers/meta/anilist.d.ts.map +1 -1
  70. package/lib/typescript/commonjs/src/utils/index.d.ts +1 -0
  71. package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -1
  72. package/lib/typescript/commonjs/src/utils/manga.d.ts +19 -0
  73. package/lib/typescript/commonjs/src/utils/manga.d.ts.map +1 -0
  74. package/lib/typescript/module/src/index.d.ts +2 -2
  75. package/lib/typescript/module/src/index.d.ts.map +1 -1
  76. package/lib/typescript/module/src/models/types.d.ts +38 -5
  77. package/lib/typescript/module/src/models/types.d.ts.map +1 -1
  78. package/lib/typescript/module/src/providers/manga/asurascans.d.ts +14 -4
  79. package/lib/typescript/module/src/providers/manga/asurascans.d.ts.map +1 -1
  80. package/lib/typescript/module/src/providers/manga/flamescans.d.ts +18 -3
  81. package/lib/typescript/module/src/providers/manga/flamescans.d.ts.map +1 -1
  82. package/lib/typescript/module/src/providers/manga/index.d.ts +0 -14
  83. package/lib/typescript/module/src/providers/manga/index.d.ts.map +1 -1
  84. package/lib/typescript/module/src/providers/manga/mangadex.d.ts +22 -5
  85. package/lib/typescript/module/src/providers/manga/mangadex.d.ts.map +1 -1
  86. package/lib/typescript/module/src/providers/manga/mangahere.d.ts +15 -3
  87. package/lib/typescript/module/src/providers/manga/mangahere.d.ts.map +1 -1
  88. package/lib/typescript/module/src/providers/manga/mangakakalot.d.ts +26 -4
  89. package/lib/typescript/module/src/providers/manga/mangakakalot.d.ts.map +1 -1
  90. package/lib/typescript/module/src/providers/manga/mangapill.d.ts +16 -2
  91. package/lib/typescript/module/src/providers/manga/mangapill.d.ts.map +1 -1
  92. package/lib/typescript/module/src/providers/meta/anilist.d.ts.map +1 -1
  93. package/lib/typescript/module/src/utils/index.d.ts +1 -0
  94. package/lib/typescript/module/src/utils/index.d.ts.map +1 -1
  95. package/lib/typescript/module/src/utils/manga.d.ts +19 -0
  96. package/lib/typescript/module/src/utils/manga.d.ts.map +1 -0
  97. package/package.json +1 -1
  98. package/src/extension-registry.json.sig +1 -1
  99. package/src/index.tsx +6 -0
  100. package/src/models/types.ts +38 -3
  101. package/src/providers/manga/asurascans.ts +200 -135
  102. package/src/providers/manga/flamescans.ts +221 -118
  103. package/src/providers/manga/index.ts +0 -14
  104. package/src/providers/manga/mangadex.ts +335 -282
  105. package/src/providers/manga/mangahere.ts +309 -156
  106. package/src/providers/manga/mangakakalot.ts +249 -152
  107. package/src/providers/manga/mangapill.ts +163 -64
  108. package/src/providers/meta/anilist.ts +50 -14
  109. package/src/utils/index.ts +1 -0
  110. package/src/utils/manga.ts +58 -0
  111. package/lib/commonjs/providers/manga/brmangas.js +0 -110
  112. package/lib/commonjs/providers/manga/brmangas.js.map +0 -1
  113. package/lib/commonjs/providers/manga/comick.js +0 -154
  114. package/lib/commonjs/providers/manga/comick.js.map +0 -1
  115. package/lib/commonjs/providers/manga/mangahost.js +0 -113
  116. package/lib/commonjs/providers/manga/mangahost.js.map +0 -1
  117. package/lib/commonjs/providers/manga/mangapark.js +0 -97
  118. package/lib/commonjs/providers/manga/mangapark.js.map +0 -1
  119. package/lib/commonjs/providers/manga/mangareader.js +0 -106
  120. package/lib/commonjs/providers/manga/mangareader.js.map +0 -1
  121. package/lib/commonjs/providers/manga/mangasee123.js +0 -161
  122. package/lib/commonjs/providers/manga/mangasee123.js.map +0 -1
  123. package/lib/commonjs/providers/manga/readmanga.js +0 -269
  124. package/lib/commonjs/providers/manga/readmanga.js.map +0 -1
  125. package/lib/commonjs/providers/manga/vyvymanga.js +0 -166
  126. package/lib/commonjs/providers/manga/vyvymanga.js.map +0 -1
  127. package/lib/module/providers/manga/brmangas.js +0 -105
  128. package/lib/module/providers/manga/brmangas.js.map +0 -1
  129. package/lib/module/providers/manga/comick.js +0 -149
  130. package/lib/module/providers/manga/comick.js.map +0 -1
  131. package/lib/module/providers/manga/mangahost.js +0 -108
  132. package/lib/module/providers/manga/mangahost.js.map +0 -1
  133. package/lib/module/providers/manga/mangapark.js +0 -92
  134. package/lib/module/providers/manga/mangapark.js.map +0 -1
  135. package/lib/module/providers/manga/mangareader.js +0 -101
  136. package/lib/module/providers/manga/mangareader.js.map +0 -1
  137. package/lib/module/providers/manga/mangasee123.js +0 -156
  138. package/lib/module/providers/manga/mangasee123.js.map +0 -1
  139. package/lib/module/providers/manga/readmanga.js +0 -264
  140. package/lib/module/providers/manga/readmanga.js.map +0 -1
  141. package/lib/module/providers/manga/vyvymanga.js +0 -161
  142. package/lib/module/providers/manga/vyvymanga.js.map +0 -1
  143. package/lib/typescript/commonjs/src/providers/manga/brmangas.d.ts +0 -18
  144. package/lib/typescript/commonjs/src/providers/manga/brmangas.d.ts.map +0 -1
  145. package/lib/typescript/commonjs/src/providers/manga/comick.d.ts +0 -39
  146. package/lib/typescript/commonjs/src/providers/manga/comick.d.ts.map +0 -1
  147. package/lib/typescript/commonjs/src/providers/manga/mangahost.d.ts +0 -18
  148. package/lib/typescript/commonjs/src/providers/manga/mangahost.d.ts.map +0 -1
  149. package/lib/typescript/commonjs/src/providers/manga/mangapark.d.ts +0 -14
  150. package/lib/typescript/commonjs/src/providers/manga/mangapark.d.ts.map +0 -1
  151. package/lib/typescript/commonjs/src/providers/manga/mangareader.d.ts +0 -18
  152. package/lib/typescript/commonjs/src/providers/manga/mangareader.d.ts.map +0 -1
  153. package/lib/typescript/commonjs/src/providers/manga/mangasee123.d.ts +0 -17
  154. package/lib/typescript/commonjs/src/providers/manga/mangasee123.d.ts.map +0 -1
  155. package/lib/typescript/commonjs/src/providers/manga/readmanga.d.ts +0 -31
  156. package/lib/typescript/commonjs/src/providers/manga/readmanga.d.ts.map +0 -1
  157. package/lib/typescript/commonjs/src/providers/manga/vyvymanga.d.ts +0 -17
  158. package/lib/typescript/commonjs/src/providers/manga/vyvymanga.d.ts.map +0 -1
  159. package/lib/typescript/module/src/providers/manga/brmangas.d.ts +0 -18
  160. package/lib/typescript/module/src/providers/manga/brmangas.d.ts.map +0 -1
  161. package/lib/typescript/module/src/providers/manga/comick.d.ts +0 -39
  162. package/lib/typescript/module/src/providers/manga/comick.d.ts.map +0 -1
  163. package/lib/typescript/module/src/providers/manga/mangahost.d.ts +0 -18
  164. package/lib/typescript/module/src/providers/manga/mangahost.d.ts.map +0 -1
  165. package/lib/typescript/module/src/providers/manga/mangapark.d.ts +0 -14
  166. package/lib/typescript/module/src/providers/manga/mangapark.d.ts.map +0 -1
  167. package/lib/typescript/module/src/providers/manga/mangareader.d.ts +0 -18
  168. package/lib/typescript/module/src/providers/manga/mangareader.d.ts.map +0 -1
  169. package/lib/typescript/module/src/providers/manga/mangasee123.d.ts +0 -17
  170. package/lib/typescript/module/src/providers/manga/mangasee123.d.ts.map +0 -1
  171. package/lib/typescript/module/src/providers/manga/readmanga.d.ts +0 -31
  172. package/lib/typescript/module/src/providers/manga/readmanga.d.ts.map +0 -1
  173. package/lib/typescript/module/src/providers/manga/vyvymanga.d.ts +0 -17
  174. package/lib/typescript/module/src/providers/manga/vyvymanga.d.ts.map +0 -1
  175. package/src/providers/manga/brmangas.ts +0 -148
  176. package/src/providers/manga/comick.ts +0 -285
  177. package/src/providers/manga/mangahost.ts +0 -134
  178. package/src/providers/manga/mangapark.ts +0 -115
  179. package/src/providers/manga/mangareader.ts +0 -132
  180. package/src/providers/manga/mangasee123.ts +0 -187
  181. package/src/providers/manga/readmanga.ts +0 -380
  182. package/src/providers/manga/vyvymanga.ts +0 -237
@@ -3,10 +3,22 @@
3
3
  import { load } from 'cheerio';
4
4
  import { MangaParser, MediaStatus } from "../../models/index.js";
5
5
  import { createProviderContext } from "../../utils/create-provider-context.js";
6
+ import { sortChaptersForReading } from "../../utils/manga.js";
7
+
8
+ /** The JSON API behind asurascans.com (the site's own pages call it). */
9
+ const API_URL = 'https://api.asurascans.com/api';
10
+ const PAGE_SIZE = 20;
11
+
12
+ /** A series as the API lists it (search, browse and series detail). */
13
+
14
+ /**
15
+ * AsuraScans (asurascans.com, formerly asuracomic.net). Ids are the site's series slug
16
+ * (`omniscient-readers-viewpoint`) and `<slug>/chapter/<number>` for chapters.
17
+ */
6
18
  export class AsuraScans extends MangaParser {
7
19
  name = 'AsuraScans';
8
- baseUrl = 'https://asuracomic.net';
9
- logo = 'https://asuracomic.net/images/logo.png';
20
+ baseUrl = 'https://asurascans.com';
21
+ logo = 'https://asurascans.com/images/logo.webp';
10
22
  classPath = 'MANGA.AsuraScans';
11
23
 
12
24
  /** @param ctx provider context; requests go through its axios (default: `createProviderContext()`) */
@@ -14,112 +26,165 @@ export class AsuraScans extends MangaParser {
14
26
  super();
15
27
  this.ctx = ctx;
16
28
  }
29
+
30
+ /**
31
+ * @param query Search query
32
+ * @param page Page number (default: 1), 20 results per page
33
+ */
34
+ search = async (query, page = 1) => {
35
+ const currentPage = Math.max(1, Math.floor(page) || 1);
36
+ const offset = (currentPage - 1) * PAGE_SIZE;
37
+ const {
38
+ data,
39
+ meta
40
+ } = await this.api(`/series?search=${encodeURIComponent(query)}&limit=${PAGE_SIZE}&offset=${offset}`);
41
+ const results = (data ?? []).map(series => this.toResult(series));
42
+ return {
43
+ currentPage,
44
+ hasNextPage: meta?.has_more ?? (typeof meta?.total === 'number' && offset + results.length < meta.total),
45
+ results
46
+ };
47
+ };
48
+
49
+ /** @param mangaId series slug from `search` (`series/<slug>-<hash>` ids from asuracomic.net work too) */
17
50
  fetchMangaInfo = async mangaId => {
18
- try {
19
- const {
20
- data
21
- } = await this.ctx.axios.get(`${this.baseUrl}/${mangaId}`);
22
- const $ = load(data);
23
- const dom = $('html');
24
- const topInfoWrapper = dom.find('.relative.col-span-12.space-y-3.px-6');
25
- const info = {
26
- id: mangaId,
27
- title: dom.find('.text-xl.font-bold:nth-child(1)').text().trim(),
28
- image: $(topInfoWrapper).find('img').attr('src'),
29
- rating: $(topInfoWrapper).find('div > div.px-2.py-1 > p').text().trim(),
30
- status: this.determineMediaState($(topInfoWrapper).find('div > div.flex.flex-row > div:nth-child(1) > h3:nth-child(2)').text().trim()),
31
- description: dom.find('span.font-medium.text-sm').text().trim(),
32
- authors: dom.find('.grid.grid-cols-1.gap-5.mt-8 > div:nth-child(2) > h3:nth-child(2)').text().trim().split('/').map(ele => ele.trim()),
33
- artist: dom.find('.grid.grid-cols-1.gap-5.mt-8 > div:nth-child(3) > h3:nth-child(2)').text().trim(),
34
- updatedOn: dom.find('.grid.grid-cols-1.gap-5.mt-8 > div:nth-child(5) > h3:nth-child(2)').text().trim(),
35
- genres: dom.find('.space-y-1.pt-4 > div > button').map((index, ele) => $(ele).text().trim()).get(),
36
- recommendations: dom.find('.grid.grid-cols-2.gap-3.p-4 > a').map((index, ele) => {
37
- return {
38
- id: $(ele).attr('href'),
39
- title: $(ele).find('div > h2.font-bold').text().trim(),
40
- image: $(ele).find('div > div > img').attr('src'),
41
- latestChapter: $(ele).find('div > h2:nth-child(3)').text().trim(),
42
- status: this.determineMediaState($(ele).find('div > div:nth-child(1) > span').text().trim()),
43
- rating: $(ele).find('div > div.block > span > label').text().trim()
44
- };
45
- }).get()
51
+ const slug = encodeURIComponent(mangaId.replace(/^\/?(?:series|comics)\//, '').replace(/\/+$/, ''));
52
+ const [detail, list] = await Promise.all([this.api(`/series/${slug}`), this.api(`/series/${slug}/chapters`)]);
53
+ // A 200 without the JSON the API normally sends (a challenge or error page) has no series.
54
+ const series = detail?.series;
55
+ if (!series?.slug) throw new Error(`AsuraScans: the API sent no series for "${mangaId}"`);
56
+ const seriesUrl = this.absolute(series.public_url);
57
+ const genres = (series.genres ?? []).map(genre => genre.name?.trim()).filter(Boolean);
58
+ const authors = names(series.author);
59
+ const artists = names(series.artist);
60
+
61
+ // The API lists newest first; early-access chapters can't be read until they unlock.
62
+ const chapters = (list?.data ?? []).filter(chapter => Number.isFinite(chapter.number) && !isLocked(chapter)).reverse().map(chapter => {
63
+ const result = {
64
+ id: `${series.slug}/chapter/${chapter.number}`,
65
+ title: chapter.title?.replace(/\s+/g, ' ').trim() || `Chapter ${chapter.number}`,
66
+ chapterNumber: chapter.number
46
67
  };
47
- const chapMatch = data.replace(/\n/g, '').replace(/\\/g, '').match(/"chapters".*:(\[\{.*?\}\]),/);
48
- if (chapMatch) {
49
- const chap = JSON.parse(chapMatch[1]);
50
- info.chapters = chap.map(ele => {
51
- return {
52
- id: ele.name,
53
- title: ele.title !== '' ? ele.title : `Chapter ${ele.name}`,
54
- releaseDate: ele.published_at
55
- };
56
- });
57
- }
58
- return info;
59
- } catch (err) {
60
- throw new Error(err.message);
61
- }
68
+ const releaseDate = isoDate(chapter.published_at);
69
+ if (releaseDate) result.releaseDate = releaseDate;
70
+ if (seriesUrl) result.url = `${seriesUrl}/chapter/${chapter.number}`;
71
+ return result;
72
+ });
73
+ const info = this.toResult(series);
74
+ if (genres.length > 0) info.genres = genres;
75
+ if (authors) info.authors = authors;
76
+ if (artists) info.artists = artists;
77
+ const recommendations = (detail.recommended_series ?? []).map(item => this.toResult(item));
78
+ if (recommendations.length > 0) info.recommendations = recommendations;
79
+ info.chapters = sortChaptersForReading(chapters);
80
+ return info;
62
81
  };
82
+
83
+ /** @param chapterId chapter id from `fetchMangaInfo` (`<slug>/chapter/<number>`) */
63
84
  fetchChapterPages = async chapterId => {
64
- try {
65
- const {
66
- data
67
- } = await this.ctx.axios.get(`${this.baseUrl}/series/${chapterId}`);
68
- const chapMatch = data.replace(/\\/g, '').match(/pages.*:(\[{['"]order["'].*?}\])/);
69
- if (!chapMatch) throw new Error('Parsing error');
70
- const chap = JSON.parse(chapMatch[1]);
71
- return chap.map((page, index) => ({
72
- page: index + 1,
73
- img: page.url
74
- }));
75
- } catch (err) {
76
- throw new Error(err.message);
85
+ const match = /^\/?(?:(?:series|comics)\/)?([^/]+)\/chapters?\/([^/?#]+)\/?$/.exec(chapterId);
86
+ if (!match) throw new Error(`AsuraScans: invalid chapter id "${chapterId}"`);
87
+ const [, slug, number] = match;
88
+ const read = await this.api(`/series/${encodeURIComponent(slug)}/chapters/${encodeURIComponent(number)}`);
89
+ const data = read?.data;
90
+ if (!data) throw new Error(`AsuraScans: the API sent no chapter for "${chapterId}"`);
91
+ if (data.access_gate) throw new Error(`AsuraScans: chapter needs ${data.access_gate} on the site`);
92
+ if (data.is_locked) {
93
+ const until = data.unlock_time ? ` until ${data.unlock_time}` : '';
94
+ throw new Error(`AsuraScans: chapter is in early access${until}`);
77
95
  }
96
+ const pages = (data.chapter?.pages ?? []).filter(page => page?.url);
97
+ if (pages.length === 0) throw new Error('AsuraScans: chapter has no pages');
98
+ return pages.map((page, index) => ({
99
+ page: index + 1,
100
+ img: this.absolute(page.url)
101
+ }));
78
102
  };
79
103
 
80
- /**
81
- *
82
- * @param query Search query
83
- */
84
- search = async (query, page = 1) => {
104
+ /** GET a path of the JSON API; failures carry the API's own error message. */
105
+ async api(path) {
85
106
  try {
86
- const formattedQuery = encodeURI(query.toLowerCase());
87
107
  const {
88
108
  data
89
- } = await this.ctx.axios.get(`${this.baseUrl}/series?page=${page}&name=${formattedQuery}`);
90
- const $ = load(data);
91
- const dom = $('html');
92
- const results = dom.find('.grid.grid-cols-2.gap-3.p-4 > a').map((index, ele) => {
93
- return {
94
- id: $(ele).attr('href'),
95
- title: $(ele).find('div > div > div:nth-child(2) > span:nth-child(1)').text().trim(),
96
- image: $(ele).find('div > div > div:nth-child(1) > img').attr('src'),
97
- status: this.determineMediaState($(ele).find('div > div > div:nth-child(1) > span').text().trim()),
98
- latestChapter: $(ele).find('div > div > div:nth-child(2) > span:nth-child(2)').text().trim(),
99
- rating: $(ele).find('div > div > div:nth-child(2) > span:nth-child(3) > label').text().trim()
100
- };
101
- }).get();
102
- const searchResults = {
103
- currentPage: page,
104
- hasNextPage: dom.find('.flex.items-center.justify-center > a').attr('style').split('pointer-events:')[1].slice(1, -1) === 'auto' ? true : false,
105
- results: results
106
- };
107
- return searchResults;
109
+ } = await this.ctx.axios.get(`${API_URL}${path}`, {
110
+ headers: {
111
+ Accept: 'application/json'
112
+ }
113
+ });
114
+ return data;
108
115
  } catch (err) {
109
- throw new Error(err.message);
110
- }
111
- };
112
- determineMediaState(state) {
113
- switch (state.toLowerCase().trim()) {
114
- case 'completed':
115
- return MediaStatus.COMPLETED;
116
- case 'ongoing':
117
- return MediaStatus.ONGOING;
118
- case 'dropped':
119
- return MediaStatus.CANCELLED;
120
- default:
121
- return MediaStatus.UNKNOWN;
116
+ const response = err.response;
117
+ const reason = typeof response?.data?.error === 'string' ? response.data.error : err.message;
118
+ throw new Error(`AsuraScans: ${reason}${response?.status ? ` (${response.status})` : ''}`);
122
119
  }
123
120
  }
121
+
122
+ /** The fields search, info and recommendations share. */
123
+ toResult(series) {
124
+ const result = {
125
+ id: series.slug,
126
+ title: series.title.trim()
127
+ };
128
+ const altTitles = (series.alt_titles ?? []).map(title => title?.trim()).filter(Boolean);
129
+ if (altTitles.length > 0) result.altTitles = altTitles;
130
+ const image = this.absolute(series.cover ?? series.cover_url);
131
+ if (image) result.image = image;
132
+ const url = this.absolute(series.public_url);
133
+ if (url) result.url = url;
134
+ const description = plainText(series.description);
135
+ if (description) result.description = description;
136
+ const status = mediaStatus(series.status);
137
+ if (status) result.status = status;
138
+ // Site extras: manga / manhwa / manhua, the 0-10 user rating, the newest chapter's number.
139
+ if (series.type) result.type = series.type;
140
+ if (series.rating) result.rating = Math.round(series.rating * 100) / 100;
141
+ const latestChapter = series.latest_chapters?.[0]?.number;
142
+ if (typeof latestChapter === 'number') result.latestChapter = latestChapter;
143
+ return result;
144
+ }
145
+ absolute(url) {
146
+ if (!url) return undefined;
147
+ if (url.startsWith('//')) return `https:${url}`;
148
+ return url.startsWith('/') ? `${this.baseUrl}${url}` : url;
149
+ }
124
150
  }
151
+
152
+ /** Early-access chapters stay locked until `early_access_until`, as the site's chapter list shows. */
153
+ const isLocked = chapter => chapter.early_access_until ? Date.parse(chapter.early_access_until) > Date.now() : chapter.is_premium === true;
154
+ const mediaStatus = status => {
155
+ switch (status?.toLowerCase().trim()) {
156
+ case 'ongoing':
157
+ return MediaStatus.ONGOING;
158
+ case 'completed':
159
+ return MediaStatus.COMPLETED;
160
+ case 'hiatus':
161
+ return MediaStatus.HIATUS;
162
+ case 'dropped':
163
+ case 'axed':
164
+ return MediaStatus.CANCELLED;
165
+ default:
166
+ return undefined;
167
+ }
168
+ };
169
+
170
+ /** `Ahn Soseol/ Sunghyun` or `Fit, Geonjin` → separate names; undefined when there are none. */
171
+ const names = value => {
172
+ const list = (value ?? '').split(/[/,]/).map(name => name.trim()).filter(Boolean);
173
+ return list.length > 0 ? list : undefined;
174
+ };
175
+
176
+ /** The API's ISO timestamps, normalized; its zero date (`0001-01-01`) means none. */
177
+ const isoDate = value => {
178
+ if (!value || value.startsWith('0001-')) return undefined;
179
+ const time = Date.parse(value);
180
+ return Number.isNaN(time) ? value : new Date(time).toISOString();
181
+ };
182
+
183
+ /** The API's HTML synopsis as plain text, one paragraph per line. */
184
+ const plainText = html => {
185
+ if (!html) return undefined;
186
+ const $ = load(html.replace(/<br\s*\/?>/gi, '\n').replace(/<\/p>/gi, '\n'));
187
+ const text = $.root().text().split('\n').map(line => line.replace(/\s+/g, ' ').trim()).filter(Boolean).join('\n');
188
+ return text || undefined;
189
+ };
125
190
  //# sourceMappingURL=asurascans.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["load","MangaParser","MediaStatus","createProviderContext","AsuraScans","name","baseUrl","logo","classPath","constructor","ctx","fetchMangaInfo","mangaId","data","axios","get","$","dom","topInfoWrapper","find","info","id","title","text","trim","image","attr","rating","status","determineMediaState","description","authors","split","map","ele","artist","updatedOn","genres","index","recommendations","latestChapter","chapMatch","replace","match","chap","JSON","parse","chapters","releaseDate","published_at","err","Error","message","fetchChapterPages","chapterId","page","img","url","search","query","formattedQuery","encodeURI","toLowerCase","results","searchResults","currentPage","hasNextPage","slice","state","COMPLETED","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;IACtB,CAAC,CAAC,OAAOd,GAAG,EAAE;MACZ,MAAM,IAAIC,KAAK,CAAED,GAAG,CAAWE,OAAO,CAAC;IACzC;EACF,CAAC;EAEOvB,mBAAmBA,CAACuC,KAAa,EAAe;IACtD,QAAQA,KAAK,CAACN,WAAW,CAAC,CAAC,CAACtC,IAAI,CAAC,CAAC;MAChC,KAAK,WAAW;QACd,OAAOtB,WAAW,CAACmE,SAAS;MAC9B,KAAK,SAAS;QACZ,OAAOnE,WAAW,CAACoE,OAAO;MAC5B,KAAK,SAAS;QACZ,OAAOpE,WAAW,CAACqE,SAAS;MAC9B;QACE,OAAOrE,WAAW,CAACsE,OAAO;IAC9B;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"names":["load","MangaParser","MediaStatus","createProviderContext","sortChaptersForReading","API_URL","PAGE_SIZE","AsuraScans","name","baseUrl","logo","classPath","constructor","ctx","search","query","page","currentPage","Math","max","floor","offset","data","meta","api","encodeURIComponent","results","map","series","toResult","hasNextPage","has_more","total","length","fetchMangaInfo","mangaId","slug","replace","detail","list","Promise","all","Error","seriesUrl","absolute","public_url","genres","genre","trim","filter","Boolean","authors","names","author","artists","artist","chapters","chapter","Number","isFinite","number","isLocked","reverse","result","id","title","chapterNumber","releaseDate","isoDate","published_at","url","info","recommendations","recommended_series","item","fetchChapterPages","chapterId","match","exec","read","access_gate","is_locked","until","unlock_time","pages","index","img","path","axios","get","headers","Accept","err","response","reason","error","message","status","altTitles","alt_titles","image","cover","cover_url","description","plainText","mediaStatus","type","rating","round","latestChapter","latest_chapters","undefined","startsWith","early_access_until","Date","parse","now","is_premium","toLowerCase","ONGOING","COMPLETED","HIATUS","CANCELLED","value","split","time","isNaN","toISOString","html","$","text","root","line","join"],"sourceRoot":"../../../../src","sources":["providers/manga/asurascans.ts"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,SAAS;AAE9B,SACEC,WAAW,EAIXC,WAAW,QAIN,uBAAc;AACrB,SAASC,qBAAqB,QAAQ,wCAAq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