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