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