react-native-consumet 3.0.1 → 5.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 (1166) hide show
  1. package/README.md +1 -1
  2. package/android/build.gradle +1 -18
  3. package/android/generated/java/com/consumet/NativeConsumetSpec.java +0 -8
  4. package/android/generated/jni/RNConsumetSpec-generated.cpp +0 -12
  5. package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI.h +0 -18
  6. package/android/src/androidTest/java/com/consumet/TestSupport.kt +12 -6
  7. package/android/src/androidTest/java/com/consumet/WebViewContractTest.kt +70 -22
  8. package/android/src/main/AndroidManifest.xml +2 -3
  9. package/android/src/main/java/com/consumet/ConsumetModule.kt +0 -11
  10. package/android/src/main/java/com/consumet/DeobfuscatorModule.kt +6 -11
  11. package/android/src/main/java/com/consumet/HttpClients.kt +26 -0
  12. package/android/src/main/java/com/consumet/HttpRequestModule.kt +134 -198
  13. package/android/src/main/java/com/consumet/RequestHeaders.kt +39 -0
  14. package/android/src/main/java/com/consumet/WebViewTask.kt +33 -23
  15. package/ios/Consumet.mm +340 -432
  16. package/ios/RCConsumetSynchronyCache.m +3 -1
  17. package/ios/generated/ReactCodegen/RNConsumetSpec/RNConsumetSpec-generated.mm +0 -14
  18. package/ios/generated/ReactCodegen/RNConsumetSpec/RNConsumetSpec.h +0 -6
  19. package/ios/generated/ReactCodegen/RNConsumetSpecJSI.h +0 -18
  20. package/lib/commonjs/NativeConsumet.ts +50 -52
  21. package/lib/commonjs/extension-registry.json +48 -188
  22. package/lib/commonjs/extension-registry.json.sig +1 -1
  23. package/lib/commonjs/extractors/file-hosts.js +42 -0
  24. package/lib/commonjs/extractors/file-hosts.js.map +1 -0
  25. package/lib/commonjs/extractors/flixcloud.js +25 -60
  26. package/lib/commonjs/extractors/flixcloud.js.map +1 -1
  27. package/lib/commonjs/extractors/gofile.js +123 -97
  28. package/lib/commonjs/extractors/gofile.js.map +1 -1
  29. package/lib/commonjs/extractors/hls.js +46 -0
  30. package/lib/commonjs/extractors/hls.js.map +1 -0
  31. package/lib/commonjs/extractors/hubcloud.js +131 -288
  32. package/lib/commonjs/extractors/hubcloud.js.map +1 -1
  33. package/lib/commonjs/extractors/index.js +4 -116
  34. package/lib/commonjs/extractors/index.js.map +1 -1
  35. package/lib/commonjs/extractors/kwik.js +15 -49
  36. package/lib/commonjs/extractors/kwik.js.map +1 -1
  37. package/lib/commonjs/extractors/megacloud.js +67 -140
  38. package/lib/commonjs/extractors/megacloud.js.map +1 -1
  39. package/lib/commonjs/extractors/megaplay.js +78 -128
  40. package/lib/commonjs/extractors/megaplay.js.map +1 -1
  41. package/lib/commonjs/extractors/packer.js +40 -0
  42. package/lib/commonjs/extractors/packer.js.map +1 -0
  43. package/lib/commonjs/extractors/streamwish.js +47 -103
  44. package/lib/commonjs/extractors/streamwish.js.map +1 -1
  45. package/lib/commonjs/extractors/url.js +11 -0
  46. package/lib/commonjs/extractors/url.js.map +1 -0
  47. package/lib/commonjs/extractors/vidhide.js +32 -59
  48. package/lib/commonjs/extractors/vidhide.js.map +1 -1
  49. package/lib/commonjs/index.js +123 -217
  50. package/lib/commonjs/index.js.map +1 -1
  51. package/lib/commonjs/models/anime-parser.js +4 -17
  52. package/lib/commonjs/models/anime-parser.js.map +1 -1
  53. package/lib/commonjs/models/base-parser.js.map +1 -1
  54. package/lib/commonjs/models/base-provider.js +6 -33
  55. package/lib/commonjs/models/base-provider.js.map +1 -1
  56. package/lib/commonjs/models/index.js +25 -52
  57. package/lib/commonjs/models/index.js.map +1 -1
  58. package/lib/commonjs/models/lightnovel-parser.js.map +1 -1
  59. package/lib/commonjs/models/manga-parser.js.map +1 -1
  60. package/lib/commonjs/models/meta-error.js +10 -4
  61. package/lib/commonjs/models/meta-error.js.map +1 -1
  62. package/lib/commonjs/models/movie-parser.js.map +1 -1
  63. package/lib/commonjs/models/provider-error.js +54 -0
  64. package/lib/commonjs/models/provider-error.js.map +1 -0
  65. package/lib/commonjs/models/types.js +13 -22
  66. package/lib/commonjs/models/types.js.map +1 -1
  67. package/lib/commonjs/models/video-extractor.js +0 -10
  68. package/lib/commonjs/models/video-extractor.js.map +1 -1
  69. package/lib/commonjs/providers/anime/anikoto/anikoto.js +3 -182
  70. package/lib/commonjs/providers/anime/anikoto/anikoto.js.map +1 -1
  71. package/lib/commonjs/providers/anime/anikoto/create-anikoto.js +319 -436
  72. package/lib/commonjs/providers/anime/anikoto/create-anikoto.js.map +1 -1
  73. package/lib/commonjs/providers/anime/anikoto/hianime.js +77 -0
  74. package/lib/commonjs/providers/anime/anikoto/hianime.js.map +1 -0
  75. package/lib/commonjs/providers/anime/animepahe/animepahe.js +2 -66
  76. package/lib/commonjs/providers/anime/animepahe/animepahe.js.map +1 -1
  77. package/lib/commonjs/providers/anime/animepahe/create-animepahe.js +259 -190
  78. package/lib/commonjs/providers/anime/animepahe/create-animepahe.js.map +1 -1
  79. package/lib/commonjs/providers/anime/helpers.js +16 -0
  80. package/lib/commonjs/providers/anime/helpers.js.map +1 -0
  81. package/lib/commonjs/providers/anime/index.js +1 -13
  82. package/lib/commonjs/providers/anime/index.js.map +1 -1
  83. package/lib/commonjs/providers/anime/reanime/create-reanime.js +42 -62
  84. package/lib/commonjs/providers/anime/reanime/create-reanime.js.map +1 -1
  85. package/lib/commonjs/providers/anime/reanime/reanime.js +2 -27
  86. package/lib/commonjs/providers/anime/reanime/reanime.js.map +1 -1
  87. package/lib/commonjs/providers/common/concurrency.js +38 -0
  88. package/lib/commonjs/providers/common/concurrency.js.map +1 -0
  89. package/lib/commonjs/providers/common/enc-dec.js +9 -0
  90. package/lib/commonjs/providers/common/enc-dec.js.map +1 -0
  91. package/lib/commonjs/providers/common/errors.js +77 -0
  92. package/lib/commonjs/providers/common/errors.js.map +1 -0
  93. package/lib/commonjs/providers/common/media-status.js +20 -0
  94. package/lib/commonjs/providers/common/media-status.js.map +1 -0
  95. package/lib/commonjs/providers/common/search.js +15 -0
  96. package/lib/commonjs/providers/common/search.js.map +1 -0
  97. package/lib/commonjs/providers/common/servers.js +45 -0
  98. package/lib/commonjs/providers/common/servers.js.map +1 -0
  99. package/lib/commonjs/providers/common/ttl-cache.js +59 -0
  100. package/lib/commonjs/providers/common/ttl-cache.js.map +1 -0
  101. package/lib/commonjs/providers/index.js +2 -3
  102. package/lib/commonjs/providers/index.js.map +1 -1
  103. package/lib/commonjs/providers/light-novels/novelupdates.js +49 -98
  104. package/lib/commonjs/providers/light-novels/novelupdates.js.map +1 -1
  105. package/lib/commonjs/providers/light-novels/readlightnovels.js +51 -93
  106. package/lib/commonjs/providers/light-novels/readlightnovels.js.map +1 -1
  107. package/lib/commonjs/providers/manga/asurascans.js +43 -56
  108. package/lib/commonjs/providers/manga/asurascans.js.map +1 -1
  109. package/lib/commonjs/providers/manga/flamescans.js +11 -33
  110. package/lib/commonjs/providers/manga/flamescans.js.map +1 -1
  111. package/lib/commonjs/providers/manga/mangadex.js +18 -17
  112. package/lib/commonjs/providers/manga/mangadex.js.map +1 -1
  113. package/lib/commonjs/providers/manga/mangahere.js +107 -169
  114. package/lib/commonjs/providers/manga/mangahere.js.map +1 -1
  115. package/lib/commonjs/providers/manga/mangakakalot.js +26 -56
  116. package/lib/commonjs/providers/manga/mangakakalot.js.map +1 -1
  117. package/lib/commonjs/providers/manga/mangapill.js +82 -120
  118. package/lib/commonjs/providers/manga/mangapill.js.map +1 -1
  119. package/lib/commonjs/providers/manga/shared.js +72 -0
  120. package/lib/commonjs/providers/manga/shared.js.map +1 -0
  121. package/lib/commonjs/providers/meta/anilist-media.js +252 -0
  122. package/lib/commonjs/providers/meta/anilist-media.js.map +1 -0
  123. package/lib/commonjs/providers/meta/anilist.js +435 -842
  124. package/lib/commonjs/providers/meta/anilist.js.map +1 -1
  125. package/lib/commonjs/providers/meta/index.js +2 -2
  126. package/lib/commonjs/providers/meta/index.js.map +1 -1
  127. package/lib/commonjs/providers/meta/mal.js +139 -323
  128. package/lib/commonjs/providers/meta/mal.js.map +1 -1
  129. package/lib/commonjs/providers/meta/shared.js +132 -0
  130. package/lib/commonjs/providers/meta/shared.js.map +1 -0
  131. package/lib/commonjs/providers/meta/tmdb.js +251 -298
  132. package/lib/commonjs/providers/meta/tmdb.js.map +1 -1
  133. package/lib/commonjs/providers/movies/index.js +7 -15
  134. package/lib/commonjs/providers/movies/index.js.map +1 -1
  135. package/lib/commonjs/providers/movies/multimovies/create-multimovies.js +217 -409
  136. package/lib/commonjs/providers/movies/multimovies/create-multimovies.js.map +1 -1
  137. package/lib/commonjs/providers/movies/multimovies/multimovies.js +2 -42
  138. package/lib/commonjs/providers/movies/multimovies/multimovies.js.map +1 -1
  139. package/lib/commonjs/providers/movies/multistream/create-multistream.js +130 -0
  140. package/lib/commonjs/providers/movies/multistream/create-multistream.js.map +1 -0
  141. package/lib/commonjs/providers/movies/multistream/multistream.js +12 -0
  142. package/lib/commonjs/providers/movies/multistream/multistream.js.map +1 -0
  143. package/lib/commonjs/providers/movies/multistream/utils.js +330 -406
  144. package/lib/commonjs/providers/movies/multistream/utils.js.map +1 -1
  145. package/lib/commonjs/providers/movies/netflixmirror/create-netflixmirror.js +69 -15
  146. package/lib/commonjs/providers/movies/netflixmirror/create-netflixmirror.js.map +1 -1
  147. package/lib/commonjs/providers/movies/netflixmirror/netflixmirror.js +6 -15
  148. package/lib/commonjs/providers/movies/netflixmirror/netflixmirror.js.map +1 -1
  149. package/lib/commonjs/providers/movies/site-paths.js +34 -0
  150. package/lib/commonjs/providers/movies/site-paths.js.map +1 -0
  151. package/lib/commonjs/providers/movies/vegamovies/create-vegamovies.js +474 -654
  152. package/lib/commonjs/providers/movies/vegamovies/create-vegamovies.js.map +1 -1
  153. package/lib/commonjs/providers/movies/vegamovies/vegamovies.js +2 -44
  154. package/lib/commonjs/providers/movies/vegamovies/vegamovies.js.map +1 -1
  155. package/lib/commonjs/providers/provider-class.js +28 -0
  156. package/lib/commonjs/providers/provider-class.js.map +1 -0
  157. package/lib/commonjs/registry-signing-keys.json +6 -0
  158. package/lib/commonjs/utils/ExtractorManager.js +156 -215
  159. package/lib/commonjs/utils/ExtractorManager.js.map +1 -1
  160. package/lib/commonjs/utils/ProviderManager.js +127 -241
  161. package/lib/commonjs/utils/ProviderManager.js.map +1 -1
  162. package/lib/commonjs/utils/constants.js +3 -9
  163. package/lib/commonjs/utils/constants.js.map +1 -1
  164. package/lib/commonjs/utils/create-extractor-context.js +29 -17
  165. package/lib/commonjs/utils/create-extractor-context.js.map +1 -1
  166. package/lib/commonjs/utils/create-provider-context.js +32 -98
  167. package/lib/commonjs/utils/create-provider-context.js.map +1 -1
  168. package/lib/commonjs/utils/extension-integrity.js +2 -2
  169. package/lib/commonjs/utils/extension-integrity.js.map +1 -1
  170. package/lib/commonjs/utils/extension-modules.js +274 -44
  171. package/lib/commonjs/utils/extension-modules.js.map +1 -1
  172. package/lib/commonjs/utils/fetch-with-timeout.js +3 -2
  173. package/lib/commonjs/utils/fetch-with-timeout.js.map +1 -1
  174. package/lib/commonjs/utils/meta-http.js +18 -28
  175. package/lib/commonjs/utils/meta-http.js.map +1 -1
  176. package/lib/commonjs/utils/registry-schema.js +50 -16
  177. package/lib/commonjs/utils/registry-schema.js.map +1 -1
  178. package/lib/commonjs/utils/registry-signature-format.js +43 -0
  179. package/lib/commonjs/utils/registry-signature-format.js.map +1 -0
  180. package/lib/commonjs/utils/registry-signature.js +27 -62
  181. package/lib/commonjs/utils/registry-signature.js.map +1 -1
  182. package/lib/commonjs/utils/runtime-modules.js +14 -0
  183. package/lib/commonjs/utils/runtime-modules.js.map +1 -0
  184. package/lib/commonjs/utils/tmdb.js +185 -0
  185. package/lib/commonjs/utils/tmdb.js.map +1 -0
  186. package/lib/commonjs/utils/url-polyfill.js +13 -59
  187. package/lib/commonjs/utils/url-polyfill.js.map +1 -1
  188. package/lib/commonjs/utils/utf8.js +52 -0
  189. package/lib/commonjs/utils/utf8.js.map +1 -0
  190. package/lib/commonjs/utils/utils.js +23 -326
  191. package/lib/commonjs/utils/utils.js.map +1 -1
  192. package/lib/module/NativeConsumet.ts +50 -52
  193. package/lib/module/extension-registry.json +48 -188
  194. package/lib/module/extension-registry.json.sig +1 -1
  195. package/lib/module/extractors/file-hosts.js +32 -0
  196. package/lib/module/extractors/file-hosts.js.map +1 -0
  197. package/lib/module/extractors/flixcloud.js +23 -57
  198. package/lib/module/extractors/flixcloud.js.map +1 -1
  199. package/lib/module/extractors/gofile.js +123 -97
  200. package/lib/module/extractors/gofile.js.map +1 -1
  201. package/lib/module/extractors/hls.js +41 -0
  202. package/lib/module/extractors/hls.js.map +1 -0
  203. package/lib/module/extractors/hubcloud.js +132 -288
  204. package/lib/module/extractors/hubcloud.js.map +1 -1
  205. package/lib/module/extractors/index.js +4 -20
  206. package/lib/module/extractors/index.js.map +1 -1
  207. package/lib/module/extractors/kwik.js +16 -49
  208. package/lib/module/extractors/kwik.js.map +1 -1
  209. package/lib/module/extractors/megacloud.js +68 -140
  210. package/lib/module/extractors/megacloud.js.map +1 -1
  211. package/lib/module/extractors/megaplay.js +78 -128
  212. package/lib/module/extractors/megaplay.js.map +1 -1
  213. package/lib/module/extractors/packer.js +36 -0
  214. package/lib/module/extractors/packer.js.map +1 -0
  215. package/lib/module/extractors/streamwish.js +47 -103
  216. package/lib/module/extractors/streamwish.js.map +1 -1
  217. package/lib/module/extractors/url.js +7 -0
  218. package/lib/module/extractors/url.js.map +1 -0
  219. package/lib/module/extractors/vidhide.js +32 -59
  220. package/lib/module/extractors/vidhide.js.map +1 -1
  221. package/lib/module/index.js +20 -49
  222. package/lib/module/index.js.map +1 -1
  223. package/lib/module/models/anime-parser.js +4 -17
  224. package/lib/module/models/anime-parser.js.map +1 -1
  225. package/lib/module/models/base-parser.js.map +1 -1
  226. package/lib/module/models/base-provider.js +6 -33
  227. package/lib/module/models/base-provider.js.map +1 -1
  228. package/lib/module/models/index.js +9 -10
  229. package/lib/module/models/index.js.map +1 -1
  230. package/lib/module/models/lightnovel-parser.js.map +1 -1
  231. package/lib/module/models/manga-parser.js.map +1 -1
  232. package/lib/module/models/meta-error.js +11 -4
  233. package/lib/module/models/meta-error.js.map +1 -1
  234. package/lib/module/models/movie-parser.js.map +1 -1
  235. package/lib/module/models/provider-error.js +49 -0
  236. package/lib/module/models/provider-error.js.map +1 -0
  237. package/lib/module/models/types.js +12 -21
  238. package/lib/module/models/types.js.map +1 -1
  239. package/lib/module/models/video-extractor.js +1 -9
  240. package/lib/module/models/video-extractor.js.map +1 -1
  241. package/lib/module/providers/anime/anikoto/anikoto.js +2 -181
  242. package/lib/module/providers/anime/anikoto/anikoto.js.map +1 -1
  243. package/lib/module/providers/anime/anikoto/create-anikoto.js +320 -436
  244. package/lib/module/providers/anime/anikoto/create-anikoto.js.map +1 -1
  245. package/lib/module/providers/anime/anikoto/hianime.js +69 -0
  246. package/lib/module/providers/anime/anikoto/hianime.js.map +1 -0
  247. package/lib/module/providers/anime/animepahe/animepahe.js +2 -66
  248. package/lib/module/providers/anime/animepahe/animepahe.js.map +1 -1
  249. package/lib/module/providers/anime/animepahe/create-animepahe.js +260 -190
  250. package/lib/module/providers/anime/animepahe/create-animepahe.js.map +1 -1
  251. package/lib/module/providers/anime/helpers.js +12 -0
  252. package/lib/module/providers/anime/helpers.js.map +1 -0
  253. package/lib/module/providers/anime/index.js +1 -13
  254. package/lib/module/providers/anime/index.js.map +1 -1
  255. package/lib/module/providers/anime/reanime/create-reanime.js +40 -60
  256. package/lib/module/providers/anime/reanime/create-reanime.js.map +1 -1
  257. package/lib/module/providers/anime/reanime/reanime.js +2 -26
  258. package/lib/module/providers/anime/reanime/reanime.js.map +1 -1
  259. package/lib/module/providers/common/concurrency.js +34 -0
  260. package/lib/module/providers/common/concurrency.js.map +1 -0
  261. package/lib/module/providers/common/enc-dec.js +5 -0
  262. package/lib/module/providers/common/enc-dec.js.map +1 -0
  263. package/lib/module/providers/common/errors.js +70 -0
  264. package/lib/module/providers/common/errors.js.map +1 -0
  265. package/lib/module/providers/common/media-status.js +17 -0
  266. package/lib/module/providers/common/media-status.js.map +1 -0
  267. package/lib/module/providers/common/search.js +11 -0
  268. package/lib/module/providers/common/search.js.map +1 -0
  269. package/lib/module/providers/common/servers.js +40 -0
  270. package/lib/module/providers/common/servers.js.map +1 -0
  271. package/lib/module/providers/common/ttl-cache.js +54 -0
  272. package/lib/module/providers/common/ttl-cache.js.map +1 -0
  273. package/lib/module/providers/index.js +5 -6
  274. package/lib/module/providers/index.js.map +1 -1
  275. package/lib/module/providers/light-novels/novelupdates.js +51 -99
  276. package/lib/module/providers/light-novels/novelupdates.js.map +1 -1
  277. package/lib/module/providers/light-novels/readlightnovels.js +52 -93
  278. package/lib/module/providers/light-novels/readlightnovels.js.map +1 -1
  279. package/lib/module/providers/manga/asurascans.js +43 -56
  280. package/lib/module/providers/manga/asurascans.js.map +1 -1
  281. package/lib/module/providers/manga/flamescans.js +12 -34
  282. package/lib/module/providers/manga/flamescans.js.map +1 -1
  283. package/lib/module/providers/manga/mangadex.js +19 -18
  284. package/lib/module/providers/manga/mangadex.js.map +1 -1
  285. package/lib/module/providers/manga/mangahere.js +108 -170
  286. package/lib/module/providers/manga/mangahere.js.map +1 -1
  287. package/lib/module/providers/manga/mangakakalot.js +27 -57
  288. package/lib/module/providers/manga/mangakakalot.js.map +1 -1
  289. package/lib/module/providers/manga/mangapill.js +83 -122
  290. package/lib/module/providers/manga/mangapill.js.map +1 -1
  291. package/lib/module/providers/manga/shared.js +63 -0
  292. package/lib/module/providers/manga/shared.js.map +1 -0
  293. package/lib/module/providers/meta/anilist-media.js +239 -0
  294. package/lib/module/providers/meta/anilist-media.js.map +1 -0
  295. package/lib/module/providers/meta/anilist.js +429 -837
  296. package/lib/module/providers/meta/anilist.js.map +1 -1
  297. package/lib/module/providers/meta/index.js +1 -1
  298. package/lib/module/providers/meta/index.js.map +1 -1
  299. package/lib/module/providers/meta/mal.js +136 -322
  300. package/lib/module/providers/meta/mal.js.map +1 -1
  301. package/lib/module/providers/meta/shared.js +124 -0
  302. package/lib/module/providers/meta/shared.js.map +1 -0
  303. package/lib/module/providers/meta/tmdb.js +251 -299
  304. package/lib/module/providers/meta/tmdb.js.map +1 -1
  305. package/lib/module/providers/movies/index.js +5 -13
  306. package/lib/module/providers/movies/index.js.map +1 -1
  307. package/lib/module/providers/movies/multimovies/create-multimovies.js +218 -409
  308. package/lib/module/providers/movies/multimovies/create-multimovies.js.map +1 -1
  309. package/lib/module/providers/movies/multimovies/multimovies.js +2 -42
  310. package/lib/module/providers/movies/multimovies/multimovies.js.map +1 -1
  311. package/lib/module/providers/movies/multistream/create-multistream.js +127 -0
  312. package/lib/module/providers/movies/multistream/create-multistream.js.map +1 -0
  313. package/lib/module/providers/movies/multistream/multistream.js +9 -0
  314. package/lib/module/providers/movies/multistream/multistream.js.map +1 -0
  315. package/lib/module/providers/movies/multistream/utils.js +325 -397
  316. package/lib/module/providers/movies/multistream/utils.js.map +1 -1
  317. package/lib/module/providers/movies/netflixmirror/create-netflixmirror.js +69 -15
  318. package/lib/module/providers/movies/netflixmirror/create-netflixmirror.js.map +1 -1
  319. package/lib/module/providers/movies/netflixmirror/netflixmirror.js +6 -14
  320. package/lib/module/providers/movies/netflixmirror/netflixmirror.js.map +1 -1
  321. package/lib/module/providers/movies/site-paths.js +28 -0
  322. package/lib/module/providers/movies/site-paths.js.map +1 -0
  323. package/lib/module/providers/movies/vegamovies/create-vegamovies.js +474 -654
  324. package/lib/module/providers/movies/vegamovies/create-vegamovies.js.map +1 -1
  325. package/lib/module/providers/movies/vegamovies/vegamovies.js +2 -44
  326. package/lib/module/providers/movies/vegamovies/vegamovies.js.map +1 -1
  327. package/lib/module/providers/provider-class.js +25 -0
  328. package/lib/module/providers/provider-class.js.map +1 -0
  329. package/lib/module/registry-signing-keys.json +6 -0
  330. package/lib/module/utils/ExtractorManager.js +155 -215
  331. package/lib/module/utils/ExtractorManager.js.map +1 -1
  332. package/lib/module/utils/ProviderManager.js +128 -241
  333. package/lib/module/utils/ProviderManager.js.map +1 -1
  334. package/lib/module/utils/constants.js +2 -8
  335. package/lib/module/utils/constants.js.map +1 -1
  336. package/lib/module/utils/create-extractor-context.js +28 -18
  337. package/lib/module/utils/create-extractor-context.js.map +1 -1
  338. package/lib/module/utils/create-provider-context.js +33 -98
  339. package/lib/module/utils/create-provider-context.js.map +1 -1
  340. package/lib/module/utils/extension-integrity.js +1 -1
  341. package/lib/module/utils/extension-integrity.js.map +1 -1
  342. package/lib/module/utils/extension-modules.js +270 -44
  343. package/lib/module/utils/extension-modules.js.map +1 -1
  344. package/lib/module/utils/fetch-with-timeout.js +3 -2
  345. package/lib/module/utils/fetch-with-timeout.js.map +1 -1
  346. package/lib/module/utils/meta-http.js +17 -26
  347. package/lib/module/utils/meta-http.js.map +1 -1
  348. package/lib/module/utils/registry-schema.js +48 -15
  349. package/lib/module/utils/registry-schema.js.map +1 -1
  350. package/lib/module/utils/registry-signature-format.js +37 -0
  351. package/lib/module/utils/registry-signature-format.js.map +1 -0
  352. package/lib/module/utils/registry-signature.js +23 -58
  353. package/lib/module/utils/registry-signature.js.map +1 -1
  354. package/lib/module/utils/runtime-modules.js +10 -0
  355. package/lib/module/utils/runtime-modules.js.map +1 -0
  356. package/lib/module/utils/tmdb.js +172 -0
  357. package/lib/module/utils/tmdb.js.map +1 -0
  358. package/lib/module/utils/url-polyfill.js +1 -47
  359. package/lib/module/utils/url-polyfill.js.map +1 -1
  360. package/lib/module/utils/utf8.js +45 -0
  361. package/lib/module/utils/utf8.js.map +1 -0
  362. package/lib/module/utils/utils.js +16 -281
  363. package/lib/module/utils/utils.js.map +1 -1
  364. package/lib/typescript/commonjs/src/NativeConsumet.d.ts +44 -79
  365. package/lib/typescript/commonjs/src/NativeConsumet.d.ts.map +1 -1
  366. package/lib/typescript/commonjs/src/extractors/file-hosts.d.ts +18 -0
  367. package/lib/typescript/commonjs/src/extractors/file-hosts.d.ts.map +1 -0
  368. package/lib/typescript/commonjs/src/extractors/flixcloud.d.ts +9 -9
  369. package/lib/typescript/commonjs/src/extractors/flixcloud.d.ts.map +1 -1
  370. package/lib/typescript/commonjs/src/extractors/gofile.d.ts +5 -6
  371. package/lib/typescript/commonjs/src/extractors/gofile.d.ts.map +1 -1
  372. package/lib/typescript/commonjs/src/extractors/hls.d.ts +14 -0
  373. package/lib/typescript/commonjs/src/extractors/hls.d.ts.map +1 -0
  374. package/lib/typescript/commonjs/src/extractors/hubcloud.d.ts +8 -4
  375. package/lib/typescript/commonjs/src/extractors/hubcloud.d.ts.map +1 -1
  376. package/lib/typescript/commonjs/src/extractors/index.d.ts +4 -20
  377. package/lib/typescript/commonjs/src/extractors/index.d.ts.map +1 -1
  378. package/lib/typescript/commonjs/src/extractors/kwik.d.ts +6 -7
  379. package/lib/typescript/commonjs/src/extractors/kwik.d.ts.map +1 -1
  380. package/lib/typescript/commonjs/src/extractors/megacloud.d.ts +7 -5
  381. package/lib/typescript/commonjs/src/extractors/megacloud.d.ts.map +1 -1
  382. package/lib/typescript/commonjs/src/extractors/megaplay.d.ts +6 -7
  383. package/lib/typescript/commonjs/src/extractors/megaplay.d.ts.map +1 -1
  384. package/lib/typescript/commonjs/src/extractors/packer.d.ts +3 -0
  385. package/lib/typescript/commonjs/src/extractors/packer.d.ts.map +1 -0
  386. package/lib/typescript/commonjs/src/extractors/streamwish.d.ts +5 -7
  387. package/lib/typescript/commonjs/src/extractors/streamwish.d.ts.map +1 -1
  388. package/lib/typescript/commonjs/src/extractors/url.d.ts +4 -0
  389. package/lib/typescript/commonjs/src/extractors/url.d.ts.map +1 -0
  390. package/lib/typescript/commonjs/src/extractors/vidhide.d.ts +5 -7
  391. package/lib/typescript/commonjs/src/extractors/vidhide.d.ts.map +1 -1
  392. package/lib/typescript/commonjs/src/index.d.ts +17 -20
  393. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  394. package/lib/typescript/commonjs/src/models/anime-parser.d.ts +10 -21
  395. package/lib/typescript/commonjs/src/models/anime-parser.d.ts.map +1 -1
  396. package/lib/typescript/commonjs/src/models/base-parser.d.ts +0 -5
  397. package/lib/typescript/commonjs/src/models/base-parser.d.ts.map +1 -1
  398. package/lib/typescript/commonjs/src/models/base-provider.d.ts +7 -31
  399. package/lib/typescript/commonjs/src/models/base-provider.d.ts.map +1 -1
  400. package/lib/typescript/commonjs/src/models/extension-manifest.d.ts +5 -1
  401. package/lib/typescript/commonjs/src/models/extension-manifest.d.ts.map +1 -1
  402. package/lib/typescript/commonjs/src/models/extractor-context.d.ts +5 -34
  403. package/lib/typescript/commonjs/src/models/extractor-context.d.ts.map +1 -1
  404. package/lib/typescript/commonjs/src/models/index.d.ts +13 -15
  405. package/lib/typescript/commonjs/src/models/index.d.ts.map +1 -1
  406. package/lib/typescript/commonjs/src/models/lightnovel-parser.d.ts +5 -12
  407. package/lib/typescript/commonjs/src/models/lightnovel-parser.d.ts.map +1 -1
  408. package/lib/typescript/commonjs/src/models/manga-parser.d.ts +2 -10
  409. package/lib/typescript/commonjs/src/models/manga-parser.d.ts.map +1 -1
  410. package/lib/typescript/commonjs/src/models/meta-error.d.ts +9 -3
  411. package/lib/typescript/commonjs/src/models/meta-error.d.ts.map +1 -1
  412. package/lib/typescript/commonjs/src/models/movie-parser.d.ts +8 -24
  413. package/lib/typescript/commonjs/src/models/movie-parser.d.ts.map +1 -1
  414. package/lib/typescript/commonjs/src/models/provider-context.d.ts +11 -138
  415. package/lib/typescript/commonjs/src/models/provider-context.d.ts.map +1 -1
  416. package/lib/typescript/commonjs/src/models/provider-error.d.ts +32 -0
  417. package/lib/typescript/commonjs/src/models/provider-error.d.ts.map +1 -0
  418. package/lib/typescript/commonjs/src/models/types.d.ts +43 -39
  419. package/lib/typescript/commonjs/src/models/types.d.ts.map +1 -1
  420. package/lib/typescript/commonjs/src/models/video-extractor.d.ts +7 -38
  421. package/lib/typescript/commonjs/src/models/video-extractor.d.ts.map +1 -1
  422. package/lib/typescript/commonjs/src/providers/anime/anikoto/anikoto.d.ts +4 -148
  423. package/lib/typescript/commonjs/src/providers/anime/anikoto/anikoto.d.ts.map +1 -1
  424. package/lib/typescript/commonjs/src/providers/anime/anikoto/create-anikoto.d.ts +2 -2
  425. package/lib/typescript/commonjs/src/providers/anime/anikoto/create-anikoto.d.ts.map +1 -1
  426. package/lib/typescript/commonjs/src/providers/anime/anikoto/hianime.d.ts +24 -0
  427. package/lib/typescript/commonjs/src/providers/anime/anikoto/hianime.d.ts.map +1 -0
  428. package/lib/typescript/commonjs/src/providers/anime/animepahe/animepahe.d.ts +4 -40
  429. package/lib/typescript/commonjs/src/providers/anime/animepahe/animepahe.d.ts.map +1 -1
  430. package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts +4 -4
  431. package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
  432. package/lib/typescript/commonjs/src/providers/anime/helpers.d.ts +6 -0
  433. package/lib/typescript/commonjs/src/providers/anime/helpers.d.ts.map +1 -0
  434. package/lib/typescript/commonjs/src/providers/anime/index.d.ts +3 -18
  435. package/lib/typescript/commonjs/src/providers/anime/index.d.ts.map +1 -1
  436. package/lib/typescript/commonjs/src/providers/anime/reanime/create-reanime.d.ts +2 -2
  437. package/lib/typescript/commonjs/src/providers/anime/reanime/create-reanime.d.ts.map +1 -1
  438. package/lib/typescript/commonjs/src/providers/anime/reanime/reanime.d.ts +4 -23
  439. package/lib/typescript/commonjs/src/providers/anime/reanime/reanime.d.ts.map +1 -1
  440. package/lib/typescript/commonjs/src/providers/common/concurrency.d.ts +8 -0
  441. package/lib/typescript/commonjs/src/providers/common/concurrency.d.ts.map +1 -0
  442. package/lib/typescript/commonjs/src/providers/common/enc-dec.d.ts +3 -0
  443. package/lib/typescript/commonjs/src/providers/common/enc-dec.d.ts.map +1 -0
  444. package/lib/typescript/commonjs/src/providers/common/errors.d.ts +36 -0
  445. package/lib/typescript/commonjs/src/providers/common/errors.d.ts.map +1 -0
  446. package/lib/typescript/commonjs/src/providers/common/media-status.d.ts +7 -0
  447. package/lib/typescript/commonjs/src/providers/common/media-status.d.ts.map +1 -0
  448. package/lib/typescript/commonjs/src/providers/common/search.d.ts +4 -0
  449. package/lib/typescript/commonjs/src/providers/common/search.d.ts.map +1 -0
  450. package/lib/typescript/commonjs/src/providers/common/servers.d.ts +17 -0
  451. package/lib/typescript/commonjs/src/providers/common/servers.d.ts.map +1 -0
  452. package/lib/typescript/commonjs/src/providers/common/ttl-cache.d.ts +21 -0
  453. package/lib/typescript/commonjs/src/providers/common/ttl-cache.d.ts.map +1 -0
  454. package/lib/typescript/commonjs/src/providers/index.d.ts +5 -6
  455. package/lib/typescript/commonjs/src/providers/index.d.ts.map +1 -1
  456. package/lib/typescript/commonjs/src/providers/light-novels/novelupdates.d.ts +11 -12
  457. package/lib/typescript/commonjs/src/providers/light-novels/novelupdates.d.ts.map +1 -1
  458. package/lib/typescript/commonjs/src/providers/light-novels/readlightnovels.d.ts +3 -11
  459. package/lib/typescript/commonjs/src/providers/light-novels/readlightnovels.d.ts.map +1 -1
  460. package/lib/typescript/commonjs/src/providers/manga/asurascans.d.ts +1 -5
  461. package/lib/typescript/commonjs/src/providers/manga/asurascans.d.ts.map +1 -1
  462. package/lib/typescript/commonjs/src/providers/manga/flamescans.d.ts +2 -4
  463. package/lib/typescript/commonjs/src/providers/manga/flamescans.d.ts.map +1 -1
  464. package/lib/typescript/commonjs/src/providers/manga/mangadex.d.ts +6 -4
  465. package/lib/typescript/commonjs/src/providers/manga/mangadex.d.ts.map +1 -1
  466. package/lib/typescript/commonjs/src/providers/manga/mangahere.d.ts +4 -4
  467. package/lib/typescript/commonjs/src/providers/manga/mangahere.d.ts.map +1 -1
  468. package/lib/typescript/commonjs/src/providers/manga/mangakakalot.d.ts +4 -13
  469. package/lib/typescript/commonjs/src/providers/manga/mangakakalot.d.ts.map +1 -1
  470. package/lib/typescript/commonjs/src/providers/manga/mangapill.d.ts +1 -8
  471. package/lib/typescript/commonjs/src/providers/manga/mangapill.d.ts.map +1 -1
  472. package/lib/typescript/commonjs/src/providers/manga/shared.d.ts +28 -0
  473. package/lib/typescript/commonjs/src/providers/manga/shared.d.ts.map +1 -0
  474. package/lib/typescript/commonjs/src/providers/meta/anilist-media.d.ts +188 -0
  475. package/lib/typescript/commonjs/src/providers/meta/anilist-media.d.ts.map +1 -0
  476. package/lib/typescript/commonjs/src/providers/meta/anilist.d.ts +90 -131
  477. package/lib/typescript/commonjs/src/providers/meta/anilist.d.ts.map +1 -1
  478. package/lib/typescript/commonjs/src/providers/meta/index.d.ts +1 -2
  479. package/lib/typescript/commonjs/src/providers/meta/index.d.ts.map +1 -1
  480. package/lib/typescript/commonjs/src/providers/meta/mal.d.ts +12 -18
  481. package/lib/typescript/commonjs/src/providers/meta/mal.d.ts.map +1 -1
  482. package/lib/typescript/commonjs/src/providers/meta/shared.d.ts +48 -0
  483. package/lib/typescript/commonjs/src/providers/meta/shared.d.ts.map +1 -0
  484. package/lib/typescript/commonjs/src/providers/meta/tmdb.d.ts +77 -26
  485. package/lib/typescript/commonjs/src/providers/meta/tmdb.d.ts.map +1 -1
  486. package/lib/typescript/commonjs/src/providers/movies/index.d.ts +8 -20
  487. package/lib/typescript/commonjs/src/providers/movies/index.d.ts.map +1 -1
  488. package/lib/typescript/commonjs/src/providers/movies/multimovies/create-multimovies.d.ts +8 -3
  489. package/lib/typescript/commonjs/src/providers/movies/multimovies/create-multimovies.d.ts.map +1 -1
  490. package/lib/typescript/commonjs/src/providers/movies/multimovies/multimovies.d.ts +4 -25
  491. package/lib/typescript/commonjs/src/providers/movies/multimovies/multimovies.d.ts.map +1 -1
  492. package/lib/typescript/commonjs/src/providers/movies/multistream/create-multistream.d.ts +26 -0
  493. package/lib/typescript/commonjs/src/providers/movies/multistream/create-multistream.d.ts.map +1 -0
  494. package/lib/typescript/commonjs/src/providers/movies/multistream/multistream.d.ts +6 -0
  495. package/lib/typescript/commonjs/src/providers/movies/multistream/multistream.d.ts.map +1 -0
  496. package/lib/typescript/commonjs/src/providers/movies/multistream/utils.d.ts +21 -19
  497. package/lib/typescript/commonjs/src/providers/movies/multistream/utils.d.ts.map +1 -1
  498. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/create-netflixmirror.d.ts +40 -8
  499. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/create-netflixmirror.d.ts.map +1 -1
  500. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/netflixmirror.d.ts +8 -11
  501. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/netflixmirror.d.ts.map +1 -1
  502. package/lib/typescript/commonjs/src/providers/movies/site-paths.d.ts +12 -0
  503. package/lib/typescript/commonjs/src/providers/movies/site-paths.d.ts.map +1 -0
  504. package/lib/typescript/commonjs/src/providers/movies/vegamovies/create-vegamovies.d.ts +9 -3
  505. package/lib/typescript/commonjs/src/providers/movies/vegamovies/create-vegamovies.d.ts.map +1 -1
  506. package/lib/typescript/commonjs/src/providers/movies/vegamovies/vegamovies.d.ts +4 -27
  507. package/lib/typescript/commonjs/src/providers/movies/vegamovies/vegamovies.d.ts.map +1 -1
  508. package/lib/typescript/commonjs/src/providers/provider-class.d.ts +23 -0
  509. package/lib/typescript/commonjs/src/providers/provider-class.d.ts.map +1 -0
  510. package/lib/typescript/commonjs/src/utils/ExtractorManager.d.ts +57 -49
  511. package/lib/typescript/commonjs/src/utils/ExtractorManager.d.ts.map +1 -1
  512. package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts +50 -69
  513. package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts.map +1 -1
  514. package/lib/typescript/commonjs/src/utils/constants.d.ts +2 -7
  515. package/lib/typescript/commonjs/src/utils/constants.d.ts.map +1 -1
  516. package/lib/typescript/commonjs/src/utils/create-extractor-context.d.ts +17 -5
  517. package/lib/typescript/commonjs/src/utils/create-extractor-context.d.ts.map +1 -1
  518. package/lib/typescript/commonjs/src/utils/create-provider-context.d.ts +12 -8
  519. package/lib/typescript/commonjs/src/utils/create-provider-context.d.ts.map +1 -1
  520. package/lib/typescript/commonjs/src/utils/extension-integrity.d.ts.map +1 -1
  521. package/lib/typescript/commonjs/src/utils/extension-modules.d.ts +74 -24
  522. package/lib/typescript/commonjs/src/utils/extension-modules.d.ts.map +1 -1
  523. package/lib/typescript/commonjs/src/utils/fetch-with-timeout.d.ts +1 -1
  524. package/lib/typescript/commonjs/src/utils/fetch-with-timeout.d.ts.map +1 -1
  525. package/lib/typescript/commonjs/src/utils/meta-http.d.ts +2 -13
  526. package/lib/typescript/commonjs/src/utils/meta-http.d.ts.map +1 -1
  527. package/lib/typescript/commonjs/src/utils/registry-schema.d.ts +27 -1
  528. package/lib/typescript/commonjs/src/utils/registry-schema.d.ts.map +1 -1
  529. package/lib/typescript/commonjs/src/utils/registry-signature-format.d.ts +15 -0
  530. package/lib/typescript/commonjs/src/utils/registry-signature-format.d.ts.map +1 -0
  531. package/lib/typescript/commonjs/src/utils/registry-signature.d.ts +10 -4
  532. package/lib/typescript/commonjs/src/utils/registry-signature.d.ts.map +1 -1
  533. package/lib/typescript/commonjs/src/utils/runtime-modules.d.ts +8 -0
  534. package/lib/typescript/commonjs/src/utils/runtime-modules.d.ts.map +1 -0
  535. package/lib/typescript/commonjs/src/utils/tmdb.d.ts +86 -0
  536. package/lib/typescript/commonjs/src/utils/tmdb.d.ts.map +1 -0
  537. package/lib/typescript/commonjs/src/utils/url-polyfill.d.ts.map +1 -1
  538. package/lib/typescript/commonjs/src/utils/utf8.d.ts +7 -0
  539. package/lib/typescript/commonjs/src/utils/utf8.d.ts.map +1 -0
  540. package/lib/typescript/commonjs/src/utils/utils.d.ts +12 -36
  541. package/lib/typescript/commonjs/src/utils/utils.d.ts.map +1 -1
  542. package/lib/typescript/module/src/NativeConsumet.d.ts +44 -79
  543. package/lib/typescript/module/src/NativeConsumet.d.ts.map +1 -1
  544. package/lib/typescript/module/src/extractors/file-hosts.d.ts +18 -0
  545. package/lib/typescript/module/src/extractors/file-hosts.d.ts.map +1 -0
  546. package/lib/typescript/module/src/extractors/flixcloud.d.ts +9 -9
  547. package/lib/typescript/module/src/extractors/flixcloud.d.ts.map +1 -1
  548. package/lib/typescript/module/src/extractors/gofile.d.ts +5 -6
  549. package/lib/typescript/module/src/extractors/gofile.d.ts.map +1 -1
  550. package/lib/typescript/module/src/extractors/hls.d.ts +14 -0
  551. package/lib/typescript/module/src/extractors/hls.d.ts.map +1 -0
  552. package/lib/typescript/module/src/extractors/hubcloud.d.ts +8 -4
  553. package/lib/typescript/module/src/extractors/hubcloud.d.ts.map +1 -1
  554. package/lib/typescript/module/src/extractors/index.d.ts +4 -20
  555. package/lib/typescript/module/src/extractors/index.d.ts.map +1 -1
  556. package/lib/typescript/module/src/extractors/kwik.d.ts +6 -7
  557. package/lib/typescript/module/src/extractors/kwik.d.ts.map +1 -1
  558. package/lib/typescript/module/src/extractors/megacloud.d.ts +7 -5
  559. package/lib/typescript/module/src/extractors/megacloud.d.ts.map +1 -1
  560. package/lib/typescript/module/src/extractors/megaplay.d.ts +6 -7
  561. package/lib/typescript/module/src/extractors/megaplay.d.ts.map +1 -1
  562. package/lib/typescript/module/src/extractors/packer.d.ts +3 -0
  563. package/lib/typescript/module/src/extractors/packer.d.ts.map +1 -0
  564. package/lib/typescript/module/src/extractors/streamwish.d.ts +5 -7
  565. package/lib/typescript/module/src/extractors/streamwish.d.ts.map +1 -1
  566. package/lib/typescript/module/src/extractors/url.d.ts +4 -0
  567. package/lib/typescript/module/src/extractors/url.d.ts.map +1 -0
  568. package/lib/typescript/module/src/extractors/vidhide.d.ts +5 -7
  569. package/lib/typescript/module/src/extractors/vidhide.d.ts.map +1 -1
  570. package/lib/typescript/module/src/index.d.ts +17 -20
  571. package/lib/typescript/module/src/index.d.ts.map +1 -1
  572. package/lib/typescript/module/src/models/anime-parser.d.ts +10 -21
  573. package/lib/typescript/module/src/models/anime-parser.d.ts.map +1 -1
  574. package/lib/typescript/module/src/models/base-parser.d.ts +0 -5
  575. package/lib/typescript/module/src/models/base-parser.d.ts.map +1 -1
  576. package/lib/typescript/module/src/models/base-provider.d.ts +7 -31
  577. package/lib/typescript/module/src/models/base-provider.d.ts.map +1 -1
  578. package/lib/typescript/module/src/models/extension-manifest.d.ts +5 -1
  579. package/lib/typescript/module/src/models/extension-manifest.d.ts.map +1 -1
  580. package/lib/typescript/module/src/models/extractor-context.d.ts +5 -34
  581. package/lib/typescript/module/src/models/extractor-context.d.ts.map +1 -1
  582. package/lib/typescript/module/src/models/index.d.ts +13 -15
  583. package/lib/typescript/module/src/models/index.d.ts.map +1 -1
  584. package/lib/typescript/module/src/models/lightnovel-parser.d.ts +5 -12
  585. package/lib/typescript/module/src/models/lightnovel-parser.d.ts.map +1 -1
  586. package/lib/typescript/module/src/models/manga-parser.d.ts +2 -10
  587. package/lib/typescript/module/src/models/manga-parser.d.ts.map +1 -1
  588. package/lib/typescript/module/src/models/meta-error.d.ts +9 -3
  589. package/lib/typescript/module/src/models/meta-error.d.ts.map +1 -1
  590. package/lib/typescript/module/src/models/movie-parser.d.ts +8 -24
  591. package/lib/typescript/module/src/models/movie-parser.d.ts.map +1 -1
  592. package/lib/typescript/module/src/models/provider-context.d.ts +11 -138
  593. package/lib/typescript/module/src/models/provider-context.d.ts.map +1 -1
  594. package/lib/typescript/module/src/models/provider-error.d.ts +32 -0
  595. package/lib/typescript/module/src/models/provider-error.d.ts.map +1 -0
  596. package/lib/typescript/module/src/models/types.d.ts +43 -39
  597. package/lib/typescript/module/src/models/types.d.ts.map +1 -1
  598. package/lib/typescript/module/src/models/video-extractor.d.ts +7 -38
  599. package/lib/typescript/module/src/models/video-extractor.d.ts.map +1 -1
  600. package/lib/typescript/module/src/providers/anime/anikoto/anikoto.d.ts +4 -148
  601. package/lib/typescript/module/src/providers/anime/anikoto/anikoto.d.ts.map +1 -1
  602. package/lib/typescript/module/src/providers/anime/anikoto/create-anikoto.d.ts +2 -2
  603. package/lib/typescript/module/src/providers/anime/anikoto/create-anikoto.d.ts.map +1 -1
  604. package/lib/typescript/module/src/providers/anime/anikoto/hianime.d.ts +24 -0
  605. package/lib/typescript/module/src/providers/anime/anikoto/hianime.d.ts.map +1 -0
  606. package/lib/typescript/module/src/providers/anime/animepahe/animepahe.d.ts +4 -40
  607. package/lib/typescript/module/src/providers/anime/animepahe/animepahe.d.ts.map +1 -1
  608. package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts +4 -4
  609. package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
  610. package/lib/typescript/module/src/providers/anime/helpers.d.ts +6 -0
  611. package/lib/typescript/module/src/providers/anime/helpers.d.ts.map +1 -0
  612. package/lib/typescript/module/src/providers/anime/index.d.ts +3 -18
  613. package/lib/typescript/module/src/providers/anime/index.d.ts.map +1 -1
  614. package/lib/typescript/module/src/providers/anime/reanime/create-reanime.d.ts +2 -2
  615. package/lib/typescript/module/src/providers/anime/reanime/create-reanime.d.ts.map +1 -1
  616. package/lib/typescript/module/src/providers/anime/reanime/reanime.d.ts +4 -23
  617. package/lib/typescript/module/src/providers/anime/reanime/reanime.d.ts.map +1 -1
  618. package/lib/typescript/module/src/providers/common/concurrency.d.ts +8 -0
  619. package/lib/typescript/module/src/providers/common/concurrency.d.ts.map +1 -0
  620. package/lib/typescript/module/src/providers/common/enc-dec.d.ts +3 -0
  621. package/lib/typescript/module/src/providers/common/enc-dec.d.ts.map +1 -0
  622. package/lib/typescript/module/src/providers/common/errors.d.ts +36 -0
  623. package/lib/typescript/module/src/providers/common/errors.d.ts.map +1 -0
  624. package/lib/typescript/module/src/providers/common/media-status.d.ts +7 -0
  625. package/lib/typescript/module/src/providers/common/media-status.d.ts.map +1 -0
  626. package/lib/typescript/module/src/providers/common/search.d.ts +4 -0
  627. package/lib/typescript/module/src/providers/common/search.d.ts.map +1 -0
  628. package/lib/typescript/module/src/providers/common/servers.d.ts +17 -0
  629. package/lib/typescript/module/src/providers/common/servers.d.ts.map +1 -0
  630. package/lib/typescript/module/src/providers/common/ttl-cache.d.ts +21 -0
  631. package/lib/typescript/module/src/providers/common/ttl-cache.d.ts.map +1 -0
  632. package/lib/typescript/module/src/providers/index.d.ts +5 -6
  633. package/lib/typescript/module/src/providers/index.d.ts.map +1 -1
  634. package/lib/typescript/module/src/providers/light-novels/novelupdates.d.ts +11 -12
  635. package/lib/typescript/module/src/providers/light-novels/novelupdates.d.ts.map +1 -1
  636. package/lib/typescript/module/src/providers/light-novels/readlightnovels.d.ts +3 -11
  637. package/lib/typescript/module/src/providers/light-novels/readlightnovels.d.ts.map +1 -1
  638. package/lib/typescript/module/src/providers/manga/asurascans.d.ts +1 -5
  639. package/lib/typescript/module/src/providers/manga/asurascans.d.ts.map +1 -1
  640. package/lib/typescript/module/src/providers/manga/flamescans.d.ts +2 -4
  641. package/lib/typescript/module/src/providers/manga/flamescans.d.ts.map +1 -1
  642. package/lib/typescript/module/src/providers/manga/mangadex.d.ts +6 -4
  643. package/lib/typescript/module/src/providers/manga/mangadex.d.ts.map +1 -1
  644. package/lib/typescript/module/src/providers/manga/mangahere.d.ts +4 -4
  645. package/lib/typescript/module/src/providers/manga/mangahere.d.ts.map +1 -1
  646. package/lib/typescript/module/src/providers/manga/mangakakalot.d.ts +4 -13
  647. package/lib/typescript/module/src/providers/manga/mangakakalot.d.ts.map +1 -1
  648. package/lib/typescript/module/src/providers/manga/mangapill.d.ts +1 -8
  649. package/lib/typescript/module/src/providers/manga/mangapill.d.ts.map +1 -1
  650. package/lib/typescript/module/src/providers/manga/shared.d.ts +28 -0
  651. package/lib/typescript/module/src/providers/manga/shared.d.ts.map +1 -0
  652. package/lib/typescript/module/src/providers/meta/anilist-media.d.ts +188 -0
  653. package/lib/typescript/module/src/providers/meta/anilist-media.d.ts.map +1 -0
  654. package/lib/typescript/module/src/providers/meta/anilist.d.ts +90 -131
  655. package/lib/typescript/module/src/providers/meta/anilist.d.ts.map +1 -1
  656. package/lib/typescript/module/src/providers/meta/index.d.ts +1 -2
  657. package/lib/typescript/module/src/providers/meta/index.d.ts.map +1 -1
  658. package/lib/typescript/module/src/providers/meta/mal.d.ts +12 -18
  659. package/lib/typescript/module/src/providers/meta/mal.d.ts.map +1 -1
  660. package/lib/typescript/module/src/providers/meta/shared.d.ts +48 -0
  661. package/lib/typescript/module/src/providers/meta/shared.d.ts.map +1 -0
  662. package/lib/typescript/module/src/providers/meta/tmdb.d.ts +77 -26
  663. package/lib/typescript/module/src/providers/meta/tmdb.d.ts.map +1 -1
  664. package/lib/typescript/module/src/providers/movies/index.d.ts +8 -20
  665. package/lib/typescript/module/src/providers/movies/index.d.ts.map +1 -1
  666. package/lib/typescript/module/src/providers/movies/multimovies/create-multimovies.d.ts +8 -3
  667. package/lib/typescript/module/src/providers/movies/multimovies/create-multimovies.d.ts.map +1 -1
  668. package/lib/typescript/module/src/providers/movies/multimovies/multimovies.d.ts +4 -25
  669. package/lib/typescript/module/src/providers/movies/multimovies/multimovies.d.ts.map +1 -1
  670. package/lib/typescript/module/src/providers/movies/multistream/create-multistream.d.ts +26 -0
  671. package/lib/typescript/module/src/providers/movies/multistream/create-multistream.d.ts.map +1 -0
  672. package/lib/typescript/module/src/providers/movies/multistream/multistream.d.ts +6 -0
  673. package/lib/typescript/module/src/providers/movies/multistream/multistream.d.ts.map +1 -0
  674. package/lib/typescript/module/src/providers/movies/multistream/utils.d.ts +21 -19
  675. package/lib/typescript/module/src/providers/movies/multistream/utils.d.ts.map +1 -1
  676. package/lib/typescript/module/src/providers/movies/netflixmirror/create-netflixmirror.d.ts +40 -8
  677. package/lib/typescript/module/src/providers/movies/netflixmirror/create-netflixmirror.d.ts.map +1 -1
  678. package/lib/typescript/module/src/providers/movies/netflixmirror/netflixmirror.d.ts +8 -11
  679. package/lib/typescript/module/src/providers/movies/netflixmirror/netflixmirror.d.ts.map +1 -1
  680. package/lib/typescript/module/src/providers/movies/site-paths.d.ts +12 -0
  681. package/lib/typescript/module/src/providers/movies/site-paths.d.ts.map +1 -0
  682. package/lib/typescript/module/src/providers/movies/vegamovies/create-vegamovies.d.ts +9 -3
  683. package/lib/typescript/module/src/providers/movies/vegamovies/create-vegamovies.d.ts.map +1 -1
  684. package/lib/typescript/module/src/providers/movies/vegamovies/vegamovies.d.ts +4 -27
  685. package/lib/typescript/module/src/providers/movies/vegamovies/vegamovies.d.ts.map +1 -1
  686. package/lib/typescript/module/src/providers/provider-class.d.ts +23 -0
  687. package/lib/typescript/module/src/providers/provider-class.d.ts.map +1 -0
  688. package/lib/typescript/module/src/utils/ExtractorManager.d.ts +57 -49
  689. package/lib/typescript/module/src/utils/ExtractorManager.d.ts.map +1 -1
  690. package/lib/typescript/module/src/utils/ProviderManager.d.ts +50 -69
  691. package/lib/typescript/module/src/utils/ProviderManager.d.ts.map +1 -1
  692. package/lib/typescript/module/src/utils/constants.d.ts +2 -7
  693. package/lib/typescript/module/src/utils/constants.d.ts.map +1 -1
  694. package/lib/typescript/module/src/utils/create-extractor-context.d.ts +17 -5
  695. package/lib/typescript/module/src/utils/create-extractor-context.d.ts.map +1 -1
  696. package/lib/typescript/module/src/utils/create-provider-context.d.ts +12 -8
  697. package/lib/typescript/module/src/utils/create-provider-context.d.ts.map +1 -1
  698. package/lib/typescript/module/src/utils/extension-integrity.d.ts.map +1 -1
  699. package/lib/typescript/module/src/utils/extension-modules.d.ts +74 -24
  700. package/lib/typescript/module/src/utils/extension-modules.d.ts.map +1 -1
  701. package/lib/typescript/module/src/utils/fetch-with-timeout.d.ts +1 -1
  702. package/lib/typescript/module/src/utils/fetch-with-timeout.d.ts.map +1 -1
  703. package/lib/typescript/module/src/utils/meta-http.d.ts +2 -13
  704. package/lib/typescript/module/src/utils/meta-http.d.ts.map +1 -1
  705. package/lib/typescript/module/src/utils/registry-schema.d.ts +27 -1
  706. package/lib/typescript/module/src/utils/registry-schema.d.ts.map +1 -1
  707. package/lib/typescript/module/src/utils/registry-signature-format.d.ts +15 -0
  708. package/lib/typescript/module/src/utils/registry-signature-format.d.ts.map +1 -0
  709. package/lib/typescript/module/src/utils/registry-signature.d.ts +10 -4
  710. package/lib/typescript/module/src/utils/registry-signature.d.ts.map +1 -1
  711. package/lib/typescript/module/src/utils/runtime-modules.d.ts +8 -0
  712. package/lib/typescript/module/src/utils/runtime-modules.d.ts.map +1 -0
  713. package/lib/typescript/module/src/utils/tmdb.d.ts +86 -0
  714. package/lib/typescript/module/src/utils/tmdb.d.ts.map +1 -0
  715. package/lib/typescript/module/src/utils/url-polyfill.d.ts.map +1 -1
  716. package/lib/typescript/module/src/utils/utf8.d.ts +7 -0
  717. package/lib/typescript/module/src/utils/utf8.d.ts.map +1 -0
  718. package/lib/typescript/module/src/utils/utils.d.ts +12 -36
  719. package/lib/typescript/module/src/utils/utils.d.ts.map +1 -1
  720. package/package.json +8 -10
  721. package/src/NativeConsumet.ts +50 -52
  722. package/src/extension-registry.json +48 -188
  723. package/src/extension-registry.json.sig +1 -1
  724. package/src/extractors/file-hosts.ts +29 -0
  725. package/src/extractors/flixcloud.ts +23 -53
  726. package/src/extractors/gofile.ts +140 -128
  727. package/src/extractors/hls.ts +43 -0
  728. package/src/extractors/hubcloud.ts +147 -331
  729. package/src/extractors/index.ts +4 -20
  730. package/src/extractors/kwik.ts +17 -56
  731. package/src/extractors/megacloud.ts +50 -153
  732. package/src/extractors/megaplay.ts +77 -147
  733. package/src/extractors/packer.ts +40 -0
  734. package/src/extractors/streamwish.ts +50 -122
  735. package/src/extractors/url.ts +6 -0
  736. package/src/extractors/vidhide.ts +29 -81
  737. package/src/index.tsx +51 -228
  738. package/src/models/anime-parser.ts +12 -21
  739. package/src/models/base-parser.ts +0 -5
  740. package/src/models/base-provider.ts +7 -31
  741. package/src/models/extension-manifest.ts +7 -1
  742. package/src/models/extractor-context.ts +5 -46
  743. package/src/models/index.ts +13 -119
  744. package/src/models/lightnovel-parser.ts +5 -12
  745. package/src/models/manga-parser.ts +2 -10
  746. package/src/models/meta-error.ts +12 -5
  747. package/src/models/movie-parser.ts +9 -24
  748. package/src/models/provider-context.ts +11 -149
  749. package/src/models/provider-error.ts +57 -0
  750. package/src/models/types.ts +40 -41
  751. package/src/models/video-extractor.ts +7 -43
  752. package/src/providers/anime/anikoto/anikoto.ts +5 -218
  753. package/src/providers/anime/anikoto/create-anikoto.ts +321 -510
  754. package/src/providers/anime/anikoto/hianime.ts +67 -0
  755. package/src/providers/anime/animepahe/animepahe.ts +5 -78
  756. package/src/providers/anime/animepahe/create-animepahe.ts +253 -212
  757. package/src/providers/anime/helpers.ts +9 -0
  758. package/src/providers/anime/index.ts +0 -12
  759. package/src/providers/anime/reanime/create-reanime.ts +37 -62
  760. package/src/providers/anime/reanime/reanime.ts +5 -44
  761. package/src/providers/common/concurrency.ts +32 -0
  762. package/src/providers/common/enc-dec.ts +2 -0
  763. package/src/providers/common/errors.ts +84 -0
  764. package/src/providers/common/media-status.ts +20 -0
  765. package/src/providers/common/search.ts +6 -0
  766. package/src/providers/common/servers.ts +40 -0
  767. package/src/providers/common/ttl-cache.ts +65 -0
  768. package/src/providers/index.ts +5 -7
  769. package/src/providers/light-novels/novelupdates.ts +55 -125
  770. package/src/providers/light-novels/readlightnovels.ts +81 -117
  771. package/src/providers/manga/asurascans.ts +46 -64
  772. package/src/providers/manga/flamescans.ts +11 -44
  773. package/src/providers/manga/mangadex.ts +15 -23
  774. package/src/providers/manga/mangahere.ts +112 -188
  775. package/src/providers/manga/mangakakalot.ts +25 -66
  776. package/src/providers/manga/mangapill.ts +105 -149
  777. package/src/providers/manga/shared.ts +71 -0
  778. package/src/providers/meta/anilist-media.ts +235 -0
  779. package/src/providers/meta/anilist.ts +460 -892
  780. package/src/providers/meta/index.ts +1 -1
  781. package/src/providers/meta/mal.ts +156 -416
  782. package/src/providers/meta/shared.ts +136 -0
  783. package/src/providers/meta/tmdb.ts +334 -358
  784. package/src/providers/movies/index.ts +4 -12
  785. package/src/providers/movies/multimovies/create-multimovies.ts +215 -452
  786. package/src/providers/movies/multimovies/multimovies.ts +5 -58
  787. package/src/providers/movies/multistream/create-multistream.ts +141 -0
  788. package/src/providers/movies/multistream/multistream.ts +7 -0
  789. package/src/providers/movies/multistream/utils.ts +234 -410
  790. package/src/providers/movies/netflixmirror/create-netflixmirror.ts +72 -34
  791. package/src/providers/movies/netflixmirror/netflixmirror.ts +9 -15
  792. package/src/providers/movies/site-paths.ts +25 -0
  793. package/src/providers/movies/vegamovies/create-vegamovies.ts +450 -725
  794. package/src/providers/movies/vegamovies/vegamovies.ts +5 -62
  795. package/src/providers/provider-class.ts +39 -0
  796. package/src/registry-signing-keys.json +6 -0
  797. package/src/utils/ExtractorManager.ts +177 -237
  798. package/src/utils/ProviderManager.ts +170 -278
  799. package/src/utils/constants.ts +2 -10
  800. package/src/utils/create-extractor-context.ts +36 -28
  801. package/src/utils/create-provider-context.ts +51 -121
  802. package/src/utils/extension-integrity.ts +1 -2
  803. package/src/utils/extension-modules.ts +281 -61
  804. package/src/utils/fetch-with-timeout.ts +4 -2
  805. package/src/utils/meta-http.ts +20 -27
  806. package/src/utils/registry-schema.ts +48 -15
  807. package/src/utils/registry-signature-format.ts +37 -0
  808. package/src/utils/registry-signature.ts +26 -67
  809. package/src/utils/runtime-modules.ts +7 -0
  810. package/src/utils/tmdb.ts +186 -0
  811. package/src/utils/url-polyfill.ts +2 -46
  812. package/src/utils/utf8.ts +44 -0
  813. package/src/utils/utils.ts +16 -362
  814. package/android/src/main/AndroidManifestNew.xml +0 -3
  815. package/android/src/main/java/com/consumet/DdosGuardModule.kt +0 -179
  816. package/lib/commonjs/extractors/asianload.js +0 -75
  817. package/lib/commonjs/extractors/asianload.js.map +0 -1
  818. package/lib/commonjs/extractors/filemoon.js +0 -66
  819. package/lib/commonjs/extractors/filemoon.js.map +0 -1
  820. package/lib/commonjs/extractors/gdflix.js +0 -165
  821. package/lib/commonjs/extractors/gdflix.js.map +0 -1
  822. package/lib/commonjs/extractors/gogocdn.js +0 -128
  823. package/lib/commonjs/extractors/gogocdn.js.map +0 -1
  824. package/lib/commonjs/extractors/megaup.js +0 -113
  825. package/lib/commonjs/extractors/megaup.js.map +0 -1
  826. package/lib/commonjs/extractors/mixdrop.js +0 -37
  827. package/lib/commonjs/extractors/mixdrop.js.map +0 -1
  828. package/lib/commonjs/extractors/mp4player.js +0 -57
  829. package/lib/commonjs/extractors/mp4player.js.map +0 -1
  830. package/lib/commonjs/extractors/mp4upload.js +0 -38
  831. package/lib/commonjs/extractors/mp4upload.js.map +0 -1
  832. package/lib/commonjs/extractors/rapidcloud.js +0 -180
  833. package/lib/commonjs/extractors/rapidcloud.js.map +0 -1
  834. package/lib/commonjs/extractors/streamhub.js +0 -61
  835. package/lib/commonjs/extractors/streamhub.js.map +0 -1
  836. package/lib/commonjs/extractors/streamlare.js +0 -55
  837. package/lib/commonjs/extractors/streamlare.js.map +0 -1
  838. package/lib/commonjs/extractors/streamsb.js +0 -69
  839. package/lib/commonjs/extractors/streamsb.js.map +0 -1
  840. package/lib/commonjs/extractors/streamtape.js +0 -42
  841. package/lib/commonjs/extractors/streamtape.js.map +0 -1
  842. package/lib/commonjs/extractors/vidmoly.js +0 -54
  843. package/lib/commonjs/extractors/vidmoly.js.map +0 -1
  844. package/lib/commonjs/extractors/vizcloud.js +0 -67
  845. package/lib/commonjs/extractors/vizcloud.js.map +0 -1
  846. package/lib/commonjs/extractors/voe.js +0 -100
  847. package/lib/commonjs/extractors/voe.js.map +0 -1
  848. package/lib/commonjs/models/base-types.js +0 -2
  849. package/lib/commonjs/models/base-types.js.map +0 -1
  850. package/lib/commonjs/providers/anime/animekai/animekai.js +0 -118
  851. package/lib/commonjs/providers/anime/animekai/animekai.js.map +0 -1
  852. package/lib/commonjs/providers/anime/animekai/create-animekai.js +0 -518
  853. package/lib/commonjs/providers/anime/animekai/create-animekai.js.map +0 -1
  854. package/lib/commonjs/providers/anime/animeunity.js +0 -187
  855. package/lib/commonjs/providers/anime/animeunity.js.map +0 -1
  856. package/lib/commonjs/providers/anime/anineko/anineko.js +0 -41
  857. package/lib/commonjs/providers/anime/anineko/anineko.js.map +0 -1
  858. package/lib/commonjs/providers/anime/anineko/create-anineko.js +0 -449
  859. package/lib/commonjs/providers/anime/anineko/create-anineko.js.map +0 -1
  860. package/lib/commonjs/providers/anime/zoro/create-zoro.js +0 -586
  861. package/lib/commonjs/providers/anime/zoro/create-zoro.js.map +0 -1
  862. package/lib/commonjs/providers/anime/zoro/zoro.js +0 -193
  863. package/lib/commonjs/providers/anime/zoro/zoro.js.map +0 -1
  864. package/lib/commonjs/providers/meta/tmdb-api-key.js +0 -29
  865. package/lib/commonjs/providers/meta/tmdb-api-key.js.map +0 -1
  866. package/lib/commonjs/providers/movies/himovies/create-himovies.js +0 -436
  867. package/lib/commonjs/providers/movies/himovies/create-himovies.js.map +0 -1
  868. package/lib/commonjs/providers/movies/himovies/himovies.js +0 -79
  869. package/lib/commonjs/providers/movies/himovies/himovies.js.map +0 -1
  870. package/lib/commonjs/providers/movies/multistream/index.js +0 -222
  871. package/lib/commonjs/providers/movies/multistream/index.js.map +0 -1
  872. package/lib/commonjs/providers/movies/netflixmirror/disneymirror.js +0 -22
  873. package/lib/commonjs/providers/movies/netflixmirror/disneymirror.js.map +0 -1
  874. package/lib/commonjs/providers/movies/netflixmirror/netmirror-parser.js +0 -30
  875. package/lib/commonjs/providers/movies/netflixmirror/netmirror-parser.js.map +0 -1
  876. package/lib/commonjs/providers/movies/netflixmirror/primemirror.js +0 -22
  877. package/lib/commonjs/providers/movies/netflixmirror/primemirror.js.map +0 -1
  878. package/lib/commonjs/providers/movies/yflix/create-yflix.js +0 -418
  879. package/lib/commonjs/providers/movies/yflix/create-yflix.js.map +0 -1
  880. package/lib/commonjs/providers/movies/yflix/yflix.js +0 -66
  881. package/lib/commonjs/providers/movies/yflix/yflix.js.map +0 -1
  882. package/lib/commonjs/providers/provider-args.js +0 -17
  883. package/lib/commonjs/providers/provider-args.js.map +0 -1
  884. package/lib/commonjs/registry-signing-keys.js +0 -26
  885. package/lib/commonjs/registry-signing-keys.js.map +0 -1
  886. package/lib/commonjs/utils/extension-utils.js +0 -105
  887. package/lib/commonjs/utils/extension-utils.js.map +0 -1
  888. package/lib/commonjs/utils/index.js +0 -312
  889. package/lib/commonjs/utils/index.js.map +0 -1
  890. package/lib/commonjs/utils/provider-maps.js +0 -69
  891. package/lib/commonjs/utils/provider-maps.js.map +0 -1
  892. package/lib/commonjs/utils/queries.js +0 -45
  893. package/lib/commonjs/utils/queries.js.map +0 -1
  894. package/lib/module/extractors/asianload.js +0 -69
  895. package/lib/module/extractors/asianload.js.map +0 -1
  896. package/lib/module/extractors/filemoon.js +0 -62
  897. package/lib/module/extractors/filemoon.js.map +0 -1
  898. package/lib/module/extractors/gdflix.js +0 -161
  899. package/lib/module/extractors/gdflix.js.map +0 -1
  900. package/lib/module/extractors/gogocdn.js +0 -122
  901. package/lib/module/extractors/gogocdn.js.map +0 -1
  902. package/lib/module/extractors/megaup.js +0 -109
  903. package/lib/module/extractors/megaup.js.map +0 -1
  904. package/lib/module/extractors/mixdrop.js +0 -32
  905. package/lib/module/extractors/mixdrop.js.map +0 -1
  906. package/lib/module/extractors/mp4player.js +0 -52
  907. package/lib/module/extractors/mp4player.js.map +0 -1
  908. package/lib/module/extractors/mp4upload.js +0 -33
  909. package/lib/module/extractors/mp4upload.js.map +0 -1
  910. package/lib/module/extractors/rapidcloud.js +0 -174
  911. package/lib/module/extractors/rapidcloud.js.map +0 -1
  912. package/lib/module/extractors/streamhub.js +0 -56
  913. package/lib/module/extractors/streamhub.js.map +0 -1
  914. package/lib/module/extractors/streamlare.js +0 -50
  915. package/lib/module/extractors/streamlare.js.map +0 -1
  916. package/lib/module/extractors/streamsb.js +0 -64
  917. package/lib/module/extractors/streamsb.js.map +0 -1
  918. package/lib/module/extractors/streamtape.js +0 -37
  919. package/lib/module/extractors/streamtape.js.map +0 -1
  920. package/lib/module/extractors/vidmoly.js +0 -49
  921. package/lib/module/extractors/vidmoly.js.map +0 -1
  922. package/lib/module/extractors/vizcloud.js +0 -62
  923. package/lib/module/extractors/vizcloud.js.map +0 -1
  924. package/lib/module/extractors/voe.js +0 -95
  925. package/lib/module/extractors/voe.js.map +0 -1
  926. package/lib/module/models/base-types.js +0 -2
  927. package/lib/module/models/base-types.js.map +0 -1
  928. package/lib/module/providers/anime/animekai/animekai.js +0 -113
  929. package/lib/module/providers/anime/animekai/animekai.js.map +0 -1
  930. package/lib/module/providers/anime/animekai/create-animekai.js +0 -514
  931. package/lib/module/providers/anime/animekai/create-animekai.js.map +0 -1
  932. package/lib/module/providers/anime/animeunity.js +0 -183
  933. package/lib/module/providers/anime/animeunity.js.map +0 -1
  934. package/lib/module/providers/anime/anineko/anineko.js +0 -36
  935. package/lib/module/providers/anime/anineko/anineko.js.map +0 -1
  936. package/lib/module/providers/anime/anineko/create-anineko.js +0 -445
  937. package/lib/module/providers/anime/anineko/create-anineko.js.map +0 -1
  938. package/lib/module/providers/anime/zoro/create-zoro.js +0 -582
  939. package/lib/module/providers/anime/zoro/create-zoro.js.map +0 -1
  940. package/lib/module/providers/anime/zoro/zoro.js +0 -189
  941. package/lib/module/providers/anime/zoro/zoro.js.map +0 -1
  942. package/lib/module/providers/meta/tmdb-api-key.js +0 -24
  943. package/lib/module/providers/meta/tmdb-api-key.js.map +0 -1
  944. package/lib/module/providers/movies/himovies/create-himovies.js +0 -432
  945. package/lib/module/providers/movies/himovies/create-himovies.js.map +0 -1
  946. package/lib/module/providers/movies/himovies/himovies.js +0 -75
  947. package/lib/module/providers/movies/himovies/himovies.js.map +0 -1
  948. package/lib/module/providers/movies/multistream/index.js +0 -217
  949. package/lib/module/providers/movies/multistream/index.js.map +0 -1
  950. package/lib/module/providers/movies/netflixmirror/disneymirror.js +0 -17
  951. package/lib/module/providers/movies/netflixmirror/disneymirror.js.map +0 -1
  952. package/lib/module/providers/movies/netflixmirror/netmirror-parser.js +0 -25
  953. package/lib/module/providers/movies/netflixmirror/netmirror-parser.js.map +0 -1
  954. package/lib/module/providers/movies/netflixmirror/primemirror.js +0 -17
  955. package/lib/module/providers/movies/netflixmirror/primemirror.js.map +0 -1
  956. package/lib/module/providers/movies/yflix/create-yflix.js +0 -414
  957. package/lib/module/providers/movies/yflix/create-yflix.js.map +0 -1
  958. package/lib/module/providers/movies/yflix/yflix.js +0 -61
  959. package/lib/module/providers/movies/yflix/yflix.js.map +0 -1
  960. package/lib/module/providers/provider-args.js +0 -14
  961. package/lib/module/providers/provider-args.js.map +0 -1
  962. package/lib/module/registry-signing-keys.js +0 -22
  963. package/lib/module/registry-signing-keys.js.map +0 -1
  964. package/lib/module/utils/extension-utils.js +0 -100
  965. package/lib/module/utils/extension-utils.js.map +0 -1
  966. package/lib/module/utils/index.js +0 -21
  967. package/lib/module/utils/index.js.map +0 -1
  968. package/lib/module/utils/provider-maps.js +0 -65
  969. package/lib/module/utils/provider-maps.js.map +0 -1
  970. package/lib/module/utils/queries.js +0 -29
  971. package/lib/module/utils/queries.js.map +0 -1
  972. package/lib/typescript/commonjs/src/extractors/asianload.d.ts +0 -17
  973. package/lib/typescript/commonjs/src/extractors/asianload.d.ts.map +0 -1
  974. package/lib/typescript/commonjs/src/extractors/filemoon.d.ts +0 -14
  975. package/lib/typescript/commonjs/src/extractors/filemoon.d.ts.map +0 -1
  976. package/lib/typescript/commonjs/src/extractors/gdflix.d.ts +0 -7
  977. package/lib/typescript/commonjs/src/extractors/gdflix.d.ts.map +0 -1
  978. package/lib/typescript/commonjs/src/extractors/gogocdn.d.ts +0 -19
  979. package/lib/typescript/commonjs/src/extractors/gogocdn.d.ts.map +0 -1
  980. package/lib/typescript/commonjs/src/extractors/megaup.d.ts +0 -6
  981. package/lib/typescript/commonjs/src/extractors/megaup.d.ts.map +0 -1
  982. package/lib/typescript/commonjs/src/extractors/mixdrop.d.ts +0 -10
  983. package/lib/typescript/commonjs/src/extractors/mixdrop.d.ts.map +0 -1
  984. package/lib/typescript/commonjs/src/extractors/mp4player.d.ts +0 -15
  985. package/lib/typescript/commonjs/src/extractors/mp4player.d.ts.map +0 -1
  986. package/lib/typescript/commonjs/src/extractors/mp4upload.d.ts +0 -10
  987. package/lib/typescript/commonjs/src/extractors/mp4upload.d.ts.map +0 -1
  988. package/lib/typescript/commonjs/src/extractors/rapidcloud.d.ts +0 -17
  989. package/lib/typescript/commonjs/src/extractors/rapidcloud.d.ts.map +0 -1
  990. package/lib/typescript/commonjs/src/extractors/streamhub.d.ts +0 -14
  991. package/lib/typescript/commonjs/src/extractors/streamhub.d.ts.map +0 -1
  992. package/lib/typescript/commonjs/src/extractors/streamlare.d.ts +0 -13
  993. package/lib/typescript/commonjs/src/extractors/streamlare.d.ts.map +0 -1
  994. package/lib/typescript/commonjs/src/extractors/streamsb.d.ts +0 -14
  995. package/lib/typescript/commonjs/src/extractors/streamsb.d.ts.map +0 -1
  996. package/lib/typescript/commonjs/src/extractors/streamtape.d.ts +0 -10
  997. package/lib/typescript/commonjs/src/extractors/streamtape.d.ts.map +0 -1
  998. package/lib/typescript/commonjs/src/extractors/vidmoly.d.ts +0 -10
  999. package/lib/typescript/commonjs/src/extractors/vidmoly.d.ts.map +0 -1
  1000. package/lib/typescript/commonjs/src/extractors/vizcloud.d.ts +0 -12
  1001. package/lib/typescript/commonjs/src/extractors/vizcloud.d.ts.map +0 -1
  1002. package/lib/typescript/commonjs/src/extractors/voe.d.ts +0 -15
  1003. package/lib/typescript/commonjs/src/extractors/voe.d.ts.map +0 -1
  1004. package/lib/typescript/commonjs/src/models/base-types.d.ts +0 -23
  1005. package/lib/typescript/commonjs/src/models/base-types.d.ts.map +0 -1
  1006. package/lib/typescript/commonjs/src/providers/anime/animekai/animekai.d.ts +0 -90
  1007. package/lib/typescript/commonjs/src/providers/anime/animekai/animekai.d.ts.map +0 -1
  1008. package/lib/typescript/commonjs/src/providers/anime/animekai/create-animekai.d.ts +0 -32
  1009. package/lib/typescript/commonjs/src/providers/anime/animekai/create-animekai.d.ts.map +0 -1
  1010. package/lib/typescript/commonjs/src/providers/anime/animeunity.d.ts +0 -39
  1011. package/lib/typescript/commonjs/src/providers/anime/animeunity.d.ts.map +0 -1
  1012. package/lib/typescript/commonjs/src/providers/anime/anineko/anineko.d.ts +0 -28
  1013. package/lib/typescript/commonjs/src/providers/anime/anineko/anineko.d.ts.map +0 -1
  1014. package/lib/typescript/commonjs/src/providers/anime/anineko/create-anineko.d.ts +0 -52
  1015. package/lib/typescript/commonjs/src/providers/anime/anineko/create-anineko.d.ts.map +0 -1
  1016. package/lib/typescript/commonjs/src/providers/anime/zoro/create-zoro.d.ts +0 -49
  1017. package/lib/typescript/commonjs/src/providers/anime/zoro/create-zoro.d.ts.map +0 -1
  1018. package/lib/typescript/commonjs/src/providers/anime/zoro/zoro.d.ts +0 -139
  1019. package/lib/typescript/commonjs/src/providers/anime/zoro/zoro.d.ts.map +0 -1
  1020. package/lib/typescript/commonjs/src/providers/meta/tmdb-api-key.d.ts +0 -7
  1021. package/lib/typescript/commonjs/src/providers/meta/tmdb-api-key.d.ts.map +0 -1
  1022. package/lib/typescript/commonjs/src/providers/movies/himovies/create-himovies.d.ts +0 -24
  1023. package/lib/typescript/commonjs/src/providers/movies/himovies/create-himovies.d.ts.map +0 -1
  1024. package/lib/typescript/commonjs/src/providers/movies/himovies/himovies.d.ts +0 -50
  1025. package/lib/typescript/commonjs/src/providers/movies/himovies/himovies.d.ts.map +0 -1
  1026. package/lib/typescript/commonjs/src/providers/movies/multistream/index.d.ts +0 -44
  1027. package/lib/typescript/commonjs/src/providers/movies/multistream/index.d.ts.map +0 -1
  1028. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/disneymirror.d.ts +0 -12
  1029. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/disneymirror.d.ts.map +0 -1
  1030. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/netmirror-parser.d.ts +0 -21
  1031. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/netmirror-parser.d.ts.map +0 -1
  1032. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/primemirror.d.ts +0 -12
  1033. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/primemirror.d.ts.map +0 -1
  1034. package/lib/typescript/commonjs/src/providers/movies/yflix/create-yflix.d.ts +0 -25
  1035. package/lib/typescript/commonjs/src/providers/movies/yflix/create-yflix.d.ts.map +0 -1
  1036. package/lib/typescript/commonjs/src/providers/movies/yflix/yflix.d.ts +0 -49
  1037. package/lib/typescript/commonjs/src/providers/movies/yflix/yflix.d.ts.map +0 -1
  1038. package/lib/typescript/commonjs/src/providers/provider-args.d.ts +0 -8
  1039. package/lib/typescript/commonjs/src/providers/provider-args.d.ts.map +0 -1
  1040. package/lib/typescript/commonjs/src/registry-signing-keys.d.ts +0 -18
  1041. package/lib/typescript/commonjs/src/registry-signing-keys.d.ts.map +0 -1
  1042. package/lib/typescript/commonjs/src/utils/extension-utils.d.ts +0 -31
  1043. package/lib/typescript/commonjs/src/utils/extension-utils.d.ts.map +0 -1
  1044. package/lib/typescript/commonjs/src/utils/index.d.ts +0 -19
  1045. package/lib/typescript/commonjs/src/utils/index.d.ts.map +0 -1
  1046. package/lib/typescript/commonjs/src/utils/provider-maps.d.ts +0 -39
  1047. package/lib/typescript/commonjs/src/utils/provider-maps.d.ts.map +0 -1
  1048. package/lib/typescript/commonjs/src/utils/queries.d.ts +0 -22
  1049. package/lib/typescript/commonjs/src/utils/queries.d.ts.map +0 -1
  1050. package/lib/typescript/module/src/extractors/asianload.d.ts +0 -17
  1051. package/lib/typescript/module/src/extractors/asianload.d.ts.map +0 -1
  1052. package/lib/typescript/module/src/extractors/filemoon.d.ts +0 -14
  1053. package/lib/typescript/module/src/extractors/filemoon.d.ts.map +0 -1
  1054. package/lib/typescript/module/src/extractors/gdflix.d.ts +0 -7
  1055. package/lib/typescript/module/src/extractors/gdflix.d.ts.map +0 -1
  1056. package/lib/typescript/module/src/extractors/gogocdn.d.ts +0 -19
  1057. package/lib/typescript/module/src/extractors/gogocdn.d.ts.map +0 -1
  1058. package/lib/typescript/module/src/extractors/megaup.d.ts +0 -6
  1059. package/lib/typescript/module/src/extractors/megaup.d.ts.map +0 -1
  1060. package/lib/typescript/module/src/extractors/mixdrop.d.ts +0 -10
  1061. package/lib/typescript/module/src/extractors/mixdrop.d.ts.map +0 -1
  1062. package/lib/typescript/module/src/extractors/mp4player.d.ts +0 -15
  1063. package/lib/typescript/module/src/extractors/mp4player.d.ts.map +0 -1
  1064. package/lib/typescript/module/src/extractors/mp4upload.d.ts +0 -10
  1065. package/lib/typescript/module/src/extractors/mp4upload.d.ts.map +0 -1
  1066. package/lib/typescript/module/src/extractors/rapidcloud.d.ts +0 -17
  1067. package/lib/typescript/module/src/extractors/rapidcloud.d.ts.map +0 -1
  1068. package/lib/typescript/module/src/extractors/streamhub.d.ts +0 -14
  1069. package/lib/typescript/module/src/extractors/streamhub.d.ts.map +0 -1
  1070. package/lib/typescript/module/src/extractors/streamlare.d.ts +0 -13
  1071. package/lib/typescript/module/src/extractors/streamlare.d.ts.map +0 -1
  1072. package/lib/typescript/module/src/extractors/streamsb.d.ts +0 -14
  1073. package/lib/typescript/module/src/extractors/streamsb.d.ts.map +0 -1
  1074. package/lib/typescript/module/src/extractors/streamtape.d.ts +0 -10
  1075. package/lib/typescript/module/src/extractors/streamtape.d.ts.map +0 -1
  1076. package/lib/typescript/module/src/extractors/vidmoly.d.ts +0 -10
  1077. package/lib/typescript/module/src/extractors/vidmoly.d.ts.map +0 -1
  1078. package/lib/typescript/module/src/extractors/vizcloud.d.ts +0 -12
  1079. package/lib/typescript/module/src/extractors/vizcloud.d.ts.map +0 -1
  1080. package/lib/typescript/module/src/extractors/voe.d.ts +0 -15
  1081. package/lib/typescript/module/src/extractors/voe.d.ts.map +0 -1
  1082. package/lib/typescript/module/src/models/base-types.d.ts +0 -23
  1083. package/lib/typescript/module/src/models/base-types.d.ts.map +0 -1
  1084. package/lib/typescript/module/src/providers/anime/animekai/animekai.d.ts +0 -90
  1085. package/lib/typescript/module/src/providers/anime/animekai/animekai.d.ts.map +0 -1
  1086. package/lib/typescript/module/src/providers/anime/animekai/create-animekai.d.ts +0 -32
  1087. package/lib/typescript/module/src/providers/anime/animekai/create-animekai.d.ts.map +0 -1
  1088. package/lib/typescript/module/src/providers/anime/animeunity.d.ts +0 -39
  1089. package/lib/typescript/module/src/providers/anime/animeunity.d.ts.map +0 -1
  1090. package/lib/typescript/module/src/providers/anime/anineko/anineko.d.ts +0 -28
  1091. package/lib/typescript/module/src/providers/anime/anineko/anineko.d.ts.map +0 -1
  1092. package/lib/typescript/module/src/providers/anime/anineko/create-anineko.d.ts +0 -52
  1093. package/lib/typescript/module/src/providers/anime/anineko/create-anineko.d.ts.map +0 -1
  1094. package/lib/typescript/module/src/providers/anime/zoro/create-zoro.d.ts +0 -49
  1095. package/lib/typescript/module/src/providers/anime/zoro/create-zoro.d.ts.map +0 -1
  1096. package/lib/typescript/module/src/providers/anime/zoro/zoro.d.ts +0 -139
  1097. package/lib/typescript/module/src/providers/anime/zoro/zoro.d.ts.map +0 -1
  1098. package/lib/typescript/module/src/providers/meta/tmdb-api-key.d.ts +0 -7
  1099. package/lib/typescript/module/src/providers/meta/tmdb-api-key.d.ts.map +0 -1
  1100. package/lib/typescript/module/src/providers/movies/himovies/create-himovies.d.ts +0 -24
  1101. package/lib/typescript/module/src/providers/movies/himovies/create-himovies.d.ts.map +0 -1
  1102. package/lib/typescript/module/src/providers/movies/himovies/himovies.d.ts +0 -50
  1103. package/lib/typescript/module/src/providers/movies/himovies/himovies.d.ts.map +0 -1
  1104. package/lib/typescript/module/src/providers/movies/multistream/index.d.ts +0 -44
  1105. package/lib/typescript/module/src/providers/movies/multistream/index.d.ts.map +0 -1
  1106. package/lib/typescript/module/src/providers/movies/netflixmirror/disneymirror.d.ts +0 -12
  1107. package/lib/typescript/module/src/providers/movies/netflixmirror/disneymirror.d.ts.map +0 -1
  1108. package/lib/typescript/module/src/providers/movies/netflixmirror/netmirror-parser.d.ts +0 -21
  1109. package/lib/typescript/module/src/providers/movies/netflixmirror/netmirror-parser.d.ts.map +0 -1
  1110. package/lib/typescript/module/src/providers/movies/netflixmirror/primemirror.d.ts +0 -12
  1111. package/lib/typescript/module/src/providers/movies/netflixmirror/primemirror.d.ts.map +0 -1
  1112. package/lib/typescript/module/src/providers/movies/yflix/create-yflix.d.ts +0 -25
  1113. package/lib/typescript/module/src/providers/movies/yflix/create-yflix.d.ts.map +0 -1
  1114. package/lib/typescript/module/src/providers/movies/yflix/yflix.d.ts +0 -49
  1115. package/lib/typescript/module/src/providers/movies/yflix/yflix.d.ts.map +0 -1
  1116. package/lib/typescript/module/src/providers/provider-args.d.ts +0 -8
  1117. package/lib/typescript/module/src/providers/provider-args.d.ts.map +0 -1
  1118. package/lib/typescript/module/src/registry-signing-keys.d.ts +0 -18
  1119. package/lib/typescript/module/src/registry-signing-keys.d.ts.map +0 -1
  1120. package/lib/typescript/module/src/utils/extension-utils.d.ts +0 -31
  1121. package/lib/typescript/module/src/utils/extension-utils.d.ts.map +0 -1
  1122. package/lib/typescript/module/src/utils/index.d.ts +0 -19
  1123. package/lib/typescript/module/src/utils/index.d.ts.map +0 -1
  1124. package/lib/typescript/module/src/utils/provider-maps.d.ts +0 -39
  1125. package/lib/typescript/module/src/utils/provider-maps.d.ts.map +0 -1
  1126. package/lib/typescript/module/src/utils/queries.d.ts +0 -22
  1127. package/lib/typescript/module/src/utils/queries.d.ts.map +0 -1
  1128. package/src/extractors/asianload.ts +0 -89
  1129. package/src/extractors/filemoon.ts +0 -60
  1130. package/src/extractors/gdflix.ts +0 -165
  1131. package/src/extractors/gogocdn.ts +0 -155
  1132. package/src/extractors/megaup.ts +0 -125
  1133. package/src/extractors/mixdrop.ts +0 -35
  1134. package/src/extractors/mp4player.ts +0 -57
  1135. package/src/extractors/mp4upload.ts +0 -35
  1136. package/src/extractors/rapidcloud.ts +0 -200
  1137. package/src/extractors/streamhub.ts +0 -62
  1138. package/src/extractors/streamlare.ts +0 -65
  1139. package/src/extractors/streamsb.ts +0 -77
  1140. package/src/extractors/streamtape.ts +0 -42
  1141. package/src/extractors/vidmoly.ts +0 -52
  1142. package/src/extractors/vizcloud.ts +0 -70
  1143. package/src/extractors/voe.ts +0 -107
  1144. package/src/models/base-types.ts +0 -23
  1145. package/src/providers/anime/animekai/animekai.ts +0 -126
  1146. package/src/providers/anime/animekai/create-animekai.ts +0 -589
  1147. package/src/providers/anime/animeunity.ts +0 -226
  1148. package/src/providers/anime/anineko/anineko.ts +0 -54
  1149. package/src/providers/anime/anineko/create-anineko.ts +0 -490
  1150. package/src/providers/anime/zoro/create-zoro.ts +0 -645
  1151. package/src/providers/anime/zoro/zoro.ts +0 -201
  1152. package/src/providers/meta/tmdb-api-key.ts +0 -27
  1153. package/src/providers/movies/himovies/create-himovies.ts +0 -518
  1154. package/src/providers/movies/himovies/himovies.ts +0 -89
  1155. package/src/providers/movies/multistream/index.ts +0 -244
  1156. package/src/providers/movies/netflixmirror/disneymirror.ts +0 -16
  1157. package/src/providers/movies/netflixmirror/netmirror-parser.ts +0 -43
  1158. package/src/providers/movies/netflixmirror/primemirror.ts +0 -16
  1159. package/src/providers/movies/yflix/create-yflix.ts +0 -496
  1160. package/src/providers/movies/yflix/yflix.ts +0 -85
  1161. package/src/providers/provider-args.ts +0 -15
  1162. package/src/registry-signing-keys.ts +0 -20
  1163. package/src/utils/extension-utils.ts +0 -130
  1164. package/src/utils/index.ts +0 -96
  1165. package/src/utils/provider-maps.ts +0 -80
  1166. package/src/utils/queries.ts +0 -37
@@ -5,7 +5,6 @@ import {
5
5
  AnimeParser,
6
6
  type ISearch,
7
7
  type IAnimeInfo,
8
- MediaStatus,
9
8
  type IAnimeResult,
10
9
  type ISource,
11
10
  type IAnimeEpisode,
@@ -18,33 +17,48 @@ import {
18
17
  type IMangaChapter,
19
18
  type ProxyConfig,
20
19
  type ITitle,
21
- type FuzzyDate,
22
20
  type IStaff,
23
21
  type AniZipEpisode,
24
22
  type ProviderCapabilities,
25
23
  type IAnimeProvider,
26
24
  MetaError,
25
+ ProviderError,
27
26
  } from '../../models';
28
27
  import type { IMetaAnimeEpisode } from '../../models/types';
29
- import {
30
- anilistSearchQuery,
31
- anilistMediaDetailQuery,
32
- anilistTrendingQuery,
33
- anilistPopularQuery,
34
- anilistAiringScheduleQuery,
35
- anilistGenresQuery,
36
- anilistAdvancedQuery,
37
- anilistCharacterQuery,
38
- anilistStaffInfoQuery,
39
- days,
40
- } from '../../utils';
41
- import { Zoro } from '../anime/zoro/zoro';
42
- import { AnimeKai } from '../anime/animekai/animekai';
43
- import { AnimePahe } from '../anime/animepahe/animepahe';
28
+ import { normalizeTitle, searchTerm } from '../../utils/utils';
44
29
  import { AniKoto } from '../anime/anikoto/anikoto';
45
30
  import { MangaDex } from '../manga/mangadex';
46
- import { sortChaptersForReading } from '../../utils/manga';
47
- import { ANIFY_URL, findSimilarTitles } from '../../utils/utils';
31
+ import {
32
+ ADVANCED_SEARCH_QUERY,
33
+ AIRING_SCHEDULE_QUERY,
34
+ CHARACTER_QUERY,
35
+ EPISODES_MEDIA_QUERY,
36
+ GENRES_QUERY,
37
+ MEDIA_DETAIL_QUERY,
38
+ POPULAR_QUERY,
39
+ SEARCH_QUERY,
40
+ STAFF_QUERY,
41
+ TRENDING_QUERY,
42
+ WEEKDAYS,
43
+ episodeCounts,
44
+ mapAnimeDetail,
45
+ mapBrowseResult,
46
+ mapCharacterMedia,
47
+ mapMangaDetail,
48
+ mapMediaResult,
49
+ mapTitle,
50
+ pickCover,
51
+ } from './anilist-media';
52
+ import {
53
+ applyFiller,
54
+ bestTitleMatch,
55
+ callProvider,
56
+ fetchFillerEpisodes,
57
+ MIN_ANIME_TITLE_SIMILARITY,
58
+ toEpisodeNumber,
59
+ type FillerEpisode,
60
+ type TitleMatch,
61
+ } from './shared';
48
62
 
49
63
  /** A failed AniList request as a MetaError, keeping its status, with a readable message for 404 and 429. */
50
64
  const anilistError = (err: unknown): MetaError => {
@@ -57,183 +71,35 @@ const anilistError = (err: unknown): MetaError => {
57
71
  };
58
72
 
59
73
  const ANILIST_GRAPHQL_URL = 'https://graphql.anilist.co';
74
+ const MALSYNC_URL = 'https://api.malsync.moe';
75
+
76
+ /** POST a query to AniList, its values in `variables`, failing with an anilistError. */
77
+ const anilistQuery = async (query: string, variables?: Record<string, unknown>) => {
78
+ try {
79
+ const { data } = await metaHttp.post(
80
+ ANILIST_GRAPHQL_URL,
81
+ { query, variables },
82
+ { headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' } }
83
+ );
84
+ return data;
85
+ } catch (err) {
86
+ throw anilistError(err);
87
+ }
88
+ };
60
89
 
61
- /**
62
- * POST a query to AniList. Values always go in `variables`, never into the query text, so a search
63
- * containing `"` or `\` can't break the query (it used to fail with a 400).
64
- */
65
- const anilistQuery = (query: string, variables?: Record<string, unknown>) =>
66
- metaHttp.post(
67
- ANILIST_GRAPHQL_URL,
68
- { query, variables },
69
- { headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' } }
70
- );
71
-
72
- // One mapping per AniList shape. Every method used to carry its own copy, and the copies drifted
73
- // (a missing `?.` that crashed on a hidden recommendation, a URL in `coverHash`).
74
-
75
- const STATUS = new Map<unknown, MediaStatus>([
76
- ['RELEASING', MediaStatus.ONGOING],
77
- ['FINISHED', MediaStatus.COMPLETED],
78
- ['NOT_YET_RELEASED', MediaStatus.NOT_YET_AIRED],
79
- ['CANCELLED', MediaStatus.CANCELLED],
80
- ['HIATUS', MediaStatus.HIATUS],
81
- ]);
82
-
83
- /** AniList's `status(version: 2)` as a MediaStatus; anything else is UNKNOWN. */
84
- const mapStatus = (status: unknown): MediaStatus => STATUS.get(status) ?? MediaStatus.UNKNOWN;
85
-
86
- type CoverImage = { extraLarge?: string | null; large?: string | null; medium?: string | null } | null | undefined;
87
-
88
- /** The largest of AniList's cover (poster) images. */
89
- const pickCover = (coverImage: CoverImage): string | undefined =>
90
- coverImage?.extraLarge ?? coverImage?.large ?? coverImage?.medium ?? undefined;
91
-
92
- /** The value of `cover`: the banner, or the cover image for media without one. */
93
- const bannerOrCover = (media: { bannerImage?: string | null; coverImage?: CoverImage }): string | undefined =>
94
- media.bannerImage ?? pickCover(media.coverImage);
95
-
96
- const mapTitle = (title: any): ITitle => ({
97
- romaji: title?.romaji,
98
- english: title?.english,
99
- native: title?.native,
100
- userPreferred: title?.userPreferred,
101
- });
102
-
103
- const mapName = (name: any) => ({
104
- first: name?.first,
105
- last: name?.last,
106
- full: name?.full,
107
- native: name?.native,
108
- userPreferred: name?.userPreferred,
109
- });
110
-
111
- const mapFuzzyDate = (date: any): FuzzyDate => ({ year: date?.year, month: date?.month, day: date?.day });
112
-
113
- /** The fields every list result (search, trending, the airing schedule…) shares. */
114
- const mapMediaResult = (media: any) => ({
115
- id: String(media.id),
116
- malId: media.idMal,
117
- title: mapTitle(media.title),
118
- status: mapStatus(media.status),
119
- image: pickCover(media.coverImage),
120
- cover: bannerOrCover(media),
121
- color: media.coverImage?.color,
122
- description: media.description,
123
- genres: media.genres,
124
- rating: media.averageScore,
125
- type: media.format,
126
- releaseDate: media.seasonYear,
127
- });
128
-
129
- /** A trending, popular or by-genre result. */
130
- const mapBrowseResult = (media: any): IAnimeResult => ({
131
- ...mapMediaResult(media),
132
- trailer: { id: media.trailer?.id, site: media.trailer?.site, thumbnail: media.trailer?.thumbnail },
133
- totalEpisodes: isNaN(media.episodes)
134
- ? 0
135
- : (media.episodes ?? (media.nextAiringEpisode?.episode ? media.nextAiringEpisode.episode - 1 : 0)),
136
- duration: media.duration,
137
- });
138
-
139
- /**
140
- * Media inside another media's details (a recommendation or a relation), in one shape for anime
141
- * and manga. AniList sends `null` for media it hides, which maps to `undefined`.
142
- */
143
- const mapMediaNode = (node: any): IAnimeResult | undefined =>
144
- node
145
- ? {
146
- id: node.id,
147
- malId: node.idMal,
148
- title: mapTitle(node.title),
149
- status: mapStatus(node.status),
150
- episodes: node.episodes,
151
- chapters: node.chapters,
152
- image: pickCover(node.coverImage),
153
- cover: bannerOrCover(node),
154
- color: node.coverImage?.color,
155
- rating: node.meanScore,
156
- type: node.format,
157
- }
158
- : undefined;
159
-
160
- const mapRecommendations = (media: any): IAnimeResult[] | undefined =>
161
- media.recommendations?.edges?.flatMap((edge: any) => mapMediaNode(edge?.node?.mediaRecommendation) ?? []);
162
-
163
- const mapRelations = (media: any): IAnimeResult[] | undefined =>
164
- media.relations?.edges?.flatMap((edge: any) => {
165
- const node = mapMediaNode(edge?.node);
166
- return node ? [{ ...node, relationType: edge.relationType }] : [];
167
- });
168
-
169
- const mapCharacters = (media: any) =>
170
- media.characters?.edges?.map((edge: any) => ({
171
- id: edge.node?.id,
172
- role: edge.role,
173
- name: mapName(edge.node?.name),
174
- image: edge.node?.image?.large ?? edge.node?.image?.medium,
175
- voiceActors: (edge.voiceActors ?? []).map((voiceActor: any) => ({
176
- id: voiceActor.id,
177
- language: voiceActor.languageV2,
178
- name: mapName(voiceActor.name),
179
- image: voiceActor.image?.large ?? voiceActor.image?.medium,
180
- })),
181
- }));
182
-
183
- /** The details fetchAnimeInfo, fetchAnilistInfoById and Manga.fetchMangaInfo share. */
184
- const mapMediaDetail = (media: any) => ({
185
- malId: media.idMal,
186
- title: mapTitle(media.title),
187
- synonyms: media.synonyms,
188
- isLicensed: media.isLicensed ?? undefined,
189
- isAdult: media.isAdult ?? undefined,
190
- countryOfOrigin: media.countryOfOrigin ?? undefined,
191
- ...(media.trailer?.id
192
- ? { trailer: { id: media.trailer.id, site: media.trailer.site, thumbnail: media.trailer.thumbnail } }
193
- : {}),
194
- image: pickCover(media.coverImage),
195
- popularity: media.popularity,
196
- color: media.coverImage?.color,
197
- cover: bannerOrCover(media),
198
- description: media.description,
199
- status: mapStatus(media.status),
200
- releaseDate: media.startDate?.year,
201
- startDate: mapFuzzyDate(media.startDate),
202
- endDate: mapFuzzyDate(media.endDate),
203
- rating: media.averageScore,
204
- genres: media.genres,
205
- season: media.season,
206
- studios: media.studios?.edges?.map((edge: any) => edge.node.name),
207
- type: media.format,
208
- recommendations: mapRecommendations(media),
209
- characters: mapCharacters(media),
210
- relations: mapRelations(media),
211
- });
212
-
213
- /** mapMediaDetail plus the airing and episode fields of an anime. */
214
- const mapAnimeDetail = (media: any) => ({
215
- ...mapMediaDetail(media),
216
- ...(media.nextAiringEpisode?.airingAt
217
- ? {
218
- nextAiringEpisode: {
219
- airingTime: media.nextAiringEpisode.airingAt,
220
- timeUntilAiring: media.nextAiringEpisode.timeUntilAiring,
221
- episode: media.nextAiringEpisode.episode,
222
- },
223
- }
224
- : {}),
225
- totalEpisodes: media.episodes ?? media.nextAiringEpisode?.episode - 1,
226
- currentEpisode: media.nextAiringEpisode?.episode
227
- ? media.nextAiringEpisode.episode - 1
228
- : (media.episodes ?? undefined),
229
- duration: media.duration,
90
+ /** A page of AniList's `Page` answer, with `results` mapped from its `items`. */
91
+ const toPage = <T>(page: any, results: T[]): ISearch<T> => ({
92
+ currentPage: page?.pageInfo?.currentPage,
93
+ hasNextPage: page?.pageInfo?.hasNextPage,
94
+ results,
230
95
  });
231
96
 
232
- /** A weekday as an index into `days` (0 = Saturday … 6 = Friday), from that index or the day's name. */
97
+ /** A weekday as an index into WEEKDAYS, from that index or the day's name. */
233
98
  const weekdayIndex = (day: number | string): number => {
234
99
  const index =
235
- typeof day === 'string' ? days.findIndex((name) => name.toLowerCase() === day.trim().toLowerCase()) : day;
236
- if (!Number.isInteger(index) || index < 0 || index >= days.length) throw new Error('Invalid weekStart or weekEnd');
100
+ typeof day === 'string' ? WEEKDAYS.findIndex((name) => name.toLowerCase() === day.trim().toLowerCase()) : day;
101
+ if (!Number.isInteger(index) || index < 0 || index >= WEEKDAYS.length)
102
+ throw new Error('Invalid weekStart or weekEnd');
237
103
  return index;
238
104
  };
239
105
 
@@ -244,7 +110,7 @@ const weekdayIndex = (day: number | string): number => {
244
110
  const airingWindow = (weekStart: number | string, weekEnd: number | string, now: Date = new Date()) => {
245
111
  const start = weekdayIndex(weekStart);
246
112
  const end = weekdayIndex(weekEnd);
247
- const today = (now.getDay() + 1) % 7; // as a `days` index, which starts on Saturday
113
+ const today = (now.getDay() + 1) % 7; // as a WEEKDAYS index, which starts on Saturday
248
114
  const firstDay = (start - today + 7) % 7;
249
115
  const dayCount = ((end - start + 7) % 7) + 1;
250
116
  const midnight = (offset: number) =>
@@ -269,11 +135,6 @@ type AniZipEntry = {
269
135
  /** A provider episode, with the AniDB episode number when ani.zip matched it. */
270
136
  type MergedEpisode = { episode: IAnimeEpisode; aniDbKey?: number };
271
137
 
272
- const toEpisodeNumber = (value: unknown): number | undefined => {
273
- const n = typeof value === 'string' && value.trim() !== '' ? Number(value) : value;
274
- return typeof n === 'number' && Number.isFinite(n) ? n : undefined;
275
- };
276
-
277
138
  const timeOf = (date: unknown): number | undefined => {
278
139
  if (typeof date !== 'string' || !date) return undefined;
279
140
  const time = new Date(date).getTime();
@@ -287,6 +148,60 @@ const timeOf = (date: unknown): number | undefined => {
287
148
  const episodeUniqueId = (anilistId: string, { episode, aniDbKey }: MergedEpisode, index: number) =>
288
149
  `${anilistId}$ep=${aniDbKey ?? toEpisodeNumber(episode.number) ?? index + 1}`;
289
150
 
151
+ const romanToArabic = (roman: string): number => {
152
+ const values: Record<string, number> = { i: 1, v: 5, x: 10 };
153
+ const digits = roman.toLowerCase();
154
+ let result = 0;
155
+ for (let i = 0; i < digits.length; i++) {
156
+ const current = values[digits[i]!]!;
157
+ const next = values[digits[i + 1]!];
158
+ if (next && current < next) {
159
+ result += next - current;
160
+ i++;
161
+ } else {
162
+ result += current;
163
+ }
164
+ }
165
+ return result;
166
+ };
167
+
168
+ /**
169
+ * An anime title in the form provider titles are compared in: normalizeTitle without anything in
170
+ * parentheses (`(TV)`, `(Dub)`) or season words, roman numerals (I to IX) as digits, and common
171
+ * romanization variants (`yuu`, ` ou`) spelled one way.
172
+ */
173
+ const animeTitle = (title: string): string =>
174
+ normalizeTitle(title.replace(/\([^)]*\)/g, ' '))
175
+ .replace(/(th|rd|nd|st) season/g, '')
176
+ .replace(/season/g, '')
177
+ .replace(/\b(ix|iv|v?i{1,3}|v)\b/g, (numeral) => String(romanToArabic(numeral)))
178
+ .replace(/yuu/g, 'yu')
179
+ .replace(/ ou/g, ' oh')
180
+ .replace(/ {2,}/g, ' ')
181
+ .trim();
182
+
183
+ /** Subbed episodes a provider result lists, for preferring the fuller of two equal matches. */
184
+ const subCount = (result: IAnimeResult): number => {
185
+ if (typeof result.episodes?.sub === 'number') return result.episodes.sub;
186
+ if (typeof result.sub === 'number') return result.sub;
187
+ return 0;
188
+ };
189
+
190
+ /**
191
+ * Providers that list the dub as its own entry mark it in the title: "Naruto (Dub)". Anything in
192
+ * parentheses other than `(TV)` and numbers names the audio; a title without is the sub.
193
+ */
194
+ const audioOf = (title: unknown): string => {
195
+ const marked = typeof title === 'string' ? /\(([^)0-9]+)\)/.exec(title.replace(/\(TV\)/g, ''))?.[1] : undefined;
196
+ return marked ? marked.replace(/\s+/g, '-').toLowerCase() : 'sub';
197
+ };
198
+
199
+ /** 2 for a sub entry, 1 for a dub entry, 0 for other audio: the sub entry is preferred. */
200
+ const audioRank = (result: IAnimeResult): number => {
201
+ const audio = audioOf(result.title);
202
+ return audio === 'sub' ? 2 : audio === 'dub' ? 1 : 0;
203
+ };
204
+
290
205
  /** An AniList format as providers name the type: `MOVIE` → `movie`, `TV_SHORT` → `tv`. */
291
206
  const providerType = (format?: string) => (format === 'TV_SHORT' ? 'tv' : format?.toLowerCase());
292
207
 
@@ -299,8 +214,8 @@ const titleNumbers = (title?: string) => new Set((title ?? '').replace(/\([^)]*\
299
214
  * gains when its type is the AniList format, loses when only one of the two is a movie, and loses when its numbers
300
215
  * don't match the title's.
301
216
  */
302
- const matchScore = (result: { title?: string; type?: string; similarity?: number }, title: ITitle, format?: string) => {
303
- let score = result.similarity ?? 0;
217
+ const matchScore = (result: IAnimeResult, similarity: number, title: ITitle, format?: string) => {
218
+ let score = similarity;
304
219
 
305
220
  const wanted = providerType(format);
306
221
  const type = result.type?.toLowerCase();
@@ -310,22 +225,53 @@ const matchScore = (result: { title?: string; type?: string; similarity?: number
310
225
  }
311
226
 
312
227
  const expected = titleNumbers(title.english || title.romaji);
313
- const found = titleNumbers(result.title);
228
+ const found = titleNumbers(typeof result.title === 'string' ? result.title : undefined);
314
229
  if ([...expected].some((n) => !found.has(n)) || (!expected.size && found.size)) score -= 0.2;
315
230
 
316
231
  return score;
317
232
  };
318
233
 
319
- type FillerEpisode = { 'number': string; 'filler-bool': boolean };
234
+ /**
235
+ * The provider's id for a MAL manga, from MALSync, on the site the provider declares
236
+ * (`capabilities.malSyncSite`). MALSync is optional: it answers 404 for a manga it maps to no site,
237
+ * and that, any other failure, or a provider that declares no site means searching instead.
238
+ */
239
+ const malSyncId = async (provider: MangaParser, malId: unknown): Promise<string | undefined> => {
240
+ const site = provider.capabilities?.malSyncSite;
241
+ if (!site || !malId) return undefined;
242
+ try {
243
+ const { data } = await metaHttp.get(`${MALSYNC_URL}/mal/manga/${encodeURIComponent(String(malId))}`, {
244
+ timeout: ENRICHMENT_TIMEOUT_MS,
245
+ });
246
+ const [page] = Object.values((data?.Sites?.[site] ?? {}) as Record<string, { identifier?: unknown }>);
247
+ return page?.identifier ? String(page.identifier) : undefined;
248
+ } catch {
249
+ return undefined;
250
+ }
251
+ };
252
+
253
+ /** Results less similar than this to the AniList titles are not the manga. */
254
+ const MIN_MANGA_TITLE_SIMILARITY = 0.6;
320
255
 
321
256
  /**
322
- * Sets `isFiller` from a MAL filler list, which lists episodes in order, by the provider's episode
323
- * number. Episodes the list doesn't reach keep `isFiller` unset.
257
+ * The provider's chapters for an AniList manga: those of its MALSync mapping when there is one,
258
+ * else of the search result closest to its titles, searching by the romaji title and then by the
259
+ * English one. Empty when the provider doesn't have it.
324
260
  */
325
- const applyFiller = (episode: IAnimeEpisode, fillers: FillerEpisode[]) => {
326
- const number = toEpisodeNumber(episode.number);
327
- const filler = number === undefined ? undefined : fillers[number - 1];
328
- if (filler) episode.isFiller = Boolean(filler['filler-bool']);
261
+ const findMangaChapters = async (provider: MangaParser, title: ITitle, malId: unknown): Promise<IMangaChapter[]> => {
262
+ const mappedId = await malSyncId(provider, malId);
263
+ if (mappedId) return (await provider.fetchMangaInfo(mappedId)).chapters ?? [];
264
+
265
+ // Providers may show an English title and keep the romaji one in altTitles, so both count.
266
+ const wanted = [title.romaji, title.english];
267
+ const terms = [...new Set(wanted.flatMap((name) => (name ? [name.toLowerCase()] : [])))];
268
+ for (const term of terms) {
269
+ const { results = [] } = ((await provider.search(searchTerm(term))) ?? {}) as Partial<ISearch<IMangaResult>>;
270
+ const match = bestTitleMatch(wanted, results, MIN_MANGA_TITLE_SIMILARITY);
271
+ const chapters = match ? ((await provider.fetchMangaInfo(match.id)).chapters ?? []) : [];
272
+ if (chapters.length > 0) return chapters;
273
+ }
274
+ return [];
329
275
  };
330
276
 
331
277
  class Anilist extends AnimeParser {
@@ -334,68 +280,55 @@ class Anilist extends AnimeParser {
334
280
  protected override logo = 'https://upload.wikimedia.org/wikipedia/commons/6/61/AniList_logo.svg';
335
281
  protected override classPath = 'META.Anilist';
336
282
 
337
- private readonly kitsuGraphqlUrl = 'https://kitsu.io/api/graphql';
338
- private readonly malSyncUrl = 'https://api.malsync.moe';
339
- private readonly anifyUrl = ANIFY_URL;
340
283
  provider: AnimeParser | IAnimeProvider;
341
284
 
342
285
  /**
343
- * This class maps anilist to kitsu with any other anime provider.
344
- * kitsu is used for episode images, titles and description.
345
- * @param provider anime provider (optional) default: Gogoanime
346
- * @param proxyConfig proxy config (optional)
347
- * @param adapter axios adapter (optional)
286
+ * Maps AniList anime to an anime provider's episodes, with ani.zip episode metadata for providers
287
+ * that declare `capabilities.aniZipEpisodes`.
288
+ * @param provider anime provider to find the episodes on (default: AniKoto)
289
+ * @param _proxyConfig ignored: requests go through the library's own client. Kept so existing calls compile.
290
+ * @param _adapter ignored, for the same reason
291
+ * @param customBaseURL site URL for the default AniKoto provider; ignored when `provider` is given
348
292
  */
349
293
  constructor(
350
294
  provider?: AnimeParser | IAnimeProvider,
351
- public proxyConfig?: ProxyConfig,
352
- adapter?: AxiosAdapter,
295
+ _proxyConfig?: ProxyConfig,
296
+ _adapter?: AxiosAdapter,
353
297
  customBaseURL?: string
354
298
  ) {
355
299
  super();
356
- this.provider = provider || new Zoro(customBaseURL);
300
+ this.provider = provider || new AniKoto(customBaseURL);
357
301
  }
358
302
 
359
303
  /**
360
- * @param query Search query
361
- * @param page Page number (optional)
362
- * @param perPage Number of results per page (optional) (default: 15) (max: 50)
304
+ * @param perPage results per page (default: 15, max: 50)
363
305
  */
364
306
  override search = async (query: string, page: number = 1, perPage: number = 15): Promise<ISearch<IAnimeResult>> => {
365
- try {
366
- const { data } = await anilistQuery(anilistSearchQuery(), { search: query, page, perPage, type: 'ANIME' });
367
-
368
- const res: ISearch<IAnimeResult> = {
369
- currentPage: data.data?.Page?.pageInfo?.currentPage,
370
- hasNextPage: data.data?.Page?.pageInfo?.hasNextPage,
371
- results:
372
- data.data?.Page?.media?.map((item: any) => ({
373
- ...mapMediaResult(item),
374
- popularity: item.popularity,
375
- totalEpisodes: item.episodes ?? item.nextAiringEpisode?.episode - 1,
376
- currentEpisodeCount: item?.nextAiringEpisode ? item?.nextAiringEpisode?.episode - 1 : item.episodes,
377
- })) ?? [],
378
- };
379
-
380
- return res;
381
- } catch (err) {
382
- throw anilistError(err);
383
- }
307
+ const data = await anilistQuery(SEARCH_QUERY, { search: query, page, perPage, type: 'ANIME' });
308
+ return toPage(
309
+ data.data?.Page,
310
+ data.data?.Page?.media?.map((item: any) => {
311
+ const { totalEpisodes, currentEpisode } = episodeCounts(item);
312
+ return {
313
+ ...mapMediaResult(item),
314
+ popularity: item.popularity,
315
+ totalEpisodes,
316
+ currentEpisodeCount: currentEpisode,
317
+ };
318
+ }) ?? []
319
+ );
384
320
  };
385
321
 
386
322
  /**
387
- *
388
- * @param query Search query (optional)
389
- * @param type Media type (optional) (default: `ANIME`) (options: `ANIME`, `MANGA`)
390
- * @param page Page number (optional)
391
- * @param perPage Number of results per page (optional) (default: `20`) (max: `50`)
392
- * @param format Format (optional) (options: `TV`, `TV_SHORT`, `MOVIE`, `SPECIAL`, `OVA`, `ONA`, `MUSIC`)
393
- * @param sort Sort (optional) (Default: `[POPULARITY_DESC, SCORE_DESC]`) (options: `POPULARITY_DESC`, `POPULARITY`, `TRENDING_DESC`, `TRENDING`, `UPDATED_AT_DESC`, `UPDATED_AT`, `START_DATE_DESC`, `START_DATE`, `END_DATE_DESC`, `END_DATE`, `FAVOURITES_DESC`, `FAVOURITES`, `SCORE_DESC`, `SCORE`, `TITLE_ROMAJI_DESC`, `TITLE_ROMAJI`, `TITLE_ENGLISH_DESC`, `TITLE_ENGLISH`, `TITLE_NATIVE_DESC`, `TITLE_NATIVE`, `EPISODES_DESC`, `EPISODES`, `ID`, `ID_DESC`)
394
- * @param genres Genres (optional) (options: `Action`, `Adventure`, `Cars`, `Comedy`, `Drama`, `Fantasy`, `Horror`, `Mahou Shoujo`, `Mecha`, `Music`, `Mystery`, `Psychological`, `Romance`, `Sci-Fi`, `Slice of Life`, `Sports`, `Supernatural`, `Thriller`)
395
- * @param id anilist Id (optional)
396
- * @param year Year (optional) e.g. `2022`
397
- * @param status Status (optional) (options: `RELEASING`, `FINISHED`, `NOT_YET_RELEASED`, `CANCELLED`, `HIATUS`)
398
- * @param season Season (optional) (options: `WINTER`, `SPRING`, `SUMMER`, `FALL`)
323
+ * @param type `ANIME` (default) or `MANGA`
324
+ * @param perPage results per page (default: 20, max: 50)
325
+ * @param format `TV`, `TV_SHORT`, `MOVIE`, `SPECIAL`, `OVA`, `ONA` or `MUSIC`
326
+ * @param sort default `[POPULARITY_DESC, SCORE_DESC]`; any of `POPULARITY_DESC`, `POPULARITY`, `TRENDING_DESC`, `TRENDING`, `UPDATED_AT_DESC`, `UPDATED_AT`, `START_DATE_DESC`, `START_DATE`, `END_DATE_DESC`, `END_DATE`, `FAVOURITES_DESC`, `FAVOURITES`, `SCORE_DESC`, `SCORE`, `TITLE_ROMAJI_DESC`, `TITLE_ROMAJI`, `TITLE_ENGLISH_DESC`, `TITLE_ENGLISH`, `TITLE_NATIVE_DESC`, `TITLE_NATIVE`, `EPISODES_DESC`, `EPISODES`, `ID`, `ID_DESC`
327
+ * @param genres any of `Action`, `Adventure`, `Cars`, `Comedy`, `Drama`, `Fantasy`, `Horror`, `Mahou Shoujo`, `Mecha`, `Music`, `Mystery`, `Psychological`, `Romance`, `Sci-Fi`, `Slice of Life`, `Sports`, `Supernatural`, `Thriller`
328
+ * @param id AniList id
329
+ * @param year e.g. `2022`
330
+ * @param status `RELEASING`, `FINISHED`, `NOT_YET_RELEASED`, `CANCELLED` or `HIATUS`
331
+ * @param season `WINTER`, `SPRING`, `SUMMER` or `FALL`
399
332
  */
400
333
  advancedSearch = async (
401
334
  query?: string,
@@ -410,168 +343,70 @@ class Anilist extends AnimeParser {
410
343
  status?: string,
411
344
  season?: string
412
345
  ): Promise<ISearch<IAnimeResult>> => {
413
- const variables = {
346
+ for (const genre of genres ?? []) {
347
+ if (!Object.values(Genres).includes(genre as Genres)) throw new Error(`genre ${genre} is not valid`);
348
+ }
349
+
350
+ const data = await anilistQuery(ADVANCED_SEARCH_QUERY, {
414
351
  search: query,
415
- type: type,
416
- page: page,
352
+ type,
353
+ page,
417
354
  size: perPage,
418
- format: format,
419
- sort: sort,
420
- genres: genres,
421
- id: id,
355
+ format,
356
+ sort,
357
+ genres,
358
+ id,
422
359
  year: year ? `${year}%` : undefined,
423
- status: status,
424
- season: season,
425
- };
426
-
427
- if (genres) {
428
- genres.forEach((genre) => {
429
- if (!Object.values(Genres).includes(genre as Genres)) {
430
- throw new Error(`genre ${genre} is not valid`);
431
- }
432
- });
433
- }
434
-
435
- try {
436
- const { data } = await anilistQuery(anilistAdvancedQuery(), variables);
437
-
438
- const res: ISearch<IAnimeResult> = {
439
- currentPage: data.data?.Page?.pageInfo?.currentPage,
440
- hasNextPage: data.data?.Page?.pageInfo?.hasNextPage,
441
- totalPages: data.data?.Page?.pageInfo?.lastPage,
442
- totalResults: data.data?.Page?.pageInfo?.total,
443
- results: [],
444
- };
445
-
446
- res.results.push(
447
- ...(data.data?.Page?.media?.map((item: any) => ({
360
+ status,
361
+ season,
362
+ });
363
+ const pageInfo = data.data?.Page?.pageInfo;
364
+ return {
365
+ ...toPage(
366
+ data.data?.Page,
367
+ data.data?.Page?.media?.map((item: any) => ({
448
368
  ...mapMediaResult(item),
449
369
  popularity: item.popularity,
450
- totalEpisodes: item.episodes ?? item.nextAiringEpisode?.episode - 1,
451
- currentEpisode: item.nextAiringEpisode?.episode - 1 || item.episodes,
370
+ ...episodeCounts(item),
452
371
  countryOfOrigin: item.countryOfOrigin,
453
- })) ?? [])
454
- );
455
-
456
- return res;
457
- } catch (err) {
458
- throw anilistError(err);
459
- }
372
+ })) ?? []
373
+ ),
374
+ totalPages: pageInfo?.lastPage,
375
+ totalResults: pageInfo?.total,
376
+ };
460
377
  };
461
378
 
462
379
  /**
463
- *
464
- * @param id Anime id
465
- * @param dub to get dubbed episodes (optional) set to `true` to get dubbed episodes. **ONLY WORKS FOR GOGOANIME**
466
- * @param fetchFiller to get filler boolean on the episode object (optional) set to `true` to get filler boolean on the episode object.
380
+ * @param id AniList id
381
+ * @param fetchFiller set `isFiller` on the episodes, from the MAL filler list (default: `false`)
467
382
  */
468
383
  override fetchAnimeInfo = async (id: string, fetchFiller: boolean = false): Promise<IAnimeInfo> => {
469
- try {
470
- const { data } = await anilistQuery(anilistMediaDetailQuery(), { id: Number(id) });
471
- const animeInfo: IAnimeInfo = { id, ...mapAnimeDetail(data.data.Media) };
472
- const title = mapTitle(data.data.Media.title);
473
- animeInfo.episodes = await this.fetchDefaultEpisodeList({
474
- idMal: animeInfo.malId! as number,
475
- format: data.data.Media.format,
476
- season: data.data.Media.season,
477
- startDate: { year: parseInt(animeInfo.releaseDate!) },
478
- title: {
479
- english: title.english!,
480
- romaji: title.romaji!,
481
- },
482
- externalLinks: data.data.Media.externalLinks?.filter((link: any) => link.type === 'STREAMING'),
483
- });
484
-
485
- const fillerEpisodes =
486
- fetchFiller && animeInfo.malId ? await this.fetchFillerEpisodes(animeInfo.malId as number) : [];
487
-
488
- animeInfo.episodes = animeInfo.episodes?.map((episode: IAnimeEpisode, index) => {
489
- if (!episode.image) episode.image = animeInfo.image;
490
- applyFiller(episode, fillerEpisodes);
491
-
492
- // No ani.zip merge here, so the key comes from the provider's number, as it does in
493
- // fetchEpisodesListById for episodes ani.zip doesn't match.
494
- episode.uniqueId = episodeUniqueId(id, { episode }, index);
495
- return episode;
496
- });
497
-
498
- return animeInfo;
499
- } catch (err) {
500
- throw anilistError(err);
501
- }
384
+ const aniZipRequest = this.requestAniZip(id);
385
+ const media = (await anilistQuery(MEDIA_DETAIL_QUERY, { id: Number(id) })).data.Media;
386
+ return { id, ...mapAnimeDetail(media), episodes: await this.findEpisodes(id, media, fetchFiller, aniZipRequest) };
502
387
  };
503
388
 
504
- /**
505
- *
506
- * @param episodeId Episode id
507
- */
508
- override fetchEpisodeSources = async (episodeId: string, ...args: any): Promise<ISource> => {
509
- try {
510
- return await this.provider.fetchEpisodeSources(episodeId, ...args);
511
- } catch (err) {
512
- throw MetaError.from('provider', err, `Failed to fetch episode sources from ${this.provider.name}: ${err}`);
513
- }
514
- };
389
+ override fetchEpisodeSources = (episodeId: string, ...args: any): Promise<ISource> =>
390
+ callProvider(this.provider, 'episode sources', () => this.provider.fetchEpisodeSources(episodeId, ...args));
515
391
 
516
- /**
517
- *
518
- * @param episodeId Episode id
519
- */
520
- override fetchEpisodeServers = async (episodeId: string): Promise<IEpisodeServer[]> => {
521
- try {
522
- return await this.provider.fetchEpisodeServers(episodeId);
523
- } catch (err) {
524
- throw MetaError.from('provider', err, `Failed to fetch episode servers from ${this.provider.name}: ${err}`);
525
- }
526
- };
392
+ override fetchEpisodeServers = (episodeId: string, ...args: any): Promise<IEpisodeServer[]> =>
393
+ callProvider(this.provider, 'episode servers', () => this.provider.fetchEpisodeServers(episodeId, ...args));
527
394
 
528
- /**
529
- * @param page page number to search for (optional)
530
- * @param perPage number of results per page (optional)
531
- */
532
395
  fetchTrendingAnime = async (page: number = 1, perPage: number = 10): Promise<ISearch<IAnimeResult>> => {
533
- try {
534
- const { data } = await anilistQuery(anilistTrendingQuery(), { page, perPage });
535
-
536
- const res: ISearch<IAnimeResult> = {
537
- currentPage: data.data.Page.pageInfo.currentPage,
538
- hasNextPage: data.data.Page.pageInfo.hasNextPage,
539
- results: data.data.Page.media.map(mapBrowseResult),
540
- };
541
- return res;
542
- } catch (err) {
543
- throw anilistError(err);
544
- }
396
+ const data = await anilistQuery(TRENDING_QUERY, { page, perPage });
397
+ return toPage(data.data.Page, data.data.Page.media.map(mapBrowseResult));
545
398
  };
546
399
 
547
- /**
548
- *
549
- * @param page page number to search for (optional)
550
- * @param perPage number of results per page (optional)
551
- */
552
400
  fetchPopularAnime = async (page: number = 1, perPage: number = 10): Promise<ISearch<IAnimeResult>> => {
553
- try {
554
- const { data } = await anilistQuery(anilistPopularQuery(), { page, perPage });
555
-
556
- const res: ISearch<IAnimeResult> = {
557
- currentPage: data.data.Page.pageInfo.currentPage,
558
- hasNextPage: data.data.Page.pageInfo.hasNextPage,
559
- results: data.data.Page.media.map(mapBrowseResult),
560
- };
561
- return res;
562
- } catch (err) {
563
- throw anilistError(err);
564
- }
401
+ const data = await anilistQuery(POPULAR_QUERY, { page, perPage });
402
+ return toPage(data.data.Page, data.data.Page.media.map(mapBrowseResult));
565
403
  };
566
404
 
567
405
  /**
568
- *
569
- * @param page page number (optional)
570
- * @param perPage number of results per page (optional)
571
- * @param weekStart First day of the schedule, its next occurrence counting today (optional) (default: today) (options: 2 = Monday, 3 = Tuesday, 4 = Wednesday, 5 = Thursday, 6 = Friday, 0 = Saturday, 1 = Sunday) you can use either the number or the day's name
572
- * @param weekEnd Last day of the schedule, included, on or after weekStart (optional) (default: the day before today, so a full week) similar to weekStart
573
- * @param notYetAired if true will return anime that have not yet aired (optional)
574
- * @returns the next airing episodes
406
+ * The episodes airing in a window of days.
407
+ * @param weekStart first day of the window, its next occurrence counting today (default: today): `2` = Monday, `3` = Tuesday, `4` = Wednesday, `5` = Thursday, `6` = Friday, `0` = Saturday, `1` = Sunday, or the day's name
408
+ * @param weekEnd last day of the window, included, on or after weekStart (default: the day before today, so a full week); like weekStart
409
+ * @param notYetAired only episodes that haven't aired yet
575
410
  */
576
411
  fetchAiringSchedule = async (
577
412
  page: number = 1,
@@ -582,273 +417,147 @@ class Anilist extends AnimeParser {
582
417
  ): Promise<ISearch<IAnimeResult>> => {
583
418
  const { from, to } = airingWindow(weekStart, weekEnd);
584
419
 
585
- try {
586
- // AniList's bounds are exclusive, so one second earlier keeps an episode airing at midnight.
587
- const { data } = await anilistQuery(anilistAiringScheduleQuery(), {
588
- page,
589
- perPage,
590
- notYetAired,
591
- airingAtGreater: from - 1,
592
- airingAtLesser: to,
593
- });
594
-
595
- const res: ISearch<IAnimeResult> = {
596
- currentPage: data.data.Page.pageInfo.currentPage,
597
- hasNextPage: data.data.Page.pageInfo.hasNextPage,
598
- results: data.data.Page.airingSchedules.map((item: any) => ({
599
- ...mapMediaResult(item.media),
600
- episode: item.episode,
601
- airingAt: item.airingAt,
602
- country: item.media.countryOfOrigin,
603
- })),
604
- };
605
- return res;
606
- } catch (err) {
607
- throw anilistError(err);
608
- }
420
+ // AniList's bounds are exclusive, so one second earlier keeps an episode airing at midnight.
421
+ const data = await anilistQuery(AIRING_SCHEDULE_QUERY, {
422
+ page,
423
+ perPage,
424
+ notYetAired,
425
+ airingAtGreater: from - 1,
426
+ airingAtLesser: to,
427
+ });
428
+ return toPage(
429
+ data.data.Page,
430
+ data.data.Page.airingSchedules.map((item: any) => ({
431
+ ...mapMediaResult(item.media),
432
+ episode: item.episode,
433
+ airingAt: item.airingAt,
434
+ country: item.media.countryOfOrigin,
435
+ }))
436
+ );
609
437
  };
610
438
 
611
439
  /**
612
- *
613
- * @param genres An array of genres to filter by (optional) genres: [`Action`, `Adventure`, `Cars`, `Comedy`, `Drama`, `Fantasy`, `Horror`, `Mahou Shoujo`, `Mecha`, `Music`, `Mystery`, `Psychological`, `Romance`, `Sci-Fi`, `Slice of Life`, `Sports`, `Supernatural`, `Thriller`]
614
- * @param page page number (optional)
615
- * @param perPage number of results per page (optional)
440
+ * @param genres any of `Action`, `Adventure`, `Cars`, `Comedy`, `Drama`, `Fantasy`, `Horror`, `Mahou Shoujo`, `Mecha`, `Music`, `Mystery`, `Psychological`, `Romance`, `Sci-Fi`, `Slice of Life`, `Sports`, `Supernatural`, `Thriller`
616
441
  */
617
442
  fetchAnimeGenres = async (genres: string[] | Genres[], page: number = 1, perPage: number = 20) => {
618
443
  if (genres.length === 0) throw new Error('No genres specified');
619
-
620
444
  for (const genre of genres) if (!Object.values(Genres).includes(genre as Genres)) throw new Error('Invalid genre');
621
445
 
622
- try {
623
- const { data } = await anilistQuery(anilistGenresQuery(), { genres, page, perPage });
624
-
625
- const res: ISearch<IAnimeResult> = {
626
- currentPage: data.data.Page.pageInfo.currentPage,
627
- hasNextPage: data.data.Page.pageInfo.hasNextPage,
628
- results: data.data.Page.media.map(mapBrowseResult),
629
- };
630
- return res;
631
- } catch (err) {
632
- throw anilistError(err);
633
- }
446
+ const data = await anilistQuery(GENRES_QUERY, { genres, page, perPage });
447
+ return toPage<IAnimeResult>(data.data.Page, data.data.Page.media.map(mapBrowseResult));
634
448
  };
635
449
 
636
- private findAnimeRaw = async (title: ITitle, format?: string) => {
637
- const searchTerm = title?.romaji || title?.english || title?.userPreferred || '';
638
- const findAnime = (await this.provider.search(searchTerm)) as ISearch<IAnimeResult>;
639
-
640
- if (!findAnime?.results) {
641
- return {} as IAnimeEpisode[];
642
- }
643
-
644
- // Run similar title searches in parallel
645
- const [mappedEng, mappedRom] = await Promise.all([
646
- Promise.resolve(findSimilarTitles(title?.english || '', findAnime.results)),
647
- Promise.resolve(findSimilarTitles(title?.romaji || '', findAnime.results)),
648
- ]);
649
- // console.log({ mappedEng, mappedRom });
650
- // Use Set for efficient deduplication
651
- const uniqueResults = Array.from(new Set([...mappedEng, ...mappedRom].map((item) => JSON.stringify(item)))).map(
652
- (str) => JSON.parse(str)
653
- );
654
-
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));
657
- const mappings: any = {};
658
- for (const obj of uniqueResults) {
659
- const match = obj.title.replace(/\(TV\)/g, '').match(/\(([^)0-9]+)\)/);
660
- const key = match ? match[1].replace(/\s+/g, '-').toLowerCase() : 'sub';
661
-
662
- if (!mappings[key]) {
663
- mappings[key] = obj.id;
664
- }
665
-
666
- // Early return if we have both sub and dub
667
- if (mappings.sub && mappings.dub) break;
668
- }
669
- // console.log('mappings', mappings);
670
- // console.time('animeinfo');
671
- const animeInfo = await this.provider.fetchAnimeInfo(mappings.sub || mappings.dub);
672
- // console.timeEnd('animeinfo');
673
- return animeInfo.episodes as IAnimeEpisode[];
674
- };
675
- /**
676
- * @returns a random anime
677
- */
450
+ /** The info of an anime picked from a list of AniList ids kept on GitHub (5H4D0WILA/IDFetch). */
678
451
  fetchRandomAnime = async (): Promise<IAnimeInfo> => {
452
+ let ids: string[];
679
453
  try {
680
- const { data: data } = await metaHttp.get('https://raw.githubusercontent.com/5H4D0WILA/IDFetch/main/ids.txt');
681
-
682
- const ids = data?.trim().split('\n');
683
- const selectedAnime = Math.floor(Math.random() * ids.length);
684
- return await this.fetchAnimeInfo(ids[selectedAnime]);
454
+ const { data } = await metaHttp.get('https://raw.githubusercontent.com/5H4D0WILA/IDFetch/main/ids.txt');
455
+ ids = String(data ?? '')
456
+ .split('\n')
457
+ .map((id) => id.trim())
458
+ .filter(Boolean);
685
459
  } catch (err) {
686
- throw anilistError(err);
460
+ throw MetaError.from('github', err);
687
461
  }
462
+ if (ids.length === 0) throw new MetaError('The list of random anime ids is empty', { source: 'github' });
463
+ return this.fetchAnimeInfo(ids[Math.floor(Math.random() * ids.length)]!);
688
464
  };
689
465
 
690
466
  /**
691
- * @deprecated Reads from Anify, which is offline, so this always fails.
692
- * @param provider The provider to get the episode Ids from (optional) default: `gogoanime` (options: `gogoanime`, `zoro`)
693
- * @param page page number (optional)
694
- * @param perPage number of results per page (optional)
467
+ * The provider's episodes for the AniList entry: those of the search result whose title is
468
+ * closest (see matchScore), the sub entry before the dub. Empty when no result is close enough; a
469
+ * failing provider rejects with a provider MetaError whose cause is a ProviderError.
695
470
  */
696
- fetchRecentEpisodes = async (
697
- provider: 'gogoanime' | 'zoro' = 'gogoanime',
698
- page: number = 1,
699
- perPage: number = 25
700
- ): Promise<ISearch<IAnimeResult>> => {
471
+ private findProviderEpisodes = async (title: ITitle, format?: string): Promise<IAnimeEpisode[]> => {
701
472
  try {
702
- const { data } = await metaHttp.get(
703
- `${this.anifyUrl}/recent?page=${encodeURIComponent(page)}&perPage=${encodeURIComponent(perPage)}&type=anime`
473
+ const search = (await this.provider.search(title.romaji || title.english || title.userPreferred || '')) as
474
+ | ISearch<IAnimeResult>
475
+ | undefined;
476
+ const score = ({ result, similarity }: TitleMatch<IAnimeResult>) => matchScore(result, similarity, title, format);
477
+ const match = bestTitleMatch(
478
+ [title.english, title.romaji],
479
+ (search?.results ?? []).filter((result) => audioRank(result) > 0),
480
+ MIN_ANIME_TITLE_SIMILARITY,
481
+ {
482
+ normalize: animeTitle,
483
+ compare: (a, b) =>
484
+ audioRank(b.result) - audioRank(a.result) || score(b) - score(a) || subCount(b.result) - subCount(a.result),
485
+ }
704
486
  );
705
-
706
- const results: IAnimeInfo[] = data?.map((item: any) => {
707
- return {
708
- id: item.id.toString(),
709
- malId: item.mappings.find((item: any) => item.providerType === 'META' && item.providerId === 'mal')?.id,
710
- title: {
711
- romaji: item.title?.romaji,
712
- english: item.title?.english,
713
- native: item.title?.native,
714
- // userPreferred: (_f = item.title) === null || _f === void 0 ? void 0 : _f.userPreferred,
715
- },
716
- image: item.coverImage ?? item.bannerImage,
717
- rating: item.averageScore,
718
- color: item.anime?.color,
719
- episodeId: `${
720
- provider === 'gogoanime'
721
- ? item.episodes.data
722
- .find((source: any) => source.providerId.toLowerCase() === 'gogoanime')
723
- ?.episodes.pop()?.id
724
- : item.episodes.data.find((source: any) => source.providerId.toLowerCase() === 'zoro')?.episodes.pop()?.id
725
- }`,
726
- episodeTitle: item.episodes.latest.latestTitle ?? `Episode ${item.currentEpisode}`,
727
- episodeNumber: item.currentEpisode,
728
- genres: item.genre,
729
- type: item.format,
730
- };
731
- });
732
- // results = results.filter((item) => item.episodeNumber !== 0 &&
733
- // item.episodeId.replace('-enime', '').length > 0 &&
734
- // item.episodeId.replace('-enime', '') !== 'undefined');
735
- return {
736
- currentPage: page,
737
- // hasNextPage: meta.lastPage !== page,
738
- // totalPages: meta.lastPage,
739
- totalResults: results?.length,
740
- results: results,
741
- };
742
- } catch (err) {
743
- throw MetaError.from('provider', err);
744
- }
745
- };
746
-
747
- private fetchDefaultEpisodeList = async (Media: {
748
- idMal: number;
749
- format?: string;
750
- title: { english: string; romaji: string };
751
- season: string;
752
- startDate: { year: number };
753
- externalLinks?: any;
754
- }) => {
755
- try {
756
- return await this.findAnimeRaw({ english: Media.title?.english!, romaji: Media.title?.romaji! }, Media.format);
487
+ if (!match) return [];
488
+ return (await this.provider.fetchAnimeInfo(match.id)).episodes ?? [];
757
489
  } catch (err) {
758
- throw MetaError.from('provider', err);
490
+ throw MetaError.from('provider', ProviderError.from(err, { provider: this.provider.name }));
759
491
  }
760
492
  };
761
493
 
762
494
  /**
763
- * @param id anilist id
764
- * @param fetchFiller to get filler boolean on the episode object (optional) set to `true` to get filler boolean on the episode object.
765
- * @returns episode list **(without anime info)**, every episode with a `uniqueId`
495
+ * The provider's episodes for an AniList media, merged with ani.zip when the provider declares
496
+ * `aniZipEpisodes`, each with the cover as its fallback image, its filler flag and its uniqueId.
497
+ * fetchAnimeInfo and fetchEpisodesListById both return these, so they key every episode alike.
498
+ * @param media the AniList media: `title`, `format`, `idMal` and `coverImage` are read
499
+ * @param aniZipRequest ani.zip's mappings, requested alongside the caller's AniList query
766
500
  */
767
- fetchEpisodesListById = async (id: string, fetchFiller: boolean = false): Promise<IMetaAnimeEpisode[]> => {
768
- // ani.zip only needs the AniList id, so request it alongside the AniList query. It is
769
- // optional enrichment: if it fails or times out, the provider's episodes are still returned.
770
- const aniZipRequest = this.usesAniZipEpisodes()
771
- ? metaHttp
772
- .get(`https://api.ani.zip/mappings?anilist_id=${encodeURIComponent(id)}`, { timeout: ENRICHMENT_TIMEOUT_MS })
773
- .then((res) => res.data)
774
- : undefined;
775
- // Don't surface an unhandled rejection if the AniList query below fails first.
776
- aniZipRequest?.catch(() => undefined);
777
-
778
- const {
779
- data: {
780
- data: { Media },
781
- },
782
- } = await anilistQuery(
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} } }`,
784
- { id: Number(id) }
785
- ).catch((err) => {
786
- throw anilistError(err);
787
- });
788
-
789
- const fillerRequest = fetchFiller && Media.idMal ? this.fetchFillerEpisodes(Media.idMal) : Promise.resolve([]);
790
-
791
- let episodes: MergedEpisode[];
792
- if (aniZipRequest) {
793
- const [aniZip, provider] = await Promise.allSettled([aniZipRequest, this.fetchDefaultEpisodeList(Media)]);
794
- if (provider.status === 'rejected') throw provider.reason;
795
-
796
- const providerEpisodes = Array.isArray(provider.value) ? provider.value : [];
797
- episodes =
798
- aniZip.status === 'fulfilled'
799
- ? this.mergeAniZipEpisodes(aniZip.value, providerEpisodes)
800
- : providerEpisodes.map((episode) => ({ episode }));
801
- } else {
802
- const providerEpisodes = await this.fetchDefaultEpisodeList(Media);
803
- episodes = (Array.isArray(providerEpisodes) ? providerEpisodes : []).map((episode) => ({ episode }));
804
- }
501
+ private findEpisodes = async (
502
+ id: string,
503
+ media: any,
504
+ fetchFiller: boolean,
505
+ aniZipRequest: Promise<unknown>
506
+ ): Promise<IMetaAnimeEpisode[]> => {
507
+ const fillerRequest: Promise<FillerEpisode[]> =
508
+ fetchFiller && media.idMal ? fetchFillerEpisodes(media.idMal) : Promise.resolve([]);
509
+
510
+ const providerEpisodes = await this.findProviderEpisodes(mapTitle(media.title), media.format);
511
+ const aniZip = await aniZipRequest;
512
+ const episodes: MergedEpisode[] = aniZip
513
+ ? this.mergeAniZipEpisodes(aniZip, providerEpisodes)
514
+ : providerEpisodes.map((episode) => ({ episode }));
805
515
 
806
516
  const fillerEpisodes = await fillerRequest;
807
- const cover = pickCover(Media.coverImage);
517
+ const cover = pickCover(media.coverImage);
808
518
 
809
519
  return episodes.map((merged, index): IMetaAnimeEpisode => {
810
520
  const { episode } = merged;
811
521
  if (!episode.image && cover) episode.image = cover;
812
522
  applyFiller(episode, fillerEpisodes);
813
-
814
523
  // The one place uniqueId is set, so matched, unmatched and un-enriched episodes follow one rule.
815
524
  return { ...episode, uniqueId: episodeUniqueId(id, merged, index) };
816
525
  });
817
526
  };
818
527
 
819
528
  /**
820
- * Whether to merge the provider's episodes with ani.zip metadata. Providers declare this in
821
- * `capabilities`, so registry-only providers (no class) can opt in. Code that predates
822
- * capabilities falls back to the built-in provider classes.
529
+ * ani.zip's mappings for an AniList id, for providers that declare `aniZipEpisodes`. They are
530
+ * optional enrichment: undefined when the request fails or times out.
823
531
  */
824
- private usesAniZipEpisodes = () => {
825
- const capabilities = (this.provider as { capabilities?: ProviderCapabilities }).capabilities;
826
- if (capabilities) return Boolean(capabilities.aniZipEpisodes);
827
- return (
828
- this.provider instanceof Zoro ||
829
- this.provider instanceof AnimeKai ||
830
- this.provider instanceof AnimePahe ||
831
- this.provider instanceof AniKoto
832
- );
833
- };
532
+ private requestAniZip = (id: string): Promise<unknown> =>
533
+ this.usesAniZipEpisodes()
534
+ ? metaHttp
535
+ .get(`https://api.ani.zip/mappings?anilist_id=${encodeURIComponent(id)}`, { timeout: ENRICHMENT_TIMEOUT_MS })
536
+ .then(
537
+ (res) => res.data,
538
+ () => undefined
539
+ )
540
+ : Promise.resolve(undefined);
834
541
 
835
- /** Optional filler flags by episode index; an empty list if the source is missing or unreachable. */
836
- private fetchFillerEpisodes = async (malId: number): Promise<FillerEpisode[]> => {
837
- try {
838
- const { data } = await metaHttp.get(
839
- `https://raw.githubusercontent.com/saikou-app/mal-id-filler-list/main/fillers/${encodeURIComponent(malId)}.json`,
840
- { timeout: ENRICHMENT_TIMEOUT_MS }
841
- );
842
- return Array.isArray(data?.episodes) ? data.episodes : [];
843
- } catch {
844
- return [];
845
- }
542
+ /**
543
+ * @param id AniList id
544
+ * @param fetchFiller set `isFiller` on the episodes, from the MAL filler list (default: `false`)
545
+ * @returns the episode list without the anime info, every episode with a `uniqueId`
546
+ */
547
+ fetchEpisodesListById = async (id: string, fetchFiller: boolean = false): Promise<IMetaAnimeEpisode[]> => {
548
+ const aniZipRequest = this.requestAniZip(id);
549
+ const { Media } = (await anilistQuery(EPISODES_MEDIA_QUERY, { id: Number(id) })).data;
550
+ return this.findEpisodes(id, Media, fetchFiller, aniZipRequest);
846
551
  };
847
552
 
553
+ /** Whether to merge the provider's episodes with ani.zip metadata, as the provider declares. */
554
+ private usesAniZipEpisodes = () =>
555
+ Boolean((this.provider as { capabilities?: ProviderCapabilities }).capabilities?.aniZipEpisodes);
556
+
848
557
  /**
849
- * Overlay ani.zip titles, descriptions, images and TVDB numbers onto the provider's episodes. Only
850
- * numeric ani.zip keys (AniDB regular episodes) take part, so specials (`S1`, `O1`…) never land
851
- * on a regular episode. The provider's `number` is kept as is.
558
+ * Overlay ani.zip titles, descriptions, images, and AniDB and TVDB numbers onto the provider's
559
+ * episodes. Only numeric ani.zip keys (AniDB regular episodes) take part, so specials (`S1`,
560
+ * `O1`…) never land on a regular episode. The provider's `number` is kept as is.
852
561
  */
853
562
  private mergeAniZipEpisodes = (animeMetaData: any, providerEpisodes: IAnimeEpisode[]): MergedEpisode[] => {
854
563
  const entries: AniZipEntry[] = (
@@ -948,6 +657,7 @@ class Anilist extends AnimeParser {
948
657
  // A provider's hash describes its own image, not ani.zip's.
949
658
  imageHash: entry.image ? undefined : providerEp.imageHash,
950
659
  releaseDate: entry.releaseDate || providerEp.releaseDate,
660
+ aniDbNumber: entry.key,
951
661
  tvdbNumber: entry.tvdbNumber,
952
662
  absoluteNumber: entry.absoluteNumber,
953
663
  },
@@ -956,41 +666,26 @@ class Anilist extends AnimeParser {
956
666
  };
957
667
 
958
668
  /**
959
- * @param id anilist id
960
- * @returns anilist data for the anime **(without episodes)** (use `fetchEpisodesListById` to get the episodes) (use `fetchAnimeInfo` to get both)
669
+ * @param id AniList id
670
+ * @returns the AniList info without episodes (`fetchEpisodesListById` gives them, `fetchAnimeInfo` both)
961
671
  */
962
- fetchAnilistInfoById = async (id: string) => {
963
- try {
964
- const { data } = await anilistQuery(anilistMediaDetailQuery(), { id: Number(id) });
965
- const animeInfo: IAnimeInfo = { id, ...mapAnimeDetail(data.data.Media) };
966
- return animeInfo;
967
- } catch (err) {
968
- throw anilistError(err);
969
- }
672
+ fetchAnilistInfoById = async (id: string): Promise<IAnimeInfo> => {
673
+ const data = await anilistQuery(MEDIA_DETAIL_QUERY, { id: Number(id) });
674
+ return { id, ...mapAnimeDetail(data.data.Media) };
970
675
  };
971
676
 
972
- /**
973
- * To get Staff details by anilistId
974
- * @param id staff id from anilist
975
- *
976
- */
677
+ /** @param id AniList staff id */
977
678
  fetchStaffById = async (id: number) => {
978
- const staffInfo: IStaff = {
979
- id: String(id),
980
- name: { first: '', last: '', native: '', full: '' },
981
- };
679
+ const data = await anilistQuery(STAFF_QUERY, { id: Number(id) });
680
+ const staff = data.data.Staff;
982
681
 
983
- try {
984
- const { data } = await anilistQuery(anilistStaffInfoQuery(), { id: Number(id) });
985
- const staff = data.data.Staff;
986
-
987
- staffInfo.id = staff?.id;
988
- staffInfo.name = staff?.name;
989
- staffInfo.image = staff?.image;
990
- staffInfo.description = staff?.description;
991
- staffInfo.siteUrl = staff?.siteUrl;
992
-
993
- staffInfo.roles = staff?.staffMedia.edges.map((media: any) => ({
682
+ const staffInfo: IStaff = {
683
+ id: staff?.id,
684
+ name: staff?.name,
685
+ image: staff?.image,
686
+ description: staff?.description,
687
+ siteUrl: staff?.siteUrl,
688
+ roles: staff?.staffMedia.edges.map((media: any) => ({
994
689
  id: media?.node?.id,
995
690
  title: media?.node?.title,
996
691
  type: media?.node?.type,
@@ -1000,278 +695,151 @@ class Anilist extends AnimeParser {
1000
695
  medium: media?.node?.coverImage?.medium,
1001
696
  },
1002
697
  color: media?.node?.coverImage?.color,
1003
- }));
1004
-
1005
- return staffInfo;
1006
- } catch (err) {
1007
- throw anilistError(err);
1008
- }
698
+ })),
699
+ };
700
+ return staffInfo;
1009
701
  };
1010
702
 
1011
- /**
1012
- *
1013
- * @param id character id from anilist
1014
- */
703
+ /** @param id AniList character id */
1015
704
  fetchCharacterInfoById = async (id: string) => {
1016
- try {
1017
- const {
1018
- data: {
1019
- data: { Character },
1020
- },
1021
- } = await anilistQuery(anilistCharacterQuery(), { id: Number(id) });
1022
-
1023
- const height = Character.description.match(/__Height:__(.*)/)?.[1].trim();
1024
- const weight = Character.description.match(/__Weight:__(.*)/)?.[1].trim();
1025
- const hairColor = Character.description.match(/__Hair Color:__(.*)/)?.[1].trim();
1026
- const eyeColor = Character.description.match(/__Eye Color:__(.*)/)?.[1].trim();
1027
- const relatives = Character.description
1028
- .match(/__Relatives:__(.*)/)?.[1]
1029
- .trim()
1030
- .split(/(, \[)/g)
1031
- .filter((g: string) => !g.includes(', ['))
1032
- .map((r: string) => ({
1033
- id: r.match(/\/(\d+)/)?.[1],
1034
- name: r.match(/([^)]+)\]/)?.[1]!.replace(/\[/g, ''),
1035
- relationship: r.match(/\(([^)]+)\).*?(\(([^)]+)\))/)?.[3],
1036
- }));
1037
- const race = Character.description
1038
- .match(/__Race:__(.*)/)?.[1]
1039
- .split(', ')
1040
- .map((r: string) => r.trim());
1041
- const rank = Character.description.match(/__Rank:__(.*)/)?.[1];
1042
- const occupation = Character.description.match(/__Occupation:__(.*)/)?.[1];
1043
- const previousPosition = Character.description.match(/__Previous Position:__(.*)/)?.[1]?.trim();
1044
- const partner = Character.description
1045
- .match(/__Partner:__(.*)/)?.[1]
1046
- .split(/(, \[)/g)
1047
- .filter((g: string) => !g.includes(', ['))
1048
- .map((r: string) => ({
1049
- id: r.match(/\/(\d+)/)?.[1],
1050
- name: r.match(/([^)]+)\]/)?.[1]!.replace(/\[/g, ''),
1051
- }));
1052
- const dislikes = Character.description.match(/__Dislikes:__(.*)/)?.[1];
1053
- const sign = Character.description.match(/__Sign:__(.*)/)?.[1];
1054
- const zodicSign = Character.description.match(/__Zodiac sign:__(.*)/)?.[1]?.trim();
1055
- const zodicAnimal = Character.description.match(/__Zodiac Animal:__(.*)/)?.[1]?.trim();
1056
- const themeSong = Character.description.match(/__Theme Song:__(.*)/)?.[1]?.trim();
1057
- Character.description = Character.description.replace(
1058
- /__Theme Song:__(.*)\n|__Race:__(.*)\n|__Height:__(.*)\n|__Relatives:__(.*)\n|__Rank:__(.*)\n|__Zodiac sign:__(.*)\n|__Zodiac Animal:__(.*)\n|__Weight:__(.*)\n|__Eye Color:__(.*)\n|__Hair Color:__(.*)\n|__Dislikes:__(.*)\n|__Sign:__(.*)\n|__Partner:__(.*)\n|__Previous Position:__(.*)\n|__Occupation:__(.*)\n/gm,
1059
- ''
1060
- );
705
+ const { Character } = (await anilistQuery(CHARACTER_QUERY, { id: Number(id) })).data;
706
+ // The description holds the character's details as `__Label:__ value` lines, removed below.
707
+ const details: string = Character.description ?? '';
708
+
709
+ const height = details.match(/__Height:__(.*)/)?.[1]?.trim();
710
+ const weight = details.match(/__Weight:__(.*)/)?.[1]?.trim();
711
+ const hairColor = details.match(/__Hair Color:__(.*)/)?.[1]?.trim();
712
+ const eyeColor = details.match(/__Eye Color:__(.*)/)?.[1]?.trim();
713
+ const relatives = details
714
+ .match(/__Relatives:__(.*)/)?.[1]
715
+ ?.trim()
716
+ .split(/(, \[)/g)
717
+ .filter((g: string) => !g.includes(', ['))
718
+ .map((r: string) => ({
719
+ id: r.match(/\/(\d+)/)?.[1],
720
+ name: r.match(/([^)]+)\]/)?.[1]!.replace(/\[/g, ''),
721
+ relationship: r.match(/\(([^)]+)\).*?(\(([^)]+)\))/)?.[3],
722
+ }));
723
+ const race = details
724
+ .match(/__Race:__(.*)/)?.[1]
725
+ ?.split(', ')
726
+ .map((r: string) => r.trim());
727
+ const rank = details.match(/__Rank:__(.*)/)?.[1];
728
+ const occupation = details.match(/__Occupation:__(.*)/)?.[1];
729
+ const previousPosition = details.match(/__Previous Position:__(.*)/)?.[1]?.trim();
730
+ const partner = details
731
+ .match(/__Partner:__(.*)/)?.[1]
732
+ ?.split(/(, \[)/g)
733
+ .filter((g: string) => !g.includes(', ['))
734
+ .map((r: string) => ({
735
+ id: r.match(/\/(\d+)/)?.[1],
736
+ name: r.match(/([^)]+)\]/)?.[1]!.replace(/\[/g, ''),
737
+ }));
738
+ const dislikes = details.match(/__Dislikes:__(.*)/)?.[1];
739
+ const sign = details.match(/__Sign:__(.*)/)?.[1];
740
+ const zodicSign = details.match(/__Zodiac sign:__(.*)/)?.[1]?.trim();
741
+ const zodicAnimal = details.match(/__Zodiac Animal:__(.*)/)?.[1]?.trim();
742
+ const themeSong = details.match(/__Theme Song:__(.*)/)?.[1]?.trim();
743
+ const description = details.replace(
744
+ /__Theme Song:__(.*)\n|__Race:__(.*)\n|__Height:__(.*)\n|__Relatives:__(.*)\n|__Rank:__(.*)\n|__Zodiac sign:__(.*)\n|__Zodiac Animal:__(.*)\n|__Weight:__(.*)\n|__Eye Color:__(.*)\n|__Hair Color:__(.*)\n|__Dislikes:__(.*)\n|__Sign:__(.*)\n|__Partner:__(.*)\n|__Previous Position:__(.*)\n|__Occupation:__(.*)\n/gm,
745
+ ''
746
+ );
1061
747
 
1062
- const characterInfo = {
1063
- id: Character.id,
1064
- name: {
1065
- first: Character.name?.first,
1066
- last: Character.name?.last,
1067
- full: Character.name?.full,
1068
- native: Character.name?.native,
1069
- userPreferred: Character.name?.userPreferred,
1070
- alternative: Character.name?.alternative,
1071
- alternativeSpoiler: Character.name?.alternativeSpoiler,
1072
- },
1073
- image: Character.image?.large ?? Character.image?.medium,
1074
- description: Character.description,
1075
- gender: Character.gender,
1076
- dateOfBirth: {
1077
- year: Character.dateOfBirth?.year,
1078
- month: Character.dateOfBirth?.month,
1079
- day: Character.dateOfBirth?.day,
1080
- },
1081
- bloodType: Character.bloodType,
1082
- age: Character.age,
1083
- hairColor: hairColor,
1084
- eyeColor: eyeColor,
1085
- height: height,
1086
- weight: weight,
1087
- occupation: occupation,
1088
- partner: partner,
1089
- relatives: relatives,
1090
- race: race,
1091
- rank: rank,
1092
- previousPosition: previousPosition,
1093
- dislikes: dislikes,
1094
- sign: sign,
1095
- zodicSign: zodicSign,
1096
- zodicAnimal: zodicAnimal,
1097
- themeSong: themeSong,
1098
- relations: Character.media.edges?.map((v: any) => ({
1099
- id: v.node.id,
1100
- malId: v.node.idMal,
1101
- role: v.characterRole,
1102
- title: mapTitle(v.node.title),
1103
- status: mapStatus(v.node.status),
1104
- episodes: v.node.episodes,
1105
- image: pickCover(v.node.coverImage),
1106
- rating: v.node.averageScore,
1107
- releaseDate: v.node.startDate?.year,
1108
- type: v.node.format,
1109
- color: v.node.coverImage?.color,
1110
- })),
1111
- };
748
+ const characterInfo = {
749
+ id: Character.id,
750
+ name: {
751
+ first: Character.name?.first,
752
+ last: Character.name?.last,
753
+ full: Character.name?.full,
754
+ native: Character.name?.native,
755
+ userPreferred: Character.name?.userPreferred,
756
+ alternative: Character.name?.alternative,
757
+ alternativeSpoiler: Character.name?.alternativeSpoiler,
758
+ },
759
+ image: Character.image?.large ?? Character.image?.medium,
760
+ description,
761
+ gender: Character.gender,
762
+ dateOfBirth: {
763
+ year: Character.dateOfBirth?.year,
764
+ month: Character.dateOfBirth?.month,
765
+ day: Character.dateOfBirth?.day,
766
+ },
767
+ bloodType: Character.bloodType,
768
+ age: Character.age,
769
+ hairColor: hairColor,
770
+ eyeColor: eyeColor,
771
+ height: height,
772
+ weight: weight,
773
+ occupation: occupation,
774
+ partner: partner,
775
+ relatives: relatives,
776
+ race: race,
777
+ rank: rank,
778
+ previousPosition: previousPosition,
779
+ dislikes: dislikes,
780
+ sign: sign,
781
+ zodicSign: zodicSign,
782
+ zodicAnimal: zodicAnimal,
783
+ themeSong: themeSong,
784
+ relations: Character.media.edges?.map(mapCharacterMedia),
785
+ };
1112
786
 
1113
- return characterInfo;
1114
- } catch (err) {
1115
- throw anilistError(err);
1116
- }
787
+ return characterInfo;
1117
788
  };
1118
789
 
1119
- /**
1120
- * Anilist Anime class
1121
- */
1122
- static Anime = this;
1123
-
1124
- /**
1125
- * Anilist Manga Class
1126
- */
790
+ /** Maps AniList manga to a manga provider's chapters. */
1127
791
  static Manga = class Manga {
1128
792
  provider: MangaParser;
1129
793
 
1130
- /**
1131
- * Maps anilist manga to any manga provider (MangaDex, MangaPill, etc)
1132
- * @param provider MangaParser (default: MangaDex)
1133
- */
794
+ /** @param provider manga provider to find the chapters on (default: MangaDex) */
1134
795
  constructor(provider?: MangaParser) {
1135
796
  this.provider = provider || new MangaDex();
1136
797
  }
1137
798
 
1138
- /**
1139
- *
1140
- * @param query query to search for
1141
- * @param page (optional) page number (default: `1`)
1142
- * @param perPage (optional) number of results per page (default: `20`)
1143
- */
799
+ /** @param perPage results per page (default: 20) */
1144
800
  search = async (query: string, page: number = 1, perPage: number = 20): Promise<ISearch<IMangaResult>> => {
1145
- try {
1146
- const { data } = await anilistQuery(anilistSearchQuery(), { search: query, page, perPage, type: 'MANGA' });
1147
-
1148
- const res: ISearch<IMangaResult> = {
1149
- currentPage: data.data.Page.pageInfo.currentPage,
1150
- hasNextPage: data.data.Page.pageInfo.hasNextPage,
1151
- results: data.data.Page.media.map(
1152
- (item: any): IMangaResult => ({
1153
- ...mapMediaResult(item),
1154
- popularity: item.popularity,
1155
- totalChapters: item.chapters,
1156
- volumes: item.volumes,
1157
- })
1158
- ),
1159
- };
1160
-
1161
- return res;
1162
- } catch (err) {
1163
- throw anilistError(err);
1164
- }
801
+ const data = await anilistQuery(SEARCH_QUERY, { search: query, page, perPage, type: 'MANGA' });
802
+ return toPage(
803
+ data.data.Page,
804
+ data.data.Page.media.map(
805
+ (item: any): IMangaResult => ({
806
+ ...mapMediaResult(item),
807
+ popularity: item.popularity,
808
+ })
809
+ )
810
+ );
1165
811
  };
1166
812
 
813
+ /** @param args passed on to the provider's fetchChapterPages */
814
+ fetchChapterPages = (chapterId: string, ...args: any): Promise<IMangaChapterPage[]> =>
815
+ this.provider.fetchChapterPages(chapterId, ...args);
816
+
1167
817
  /**
1168
- *
1169
- * @param chapterId chapter id
1170
- * @param args args to pass to the provider (if any)
1171
- * @returns
818
+ * The AniList info with the provider's chapters, in the provider's order (reading order, as every
819
+ * manga provider returns them): from MALSync's mapping when the provider declares its MALSync
820
+ * site (`capabilities.malSyncSite`: MangaDex, MangaKakalot), else from the provider's search
821
+ * result closest to the romaji or English title.
1172
822
  */
1173
- fetchChapterPages = (chapterId: string, ...args: any): Promise<IMangaChapterPage[]> => {
1174
- return this.provider.fetchChapterPages(chapterId, ...args);
823
+ fetchMangaInfo = async (id: string): Promise<IMangaInfo> => {
824
+ const media = (await anilistQuery(MEDIA_DETAIL_QUERY, { id: Number(id) })).data.Media;
825
+ const mangaInfo: IMangaInfo = { id, ...mapMangaDetail(media) };
826
+ mangaInfo.chapters = await this.fetchChapters(mangaInfo.title as ITitle, mangaInfo.malId);
827
+ return mangaInfo;
1175
828
  };
1176
829
 
1177
- fetchMangaInfo = async (id: string, ...args: any): Promise<IMangaInfo> => {
830
+ /**
831
+ * The provider's chapters for a manga whose AniList info the app already has (its `title` and
832
+ * `malId`, from fetchMangaInfo or META.Anilist's fetchAnilistInfoById), matched as fetchMangaInfo
833
+ * matches them: only the provider is asked, not AniList again.
834
+ */
835
+ fetchChapters = async (title: ITitle, malId?: number | string): Promise<IMangaChapter[]> => {
1178
836
  try {
1179
- const { data } = await anilistQuery(anilistMediaDetailQuery(), { id: Number(id) });
1180
- const mangaInfo: IMangaInfo = { id, ...mapMediaDetail(data.data.Media) };
1181
- const chapters = await new Anilist()
1182
- .findManga(this.provider, mapTitle(data.data.Media.title), mangaInfo.malId as number)
1183
- .catch((err) => {
1184
- throw MetaError.from('provider', err);
1185
- });
1186
- mangaInfo.chapters = sortChaptersForReading(chapters);
1187
-
1188
- return mangaInfo;
1189
- } catch (error) {
1190
- throw anilistError(error);
837
+ return await findMangaChapters(this.provider, title, malId);
838
+ } catch (err) {
839
+ throw MetaError.from('provider', err);
1191
840
  }
1192
841
  };
1193
842
  };
1194
-
1195
- /** The provider's chapters for the manga titled `title`; empty when the provider doesn't have it. */
1196
- private findMangaSlug = async (provider: MangaParser, title: string, malId?: number): Promise<IMangaChapter[]> => {
1197
- const slug = title.replace(/[^0-9a-zA-Z]+/g, ' ');
1198
-
1199
- let possibleManga: IMangaInfo | undefined;
1200
-
1201
- if (malId) {
1202
- const malAsyncReq = await metaHttp.get(`${this.malSyncUrl}/mal/manga/${encodeURIComponent(malId)}`, {
1203
- validateStatus: () => true,
1204
- });
1205
-
1206
- if (malAsyncReq.status === 200) {
1207
- const sitesT = malAsyncReq.data.Sites as {
1208
- [k: string]: {
1209
- [k: string]: { url: string; page: string; title: string };
1210
- };
1211
- };
1212
- let sites = Object.values(sitesT).map((v, i) => {
1213
- const obj: any = [...Object.values(Object.values(sitesT)[i]!)];
1214
- const pages: any = obj.map((v: any) => ({
1215
- page: v.page,
1216
- url: v.url,
1217
- title: v.title,
1218
- }));
1219
- return pages;
1220
- }) as any[];
1221
-
1222
- sites = sites.flat();
1223
-
1224
- const possibleSource = sites.find((s) => s.page.toLowerCase() === provider.name.toLowerCase());
1225
-
1226
- if (possibleSource) possibleManga = await provider.fetchMangaInfo(possibleSource.url.split('/').pop()!);
1227
- else possibleManga = await this.findMangaRaw(provider, slug, title);
1228
- } else possibleManga = await this.findMangaRaw(provider, slug, title);
1229
- } else possibleManga = await this.findMangaRaw(provider, slug, title);
1230
-
1231
- return possibleManga?.chapters ?? [];
1232
- };
1233
-
1234
- /** The provider's manga for a search, preferring an exact title match; `undefined` when it finds none. */
1235
- private findMangaRaw = async (
1236
- provider: MangaParser,
1237
- slug: string,
1238
- title: string
1239
- ): Promise<IMangaInfo | undefined> => {
1240
- const { results = [] } = ((await provider.search(slug)) ?? {}) as Partial<ISearch<IMangaResult>>;
1241
-
1242
- if (results.length === 0) return undefined;
1243
-
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)
1252
- );
1253
-
1254
- return (await provider.fetchMangaInfo((possibleManga ?? results[0]!).id)) as IMangaInfo;
1255
- };
1256
-
1257
- /** The provider's chapters, looked up by the romaji title, then by the English one if that finds none. */
1258
- private findManga = async (provider: MangaParser, title: ITitle, malId?: number): Promise<IMangaChapter[]> => {
1259
- const romaji = (title.romaji ?? title.english ?? '').toLowerCase();
1260
- const english = (title.english ?? title.romaji ?? '').toLowerCase();
1261
-
1262
- const romajiChapters = await this.findMangaSlug(provider, romaji, malId);
1263
- if (romajiChapters.length > 0 || english === romaji) return romajiChapters;
1264
-
1265
- return this.findMangaSlug(provider, english, malId);
1266
- };
1267
843
  }
1268
844
 
1269
- // (async () => {
1270
- // const ani = new Anilist(new Zoro());
1271
- // const anime = await ani.fetchAnimeInfo('21');
1272
- // console.log(anime.episodes);
1273
- // const sources = await ani.fetchEpisodeSources(anime.episodes![0]!.id, anime.episodes![0]!.number, anime.id);
1274
- // console.log(sources);
1275
- // })();
1276
-
1277
845
  export default Anilist;