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