react-native-consumet 4.0.0 → 5.1.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 (359) hide show
  1. package/android/src/androidTest/java/com/consumet/TestSupport.kt +12 -6
  2. package/android/src/androidTest/java/com/consumet/WebViewContractTest.kt +30 -2
  3. package/android/src/main/java/com/consumet/HttpRequestModule.kt +27 -13
  4. package/ios/Consumet.mm +42 -19
  5. package/lib/commonjs/NativeConsumet.ts +13 -8
  6. package/lib/commonjs/extension-registry.json +35 -64
  7. package/lib/commonjs/extension-registry.json.sig +1 -1
  8. package/lib/commonjs/extractors/gofile.js +47 -10
  9. package/lib/commonjs/extractors/gofile.js.map +1 -1
  10. package/lib/commonjs/extractors/hubcloud.js +49 -42
  11. package/lib/commonjs/extractors/hubcloud.js.map +1 -1
  12. package/lib/commonjs/index.js +14 -0
  13. package/lib/commonjs/index.js.map +1 -1
  14. package/lib/commonjs/models/index.js +9 -1
  15. package/lib/commonjs/models/index.js.map +1 -1
  16. package/lib/commonjs/models/meta-error.js +6 -3
  17. package/lib/commonjs/models/meta-error.js.map +1 -1
  18. package/lib/commonjs/models/provider-error.js +54 -0
  19. package/lib/commonjs/models/provider-error.js.map +1 -0
  20. package/lib/commonjs/models/types.js +3 -2
  21. package/lib/commonjs/models/types.js.map +1 -1
  22. package/lib/commonjs/providers/anime/anikoto/create-anikoto.js +90 -25
  23. package/lib/commonjs/providers/anime/anikoto/create-anikoto.js.map +1 -1
  24. package/lib/commonjs/providers/anime/{hianime.js → anikoto/hianime.js} +4 -4
  25. package/lib/commonjs/providers/anime/anikoto/hianime.js.map +1 -0
  26. package/lib/commonjs/providers/anime/animepahe/create-animepahe.js +110 -18
  27. package/lib/commonjs/providers/anime/animepahe/create-animepahe.js.map +1 -1
  28. package/lib/commonjs/providers/anime/index.js +1 -9
  29. package/lib/commonjs/providers/anime/index.js.map +1 -1
  30. package/lib/commonjs/providers/anime/reanime/create-reanime.js +6 -2
  31. package/lib/commonjs/providers/anime/reanime/create-reanime.js.map +1 -1
  32. package/lib/commonjs/providers/common/concurrency.js +38 -0
  33. package/lib/commonjs/providers/common/concurrency.js.map +1 -0
  34. package/lib/commonjs/providers/common/errors.js +77 -0
  35. package/lib/commonjs/providers/common/errors.js.map +1 -0
  36. package/lib/commonjs/providers/common/servers.js +9 -3
  37. package/lib/commonjs/providers/common/servers.js.map +1 -1
  38. package/lib/commonjs/providers/common/ttl-cache.js +59 -0
  39. package/lib/commonjs/providers/common/ttl-cache.js.map +1 -0
  40. package/lib/commonjs/providers/manga/asurascans.js +29 -7
  41. package/lib/commonjs/providers/manga/asurascans.js.map +1 -1
  42. package/lib/commonjs/providers/meta/anilist-media.js +23 -13
  43. package/lib/commonjs/providers/meta/anilist-media.js.map +1 -1
  44. package/lib/commonjs/providers/meta/anilist.js +63 -18
  45. package/lib/commonjs/providers/meta/anilist.js.map +1 -1
  46. package/lib/commonjs/providers/meta/mal.js +3 -3
  47. package/lib/commonjs/providers/meta/mal.js.map +1 -1
  48. package/lib/commonjs/providers/meta/shared.js +7 -2
  49. package/lib/commonjs/providers/meta/shared.js.map +1 -1
  50. package/lib/commonjs/providers/meta/tmdb.js +151 -45
  51. package/lib/commonjs/providers/meta/tmdb.js.map +1 -1
  52. package/lib/commonjs/providers/movies/index.js +0 -4
  53. package/lib/commonjs/providers/movies/index.js.map +1 -1
  54. package/lib/commonjs/providers/movies/multimovies/create-multimovies.js +2 -1
  55. package/lib/commonjs/providers/movies/multimovies/create-multimovies.js.map +1 -1
  56. package/lib/commonjs/providers/movies/multistream/create-multistream.js +1 -1
  57. package/lib/commonjs/providers/movies/multistream/create-multistream.js.map +1 -1
  58. package/lib/commonjs/providers/movies/netflixmirror/create-netflixmirror.js +44 -11
  59. package/lib/commonjs/providers/movies/netflixmirror/create-netflixmirror.js.map +1 -1
  60. package/lib/commonjs/providers/movies/site-paths.js +3 -2
  61. package/lib/commonjs/providers/movies/site-paths.js.map +1 -1
  62. package/lib/commonjs/providers/movies/vegamovies/create-vegamovies.js +95 -44
  63. package/lib/commonjs/providers/movies/vegamovies/create-vegamovies.js.map +1 -1
  64. package/lib/commonjs/providers/provider-class.js +1 -1
  65. package/lib/commonjs/utils/ExtractorManager.js +90 -11
  66. package/lib/commonjs/utils/ExtractorManager.js.map +1 -1
  67. package/lib/commonjs/utils/ProviderManager.js +54 -18
  68. package/lib/commonjs/utils/ProviderManager.js.map +1 -1
  69. package/lib/commonjs/utils/extension-modules.js +136 -24
  70. package/lib/commonjs/utils/extension-modules.js.map +1 -1
  71. package/lib/commonjs/utils/registry-schema.js +3 -2
  72. package/lib/commonjs/utils/registry-schema.js.map +1 -1
  73. package/lib/commonjs/utils/tmdb.js +53 -8
  74. package/lib/commonjs/utils/tmdb.js.map +1 -1
  75. package/lib/module/NativeConsumet.ts +13 -8
  76. package/lib/module/extension-registry.json +35 -64
  77. package/lib/module/extension-registry.json.sig +1 -1
  78. package/lib/module/extractors/gofile.js +47 -10
  79. package/lib/module/extractors/gofile.js.map +1 -1
  80. package/lib/module/extractors/hubcloud.js +49 -42
  81. package/lib/module/extractors/hubcloud.js.map +1 -1
  82. package/lib/module/index.js +2 -2
  83. package/lib/module/index.js.map +1 -1
  84. package/lib/module/models/index.js +1 -0
  85. package/lib/module/models/index.js.map +1 -1
  86. package/lib/module/models/meta-error.js +7 -3
  87. package/lib/module/models/meta-error.js.map +1 -1
  88. package/lib/module/models/provider-error.js +49 -0
  89. package/lib/module/models/provider-error.js.map +1 -0
  90. package/lib/module/models/types.js +3 -2
  91. package/lib/module/models/types.js.map +1 -1
  92. package/lib/module/providers/anime/anikoto/create-anikoto.js +91 -25
  93. package/lib/module/providers/anime/anikoto/create-anikoto.js.map +1 -1
  94. package/lib/module/providers/anime/{hianime.js → anikoto/hianime.js} +4 -4
  95. package/lib/module/providers/anime/anikoto/hianime.js.map +1 -0
  96. package/lib/module/providers/anime/animepahe/create-animepahe.js +111 -18
  97. package/lib/module/providers/anime/animepahe/create-animepahe.js.map +1 -1
  98. package/lib/module/providers/anime/index.js +1 -9
  99. package/lib/module/providers/anime/index.js.map +1 -1
  100. package/lib/module/providers/anime/reanime/create-reanime.js +6 -2
  101. package/lib/module/providers/anime/reanime/create-reanime.js.map +1 -1
  102. package/lib/module/providers/common/concurrency.js +34 -0
  103. package/lib/module/providers/common/concurrency.js.map +1 -0
  104. package/lib/module/providers/common/errors.js +70 -0
  105. package/lib/module/providers/common/errors.js.map +1 -0
  106. package/lib/module/providers/common/servers.js +10 -3
  107. package/lib/module/providers/common/servers.js.map +1 -1
  108. package/lib/module/providers/common/ttl-cache.js +54 -0
  109. package/lib/module/providers/common/ttl-cache.js.map +1 -0
  110. package/lib/module/providers/manga/asurascans.js +29 -7
  111. package/lib/module/providers/manga/asurascans.js.map +1 -1
  112. package/lib/module/providers/meta/anilist-media.js +23 -13
  113. package/lib/module/providers/meta/anilist-media.js.map +1 -1
  114. package/lib/module/providers/meta/anilist.js +64 -19
  115. package/lib/module/providers/meta/anilist.js.map +1 -1
  116. package/lib/module/providers/meta/mal.js +3 -3
  117. package/lib/module/providers/meta/mal.js.map +1 -1
  118. package/lib/module/providers/meta/shared.js +8 -3
  119. package/lib/module/providers/meta/shared.js.map +1 -1
  120. package/lib/module/providers/meta/tmdb.js +153 -47
  121. package/lib/module/providers/meta/tmdb.js.map +1 -1
  122. package/lib/module/providers/movies/index.js +0 -4
  123. package/lib/module/providers/movies/index.js.map +1 -1
  124. package/lib/module/providers/movies/multimovies/create-multimovies.js +2 -1
  125. package/lib/module/providers/movies/multimovies/create-multimovies.js.map +1 -1
  126. package/lib/module/providers/movies/multistream/create-multistream.js +1 -1
  127. package/lib/module/providers/movies/multistream/create-multistream.js.map +1 -1
  128. package/lib/module/providers/movies/netflixmirror/create-netflixmirror.js +44 -11
  129. package/lib/module/providers/movies/netflixmirror/create-netflixmirror.js.map +1 -1
  130. package/lib/module/providers/movies/site-paths.js +3 -2
  131. package/lib/module/providers/movies/site-paths.js.map +1 -1
  132. package/lib/module/providers/movies/vegamovies/create-vegamovies.js +95 -44
  133. package/lib/module/providers/movies/vegamovies/create-vegamovies.js.map +1 -1
  134. package/lib/module/providers/provider-class.js +1 -1
  135. package/lib/module/utils/ExtractorManager.js +89 -11
  136. package/lib/module/utils/ExtractorManager.js.map +1 -1
  137. package/lib/module/utils/ProviderManager.js +54 -18
  138. package/lib/module/utils/ProviderManager.js.map +1 -1
  139. package/lib/module/utils/extension-modules.js +136 -24
  140. package/lib/module/utils/extension-modules.js.map +1 -1
  141. package/lib/module/utils/registry-schema.js +3 -2
  142. package/lib/module/utils/registry-schema.js.map +1 -1
  143. package/lib/module/utils/tmdb.js +51 -7
  144. package/lib/module/utils/tmdb.js.map +1 -1
  145. package/lib/typescript/commonjs/src/NativeConsumet.d.ts +13 -8
  146. package/lib/typescript/commonjs/src/NativeConsumet.d.ts.map +1 -1
  147. package/lib/typescript/commonjs/src/extractors/gofile.d.ts.map +1 -1
  148. package/lib/typescript/commonjs/src/extractors/hubcloud.d.ts.map +1 -1
  149. package/lib/typescript/commonjs/src/index.d.ts +4 -3
  150. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  151. package/lib/typescript/commonjs/src/models/extension-manifest.d.ts +2 -0
  152. package/lib/typescript/commonjs/src/models/extension-manifest.d.ts.map +1 -1
  153. package/lib/typescript/commonjs/src/models/index.d.ts +1 -0
  154. package/lib/typescript/commonjs/src/models/index.d.ts.map +1 -1
  155. package/lib/typescript/commonjs/src/models/meta-error.d.ts +4 -1
  156. package/lib/typescript/commonjs/src/models/meta-error.d.ts.map +1 -1
  157. package/lib/typescript/commonjs/src/models/provider-error.d.ts +32 -0
  158. package/lib/typescript/commonjs/src/models/provider-error.d.ts.map +1 -0
  159. package/lib/typescript/commonjs/src/models/types.d.ts +31 -3
  160. package/lib/typescript/commonjs/src/models/types.d.ts.map +1 -1
  161. package/lib/typescript/commonjs/src/providers/anime/anikoto/create-anikoto.d.ts.map +1 -1
  162. package/lib/typescript/{module/src/providers/anime → commonjs/src/providers/anime/anikoto}/hianime.d.ts +2 -2
  163. package/lib/typescript/commonjs/src/providers/anime/anikoto/hianime.d.ts.map +1 -0
  164. package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
  165. package/lib/typescript/commonjs/src/providers/anime/index.d.ts +0 -6
  166. package/lib/typescript/commonjs/src/providers/anime/index.d.ts.map +1 -1
  167. package/lib/typescript/commonjs/src/providers/anime/reanime/create-reanime.d.ts.map +1 -1
  168. package/lib/typescript/commonjs/src/providers/common/concurrency.d.ts +8 -0
  169. package/lib/typescript/commonjs/src/providers/common/concurrency.d.ts.map +1 -0
  170. package/lib/typescript/commonjs/src/providers/common/errors.d.ts +36 -0
  171. package/lib/typescript/commonjs/src/providers/common/errors.d.ts.map +1 -0
  172. package/lib/typescript/commonjs/src/providers/common/servers.d.ts +2 -1
  173. package/lib/typescript/commonjs/src/providers/common/servers.d.ts.map +1 -1
  174. package/lib/typescript/commonjs/src/providers/common/ttl-cache.d.ts +21 -0
  175. package/lib/typescript/commonjs/src/providers/common/ttl-cache.d.ts.map +1 -0
  176. package/lib/typescript/commonjs/src/providers/manga/asurascans.d.ts.map +1 -1
  177. package/lib/typescript/commonjs/src/providers/meta/anilist-media.d.ts +19 -7
  178. package/lib/typescript/commonjs/src/providers/meta/anilist-media.d.ts.map +1 -1
  179. package/lib/typescript/commonjs/src/providers/meta/anilist.d.ts +15 -7
  180. package/lib/typescript/commonjs/src/providers/meta/anilist.d.ts.map +1 -1
  181. package/lib/typescript/commonjs/src/providers/meta/mal.d.ts +1 -1
  182. package/lib/typescript/commonjs/src/providers/meta/shared.d.ts +4 -1
  183. package/lib/typescript/commonjs/src/providers/meta/shared.d.ts.map +1 -1
  184. package/lib/typescript/commonjs/src/providers/meta/tmdb.d.ts +65 -6
  185. package/lib/typescript/commonjs/src/providers/meta/tmdb.d.ts.map +1 -1
  186. package/lib/typescript/commonjs/src/providers/movies/index.d.ts +0 -3
  187. package/lib/typescript/commonjs/src/providers/movies/index.d.ts.map +1 -1
  188. package/lib/typescript/commonjs/src/providers/movies/multimovies/create-multimovies.d.ts.map +1 -1
  189. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/create-netflixmirror.d.ts.map +1 -1
  190. package/lib/typescript/commonjs/src/providers/movies/site-paths.d.ts +3 -2
  191. package/lib/typescript/commonjs/src/providers/movies/site-paths.d.ts.map +1 -1
  192. package/lib/typescript/commonjs/src/providers/movies/vegamovies/create-vegamovies.d.ts.map +1 -1
  193. package/lib/typescript/commonjs/src/providers/provider-class.d.ts +1 -1
  194. package/lib/typescript/commonjs/src/utils/ExtractorManager.d.ts +29 -1
  195. package/lib/typescript/commonjs/src/utils/ExtractorManager.d.ts.map +1 -1
  196. package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts +19 -5
  197. package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts.map +1 -1
  198. package/lib/typescript/commonjs/src/utils/extension-modules.d.ts +33 -8
  199. package/lib/typescript/commonjs/src/utils/extension-modules.d.ts.map +1 -1
  200. package/lib/typescript/commonjs/src/utils/registry-schema.d.ts +1 -1
  201. package/lib/typescript/commonjs/src/utils/registry-schema.d.ts.map +1 -1
  202. package/lib/typescript/commonjs/src/utils/tmdb.d.ts +18 -3
  203. package/lib/typescript/commonjs/src/utils/tmdb.d.ts.map +1 -1
  204. package/lib/typescript/module/src/NativeConsumet.d.ts +13 -8
  205. package/lib/typescript/module/src/NativeConsumet.d.ts.map +1 -1
  206. package/lib/typescript/module/src/extractors/gofile.d.ts.map +1 -1
  207. package/lib/typescript/module/src/extractors/hubcloud.d.ts.map +1 -1
  208. package/lib/typescript/module/src/index.d.ts +4 -3
  209. package/lib/typescript/module/src/index.d.ts.map +1 -1
  210. package/lib/typescript/module/src/models/extension-manifest.d.ts +2 -0
  211. package/lib/typescript/module/src/models/extension-manifest.d.ts.map +1 -1
  212. package/lib/typescript/module/src/models/index.d.ts +1 -0
  213. package/lib/typescript/module/src/models/index.d.ts.map +1 -1
  214. package/lib/typescript/module/src/models/meta-error.d.ts +4 -1
  215. package/lib/typescript/module/src/models/meta-error.d.ts.map +1 -1
  216. package/lib/typescript/module/src/models/provider-error.d.ts +32 -0
  217. package/lib/typescript/module/src/models/provider-error.d.ts.map +1 -0
  218. package/lib/typescript/module/src/models/types.d.ts +31 -3
  219. package/lib/typescript/module/src/models/types.d.ts.map +1 -1
  220. package/lib/typescript/module/src/providers/anime/anikoto/create-anikoto.d.ts.map +1 -1
  221. package/lib/typescript/{commonjs/src/providers/anime → module/src/providers/anime/anikoto}/hianime.d.ts +2 -2
  222. package/lib/typescript/module/src/providers/anime/anikoto/hianime.d.ts.map +1 -0
  223. package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
  224. package/lib/typescript/module/src/providers/anime/index.d.ts +0 -6
  225. package/lib/typescript/module/src/providers/anime/index.d.ts.map +1 -1
  226. package/lib/typescript/module/src/providers/anime/reanime/create-reanime.d.ts.map +1 -1
  227. package/lib/typescript/module/src/providers/common/concurrency.d.ts +8 -0
  228. package/lib/typescript/module/src/providers/common/concurrency.d.ts.map +1 -0
  229. package/lib/typescript/module/src/providers/common/errors.d.ts +36 -0
  230. package/lib/typescript/module/src/providers/common/errors.d.ts.map +1 -0
  231. package/lib/typescript/module/src/providers/common/servers.d.ts +2 -1
  232. package/lib/typescript/module/src/providers/common/servers.d.ts.map +1 -1
  233. package/lib/typescript/module/src/providers/common/ttl-cache.d.ts +21 -0
  234. package/lib/typescript/module/src/providers/common/ttl-cache.d.ts.map +1 -0
  235. package/lib/typescript/module/src/providers/manga/asurascans.d.ts.map +1 -1
  236. package/lib/typescript/module/src/providers/meta/anilist-media.d.ts +19 -7
  237. package/lib/typescript/module/src/providers/meta/anilist-media.d.ts.map +1 -1
  238. package/lib/typescript/module/src/providers/meta/anilist.d.ts +15 -7
  239. package/lib/typescript/module/src/providers/meta/anilist.d.ts.map +1 -1
  240. package/lib/typescript/module/src/providers/meta/mal.d.ts +1 -1
  241. package/lib/typescript/module/src/providers/meta/shared.d.ts +4 -1
  242. package/lib/typescript/module/src/providers/meta/shared.d.ts.map +1 -1
  243. package/lib/typescript/module/src/providers/meta/tmdb.d.ts +65 -6
  244. package/lib/typescript/module/src/providers/meta/tmdb.d.ts.map +1 -1
  245. package/lib/typescript/module/src/providers/movies/index.d.ts +0 -3
  246. package/lib/typescript/module/src/providers/movies/index.d.ts.map +1 -1
  247. package/lib/typescript/module/src/providers/movies/multimovies/create-multimovies.d.ts.map +1 -1
  248. package/lib/typescript/module/src/providers/movies/netflixmirror/create-netflixmirror.d.ts.map +1 -1
  249. package/lib/typescript/module/src/providers/movies/site-paths.d.ts +3 -2
  250. package/lib/typescript/module/src/providers/movies/site-paths.d.ts.map +1 -1
  251. package/lib/typescript/module/src/providers/movies/vegamovies/create-vegamovies.d.ts.map +1 -1
  252. package/lib/typescript/module/src/providers/provider-class.d.ts +1 -1
  253. package/lib/typescript/module/src/utils/ExtractorManager.d.ts +29 -1
  254. package/lib/typescript/module/src/utils/ExtractorManager.d.ts.map +1 -1
  255. package/lib/typescript/module/src/utils/ProviderManager.d.ts +19 -5
  256. package/lib/typescript/module/src/utils/ProviderManager.d.ts.map +1 -1
  257. package/lib/typescript/module/src/utils/extension-modules.d.ts +33 -8
  258. package/lib/typescript/module/src/utils/extension-modules.d.ts.map +1 -1
  259. package/lib/typescript/module/src/utils/registry-schema.d.ts +1 -1
  260. package/lib/typescript/module/src/utils/registry-schema.d.ts.map +1 -1
  261. package/lib/typescript/module/src/utils/tmdb.d.ts +18 -3
  262. package/lib/typescript/module/src/utils/tmdb.d.ts.map +1 -1
  263. package/package.json +1 -1
  264. package/src/NativeConsumet.ts +13 -8
  265. package/src/extension-registry.json +35 -64
  266. package/src/extension-registry.json.sig +1 -1
  267. package/src/extractors/gofile.ts +52 -11
  268. package/src/extractors/hubcloud.ts +62 -49
  269. package/src/index.tsx +4 -1
  270. package/src/models/extension-manifest.ts +3 -0
  271. package/src/models/index.ts +1 -0
  272. package/src/models/meta-error.ts +7 -3
  273. package/src/models/provider-error.ts +57 -0
  274. package/src/models/types.ts +27 -3
  275. package/src/providers/anime/anikoto/create-anikoto.ts +75 -27
  276. package/src/providers/anime/{hianime.ts → anikoto/hianime.ts} +5 -5
  277. package/src/providers/anime/animepahe/create-animepahe.ts +101 -19
  278. package/src/providers/anime/index.ts +0 -8
  279. package/src/providers/anime/reanime/create-reanime.ts +8 -1
  280. package/src/providers/common/concurrency.ts +32 -0
  281. package/src/providers/common/errors.ts +84 -0
  282. package/src/providers/common/servers.ts +7 -3
  283. package/src/providers/common/ttl-cache.ts +65 -0
  284. package/src/providers/manga/asurascans.ts +31 -7
  285. package/src/providers/meta/anilist-media.ts +20 -15
  286. package/src/providers/meta/anilist.ts +59 -17
  287. package/src/providers/meta/mal.ts +3 -3
  288. package/src/providers/meta/shared.ts +10 -3
  289. package/src/providers/meta/tmdb.ts +173 -38
  290. package/src/providers/movies/index.ts +0 -4
  291. package/src/providers/movies/multimovies/create-multimovies.ts +1 -0
  292. package/src/providers/movies/multistream/create-multistream.ts +1 -1
  293. package/src/providers/movies/netflixmirror/create-netflixmirror.ts +49 -11
  294. package/src/providers/movies/site-paths.ts +3 -2
  295. package/src/providers/movies/vegamovies/create-vegamovies.ts +93 -42
  296. package/src/providers/provider-class.ts +1 -1
  297. package/src/utils/ExtractorManager.ts +97 -11
  298. package/src/utils/ProviderManager.ts +74 -22
  299. package/src/utils/extension-modules.ts +145 -32
  300. package/src/utils/registry-schema.ts +2 -1
  301. package/src/utils/tmdb.ts +53 -7
  302. package/lib/commonjs/providers/anime/anineko/anineko.js +0 -11
  303. package/lib/commonjs/providers/anime/anineko/anineko.js.map +0 -1
  304. package/lib/commonjs/providers/anime/anineko/create-anineko.js +0 -358
  305. package/lib/commonjs/providers/anime/anineko/create-anineko.js.map +0 -1
  306. package/lib/commonjs/providers/anime/hianime.js.map +0 -1
  307. package/lib/commonjs/providers/anime/zoro/create-zoro.js +0 -362
  308. package/lib/commonjs/providers/anime/zoro/create-zoro.js.map +0 -1
  309. package/lib/commonjs/providers/anime/zoro/zoro.js +0 -11
  310. package/lib/commonjs/providers/anime/zoro/zoro.js.map +0 -1
  311. package/lib/commonjs/providers/movies/himovies/create-himovies.js +0 -231
  312. package/lib/commonjs/providers/movies/himovies/create-himovies.js.map +0 -1
  313. package/lib/commonjs/providers/movies/himovies/himovies.js +0 -11
  314. package/lib/commonjs/providers/movies/himovies/himovies.js.map +0 -1
  315. package/lib/module/providers/anime/anineko/anineko.js +0 -7
  316. package/lib/module/providers/anime/anineko/anineko.js.map +0 -1
  317. package/lib/module/providers/anime/anineko/create-anineko.js +0 -354
  318. package/lib/module/providers/anime/anineko/create-anineko.js.map +0 -1
  319. package/lib/module/providers/anime/hianime.js.map +0 -1
  320. package/lib/module/providers/anime/zoro/create-zoro.js +0 -358
  321. package/lib/module/providers/anime/zoro/create-zoro.js.map +0 -1
  322. package/lib/module/providers/anime/zoro/zoro.js +0 -7
  323. package/lib/module/providers/anime/zoro/zoro.js.map +0 -1
  324. package/lib/module/providers/movies/himovies/create-himovies.js +0 -227
  325. package/lib/module/providers/movies/himovies/create-himovies.js.map +0 -1
  326. package/lib/module/providers/movies/himovies/himovies.js +0 -7
  327. package/lib/module/providers/movies/himovies/himovies.js.map +0 -1
  328. package/lib/typescript/commonjs/src/providers/anime/anineko/anineko.d.ts +0 -5
  329. package/lib/typescript/commonjs/src/providers/anime/anineko/anineko.d.ts.map +0 -1
  330. package/lib/typescript/commonjs/src/providers/anime/anineko/create-anineko.d.ts +0 -52
  331. package/lib/typescript/commonjs/src/providers/anime/anineko/create-anineko.d.ts.map +0 -1
  332. package/lib/typescript/commonjs/src/providers/anime/hianime.d.ts.map +0 -1
  333. package/lib/typescript/commonjs/src/providers/anime/zoro/create-zoro.d.ts +0 -49
  334. package/lib/typescript/commonjs/src/providers/anime/zoro/create-zoro.d.ts.map +0 -1
  335. package/lib/typescript/commonjs/src/providers/anime/zoro/zoro.d.ts +0 -5
  336. package/lib/typescript/commonjs/src/providers/anime/zoro/zoro.d.ts.map +0 -1
  337. package/lib/typescript/commonjs/src/providers/movies/himovies/create-himovies.d.ts +0 -28
  338. package/lib/typescript/commonjs/src/providers/movies/himovies/create-himovies.d.ts.map +0 -1
  339. package/lib/typescript/commonjs/src/providers/movies/himovies/himovies.d.ts +0 -5
  340. package/lib/typescript/commonjs/src/providers/movies/himovies/himovies.d.ts.map +0 -1
  341. package/lib/typescript/module/src/providers/anime/anineko/anineko.d.ts +0 -5
  342. package/lib/typescript/module/src/providers/anime/anineko/anineko.d.ts.map +0 -1
  343. package/lib/typescript/module/src/providers/anime/anineko/create-anineko.d.ts +0 -52
  344. package/lib/typescript/module/src/providers/anime/anineko/create-anineko.d.ts.map +0 -1
  345. package/lib/typescript/module/src/providers/anime/hianime.d.ts.map +0 -1
  346. package/lib/typescript/module/src/providers/anime/zoro/create-zoro.d.ts +0 -49
  347. package/lib/typescript/module/src/providers/anime/zoro/create-zoro.d.ts.map +0 -1
  348. package/lib/typescript/module/src/providers/anime/zoro/zoro.d.ts +0 -5
  349. package/lib/typescript/module/src/providers/anime/zoro/zoro.d.ts.map +0 -1
  350. package/lib/typescript/module/src/providers/movies/himovies/create-himovies.d.ts +0 -28
  351. package/lib/typescript/module/src/providers/movies/himovies/create-himovies.d.ts.map +0 -1
  352. package/lib/typescript/module/src/providers/movies/himovies/himovies.d.ts +0 -5
  353. package/lib/typescript/module/src/providers/movies/himovies/himovies.d.ts.map +0 -1
  354. package/src/providers/anime/anineko/anineko.ts +0 -6
  355. package/src/providers/anime/anineko/create-anineko.ts +0 -394
  356. package/src/providers/anime/zoro/create-zoro.ts +0 -398
  357. package/src/providers/anime/zoro/zoro.ts +0 -6
  358. package/src/providers/movies/himovies/create-himovies.ts +0 -252
  359. package/src/providers/movies/himovies/himovies.ts +0 -6
@@ -7,18 +7,21 @@ import {
7
7
  type IEpisodeServer,
8
8
  MovieParser,
9
9
  MetaError,
10
+ ProviderError,
10
11
  TvType,
11
12
  type IMovieResult,
12
13
  type IMovieInfo,
13
14
  type ProxyConfig,
14
15
  type IMovieEpisode,
15
16
  type IMovieSeason,
17
+ type MediaStatus,
16
18
  } from '../../models';
17
19
  import type { IMovieProvider, IPeopleResult } from '../../models/types';
18
20
  import type { AxiosAdapter } from 'axios';
19
21
  import {
20
22
  TMDB_INFO_APPEND,
21
23
  TMDB_LOGO,
24
+ TMDB_SHOW_STATUS_FILTERS,
22
25
  mapTmdbInfo,
23
26
  mapTmdbResult,
24
27
  mapTmdbResults,
@@ -32,7 +35,7 @@ import {
32
35
  type TmdbMediaType,
33
36
  } from '../../utils/tmdb';
34
37
  import { searchTerm } from '../../utils/utils';
35
- import { HiMovies } from '../movies/himovies/himovies';
38
+ import { NetflixMirror } from '../movies/netflixmirror/netflixmirror';
36
39
  import { bestTitleMatch, callProvider } from './shared';
37
40
 
38
41
  /** What TMDB knows about a title, used to pick the matching provider result. */
@@ -43,6 +46,41 @@ type TitleHints = {
43
46
  totalEpisodes?: number;
44
47
  };
45
48
 
49
+ /** Options of META.TMDB.advancedSearch. */
50
+ export interface TmdbSearchOptions {
51
+ /** Only movies, or only shows; both when omitted */
52
+ type?: TmdbMediaType;
53
+ /** The year a movie was released, or a show first aired */
54
+ year?: number;
55
+ page?: number;
56
+ }
57
+
58
+ /** Options of META.TMDB.discover. TMDB's discover has no status for movies, so only shows take `status`. */
59
+ export type TmdbDiscoverOptions = {
60
+ /**
61
+ * TMDB's `sort_by`: `popularity.desc` (the default), `vote_average.desc`, `vote_count.desc`, and
62
+ * `primary_release_date.desc` for movies or `first_air_date.desc` for shows (`.asc` too)
63
+ */
64
+ sort?: string;
65
+ /** The year a movie was released, or a show first aired */
66
+ year?: number;
67
+ /** TMDB genre ids (`/genre/movie/list`, `/genre/tv/list`); a title has all of them */
68
+ genres?: number[];
69
+ page?: number;
70
+ } & (
71
+ | { type: 'movie' }
72
+ | {
73
+ type: 'tv';
74
+ /** `ONGOING`, `COMPLETED` or `NOT_YET_AIRED`, as fetchMediaInfo reports a show's status */
75
+ status?: MediaStatus;
76
+ }
77
+ );
78
+
79
+ const isMediaType = (type: unknown): type is TmdbMediaType => type === 'movie' || type === 'tv';
80
+
81
+ /** The query parameter of TMDB's search and discover that filters by year. */
82
+ const yearParam = (type: TmdbMediaType) => (type === 'movie' ? 'primary_release_year' : 'first_air_date_year');
83
+
46
84
  /** Provider results less similar than this to TMDB's title are not the title. */
47
85
  const MIN_TITLE_SIMILARITY = 0.5;
48
86
 
@@ -66,7 +104,7 @@ class TMDB extends MovieParser {
66
104
  /**
67
105
  * @param apiKey your TMDB API key. Without one, a key shared by every app that passes none is
68
106
  * used, and a warning is logged once; TMDB can rate-limit or revoke that key at any time.
69
- * @param provider movie provider to find the title on (default HiMovies)
107
+ * @param provider movie provider to find the title on (default NetflixMirror)
70
108
  * @param _proxyConfig ignored: requests go through the library's own client. Kept so existing calls compile.
71
109
  * @param _adapter ignored, for the same reason
72
110
  */
@@ -78,7 +116,7 @@ class TMDB extends MovieParser {
78
116
  ) {
79
117
  super();
80
118
  this.apiKey = resolveTmdbApiKey(apiKey, 'META.TMDB');
81
- this.provider = provider || new HiMovies();
119
+ this.provider = provider || new NetflixMirror();
82
120
  }
83
121
 
84
122
  /**
@@ -101,7 +139,7 @@ class TMDB extends MovieParser {
101
139
  id: String(result.id),
102
140
  name: result.name,
103
141
  rating: result.popularity,
104
- image: tmdbImage(result.profile_path),
142
+ image: tmdbImage(result.profile_path, 'w185'),
105
143
  // TMDB's trending people no longer come with known_for
106
144
  movies: (result.known_for ?? []).map((movie: any) => mapTmdbResult(movie)),
107
145
  } as IPeopleResult)
@@ -120,14 +158,90 @@ class TMDB extends MovieParser {
120
158
  );
121
159
  };
122
160
 
161
+ /**
162
+ * Movies and shows TMDB finds for `query`, of one type and year when asked. Without a type it
163
+ * searches as `search` does (people left out), and a year keeps only that year's titles, so a page
164
+ * may hold fewer results than TMDB's.
165
+ * @throws Error before any request when `type` isn't `movie` or `tv`
166
+ */
167
+ advancedSearch = async (query: string, options: TmdbSearchOptions = {}): Promise<ISearch<IMovieResult>> => {
168
+ const { type, year, page = 1 } = options;
169
+ if (type !== undefined && !isMediaType(type)) throw new Error(`advancedSearch: type must be 'movie' or 'tv'`);
170
+ if (!type) {
171
+ const { data, results } = await tmdbMultiSearch(this.get, query, page);
172
+ const ofYear = year ? results.filter((result) => releaseYear(result) === String(year)) : results;
173
+ return tmdbPage(
174
+ data,
175
+ page,
176
+ ofYear.map((result) => mapTmdbResult(result))
177
+ );
178
+ }
179
+ const data = await this.get(
180
+ `/search/${type}?language=en-US&page=${page}&include_adult=false&query=${encodeURIComponent(query)}` +
181
+ (year ? `&${yearParam(type)}=${year}` : '')
182
+ );
183
+ return tmdbPage(
184
+ data,
185
+ page,
186
+ (data?.results ?? []).map((result: any) => mapTmdbResult(result, type))
187
+ );
188
+ };
189
+
190
+ /**
191
+ * Movies or shows without a query, TMDB's discover: by `sort`, of a year, with `genres`, and for
192
+ * shows of a `status`.
193
+ * @throws Error before any request when `type` isn't `movie` or `tv`, a genre isn't a TMDB genre
194
+ * id, or a `status` can't be filtered by
195
+ */
196
+ discover = async (options: TmdbDiscoverOptions): Promise<ISearch<IMovieResult>> => {
197
+ const { type, sort = 'popularity.desc', year, genres, page = 1 } = options;
198
+ if (!isMediaType(type)) throw new Error(`discover: type must be 'movie' or 'tv'`);
199
+ const params = [`language=en-US`, `page=${page}`, 'include_adult=false', `sort_by=${encodeURIComponent(sort)}`];
200
+ if (year) params.push(`${yearParam(type)}=${year}`);
201
+ if (genres?.length) {
202
+ if (!genres.every((genre) => Number.isInteger(genre))) throw new Error('discover: genres must be TMDB genre ids');
203
+ params.push(`with_genres=${genres.join(',')}`);
204
+ }
205
+ const status = 'status' in options ? options.status : undefined;
206
+ if (status !== undefined) {
207
+ const filter = type === 'tv' ? TMDB_SHOW_STATUS_FILTERS[status] : undefined;
208
+ if (!filter)
209
+ throw new Error(`discover: TMDB can't filter ${type === 'tv' ? 'shows' : 'movies'} by status ${status}`);
210
+ params.push(`with_status=${encodeURIComponent(filter)}`);
211
+ }
212
+ const data = await this.get(`/discover/${type}?${params.join('&')}`);
213
+ return tmdbPage(
214
+ data,
215
+ page,
216
+ (data?.results ?? []).map((result: any) => mapTmdbResult(result, type))
217
+ );
218
+ };
219
+
123
220
  /**
124
221
  * TMDB info with every season and episode. `id` is always the TMDB id. When the title is found on
125
222
  * the provider, `providerId` is the provider's media id and episodes carry provider episode ids;
126
223
  * with no match (or a failing provider) both are unset and the TMDB metadata is still returned.
224
+ * matchProviderEpisodes(fetchTmdbInfo(...)) in one call, without its provider errors: apps that
225
+ * need to tell a failing provider from a missing title call those two.
127
226
  * @param mediaId TMDB id
128
227
  * @param type `movie`, or anything else for a show
129
228
  */
130
229
  override fetchMediaInfo = async (mediaId: string, type: string): Promise<IMovieInfo> => {
230
+ const info = await this.fetchTmdbInfo(mediaId, type);
231
+ return this.matchProviderEpisodes(info).catch((error: unknown) => {
232
+ if (error instanceof MetaError && error.source === 'provider') return info;
233
+ throw error;
234
+ });
235
+ };
236
+
237
+ /**
238
+ * TMDB info with every season and episode, without the provider: no search and no scrape, so an
239
+ * info page can show it as soon as TMDB answers. Episodes have no provider ids; pass the result to
240
+ * matchProviderEpisodes for them.
241
+ * @param mediaId TMDB id
242
+ * @param type `movie`, or anything else for a show
243
+ */
244
+ fetchTmdbInfo = async (mediaId: string, type: string): Promise<IMovieInfo> => {
131
245
  const mediaType: TmdbMediaType = type.toLowerCase() === 'movie' ? 'movie' : 'tv';
132
246
  try {
133
247
  const { data } = await metaHttp.get(
@@ -137,20 +251,9 @@ class TMDB extends MovieParser {
137
251
  )
138
252
  );
139
253
 
140
- const match = await this.matchProvider(data?.title || data?.name, {
141
- type: mediaType === 'movie' ? TvType.MOVIE : TvType.TVSERIES,
142
- totalSeasons: data?.number_of_seasons,
143
- totalEpisodes: data?.number_of_episodes,
144
- year: Number(releaseYear(data)) || undefined,
145
- });
146
- // With no match there is nothing playable to map; the TMDB info and seasons are still returned.
147
- const providerEpisodes = match?.info?.episodes as any[] | undefined;
148
-
149
254
  const info: IMovieInfo = {
150
255
  id: mediaId,
151
256
  ...mapTmdbInfo(data, mediaType),
152
- ...(match ? { providerId: match.id } : {}),
153
- ...(mediaType === 'movie' ? { episodeId: providerEpisodes?.[0]?.id } : {}),
154
257
  directors: data?.credits?.crew
155
258
  ?.filter((crew: { job: string }) => crew.job === 'Director')
156
259
  .map((crew: { name: string }) => crew.name),
@@ -174,7 +277,7 @@ class TMDB extends MovieParser {
174
277
  runtime: data.next_episode_to_air?.runtime || undefined,
175
278
  }
176
279
  : undefined;
177
- info.seasons = await this.fetchSeasons(mediaId, totalSeasons, providerEpisodes);
280
+ info.seasons = await this.fetchSeasons(mediaId, totalSeasons);
178
281
  } else {
179
282
  info.seasons = [
180
283
  {
@@ -182,7 +285,9 @@ class TMDB extends MovieParser {
182
285
  image: tmdbImageSizes(data?.poster_path),
183
286
  episodes: [
184
287
  {
185
- id: providerEpisodes?.[0]?.id,
288
+ // Set by matchProviderEpisodes
289
+ id: undefined,
290
+ url: undefined,
186
291
  uniqueId: `${mediaId}-${mediaType}-s1-e1`,
187
292
  title: data.title || data.original_title,
188
293
  number: 1,
@@ -190,7 +295,6 @@ class TMDB extends MovieParser {
190
295
  season: 1,
191
296
  releaseDate: data.release_date,
192
297
  description: data.overview,
193
- url: providerEpisodes?.[0]?.url,
194
298
  image: tmdbImageSizes(data?.backdrop_path),
195
299
  },
196
300
  ],
@@ -199,21 +303,51 @@ class TMDB extends MovieParser {
199
303
  }
200
304
  return info;
201
305
  } catch (err) {
202
- // matchProvider absorbs provider failures, so anything here comes from TMDB's requests or data
203
306
  throw MetaError.from('tmdb', err);
204
307
  }
205
308
  };
206
309
 
207
310
  /**
208
- * Every season of a show, fetched together, with the provider's episode ids where the provider
209
- * has the episode. A season whose request fails keeps its place, with no episodes and `failed`
210
- * set, so the other seasons (and the season indexes apps store) survive it.
311
+ * `info` (fetchTmdbInfo's) with the provider's ids: finds the title on the provider, then gives
312
+ * each episode the provider's id and url for it. With no match, `info` comes back as it was. A
313
+ * failing provider rejects (see matchProvider); fetchTmdbInfo's info doesn't depend on it.
314
+ */
315
+ matchProviderEpisodes = async (info: IMovieInfo): Promise<IMovieInfo> => {
316
+ const isMovie = info.type === TvType.MOVIE;
317
+ const match = await this.matchProvider(info.title as string, {
318
+ type: isMovie ? TvType.MOVIE : TvType.TVSERIES,
319
+ totalSeasons: info.totalSeasons,
320
+ totalEpisodes: info.totalEpisodes,
321
+ year: Number(/^\d{4}/.exec(info.releaseDate ?? '')?.[0]) || undefined,
322
+ });
323
+ if (!match) return info;
324
+
325
+ const providerEpisodes = match.info.episodes as any[] | undefined;
326
+ // A movie, or a show TMDB lists without seasons, is one episode: the provider's first
327
+ const single = isMovie || !info.totalSeasons;
328
+ const providerEpisode = (season: number, number?: number) =>
329
+ single
330
+ ? providerEpisodes?.[0]
331
+ : providerEpisodes?.find((episode) => episode.season === season && episode.number === number);
332
+ return {
333
+ ...info,
334
+ providerId: match.id,
335
+ ...(isMovie ? { episodeId: providerEpisodes?.[0]?.id } : {}),
336
+ seasons: info.seasons?.map((season) => ({
337
+ ...season,
338
+ episodes: season.episodes?.map((episode) => {
339
+ const fromProvider = providerEpisode(season.season, episode.number);
340
+ return { ...episode, id: fromProvider?.id, url: fromProvider?.url || undefined };
341
+ }),
342
+ })),
343
+ };
344
+ };
345
+
346
+ /**
347
+ * Every season of a show, fetched together. A season whose request fails keeps its place, with no
348
+ * episodes and `failed` set, so the other seasons (and the season indexes apps store) survive it.
211
349
  */
212
- private fetchSeasons = async (
213
- mediaId: string,
214
- totalSeasons: number,
215
- providerEpisodes: any[] | undefined
216
- ): Promise<IMovieSeason[]> => {
350
+ private fetchSeasons = async (mediaId: string, totalSeasons: number): Promise<IMovieSeason[]> => {
217
351
  const seasonNumbers = Array.from({ length: totalSeasons }, (_, index) => index + 1);
218
352
  const responses = await Promise.allSettled(
219
353
  seasonNumbers.map((season) => metaHttp.get(tmdbUrl(`/tv/${mediaId}/season/${season}`, this.apiKey)))
@@ -225,16 +359,16 @@ class TMDB extends MovieParser {
225
359
  const season = index + 1;
226
360
  if (response.status === 'rejected') return { season, episodes: [], failed: true };
227
361
  const seasonData = response.value.data;
228
- const seasonEpisodes = providerEpisodes?.filter((episode) => episode.season === season);
229
362
  const tmdbEpisodes: any[] = seasonData?.episodes ?? [];
230
363
 
231
364
  return {
232
365
  season,
233
366
  image: tmdbImageSizes(seasonData?.poster_path),
234
- episodes: tmdbEpisodes.map((episode): IMovieEpisode => {
235
- const episodeFromProvider = seasonEpisodes?.find((ep) => ep.number === episode.episode_number);
236
- return {
237
- id: episodeFromProvider?.id,
367
+ episodes: tmdbEpisodes.map(
368
+ (episode): IMovieEpisode => ({
369
+ // Set by matchProviderEpisodes
370
+ id: undefined,
371
+ url: undefined,
238
372
  uniqueId: `${mediaId}-tv-s${episode.season_number}-e${episode.episode_number}`,
239
373
  title: episode.name,
240
374
  number: episode.episode_number,
@@ -242,10 +376,9 @@ class TMDB extends MovieParser {
242
376
  season: episode.season_number,
243
377
  releaseDate: episode.air_date,
244
378
  description: episode.overview,
245
- url: episodeFromProvider?.url || undefined,
246
379
  image: tmdbImageSizes(episode?.still_path),
247
- };
248
- }),
380
+ })
381
+ ),
249
382
  isReleased: !(tmdbEpisodes[0]?.air_date > new Date().toISOString()),
250
383
  };
251
384
  });
@@ -253,7 +386,9 @@ class TMDB extends MovieParser {
253
386
 
254
387
  /**
255
388
  * Find the title on the provider and fetch the provider's info for it. Returns nothing when no
256
- * search result matches or the provider fails, so the TMDB metadata never depends on the provider.
389
+ * search result matches. A failing provider rejects with a provider MetaError whose cause is a
390
+ * ProviderError, so apps can tell "not on this provider" from "offline" or "provider broken"
391
+ * (and don't cache a failure as a missing title).
257
392
  */
258
393
  private matchProvider = async (
259
394
  title: string,
@@ -263,8 +398,8 @@ class TMDB extends MovieParser {
263
398
  const id = await this.findIdFromTitle(title, extraData);
264
399
  if (!id) return undefined;
265
400
  return { id, info: await this.provider.fetchMediaInfo(id) };
266
- } catch {
267
- return undefined;
401
+ } catch (err) {
402
+ throw MetaError.from('provider', ProviderError.from(err, { provider: this.provider.name }));
268
403
  }
269
404
  };
270
405
 
@@ -4,8 +4,6 @@ import { NetflixMirror, PrimeMirror, DisneyMirror } from './netflixmirror/netfli
4
4
  import { createNetflixMirror, createPrimeMirror, createDisneyMirror } from './netflixmirror/create-netflixmirror';
5
5
  import { MultiStream } from './multistream/multistream';
6
6
  import { createMultiStream } from './multistream/create-multistream';
7
- import { HiMovies } from './himovies/himovies';
8
- import { createHiMovies } from './himovies/create-himovies';
9
7
  import { VegaMovies } from './vegamovies/vegamovies';
10
8
  import { createVegaMovies } from './vegamovies/create-vegamovies';
11
9
 
@@ -14,10 +12,8 @@ export const MOVIES = {
14
12
  NetflixMirror,
15
13
  PrimeMirror,
16
14
  DisneyMirror,
17
- HiMovies,
18
15
  VegaMovies,
19
16
  MultiStream,
20
- createHiMovies,
21
17
  createMultiMovies,
22
18
  createNetflixMirror,
23
19
  createPrimeMirror,
@@ -220,6 +220,7 @@ export function createMultiMovies(ctx: ProviderContext, customBaseURL?: string)
220
220
  return {
221
221
  name: serverName(VIDHIDE_HOSTS.includes(host) ? 'vidhide' : 'streamwish', host),
222
222
  url: mirrors.siteUrls[site] + paths[site],
223
+ label: host,
223
224
  };
224
225
  });
225
226
  return { servers, fileId };
@@ -98,7 +98,7 @@ export function createMultiStream(ctx: ProviderContext, _customBaseURL?: string,
98
98
  number: item.episode_number,
99
99
  season: item.season_number || season,
100
100
  description: item.overview,
101
- image: tmdbImage(item.still_path),
101
+ image: tmdbImage(item.still_path, 'w300'),
102
102
  });
103
103
  }
104
104
  }
@@ -10,6 +10,8 @@ import {
10
10
  } from '../../../models';
11
11
  import type { AxiosRequestConfig } from 'axios';
12
12
  import { serverName } from '../../common/servers';
13
+ import { PAGE_TTL_MS, ttlCache } from '../../common/ttl-cache';
14
+ import { providerError } from '../../common/errors';
13
15
 
14
16
  type NetMirrorOtt = 'nf' | 'pv' | 'hs';
15
17
 
@@ -80,11 +82,19 @@ const NEWTV_API = 'https://tv.imgcdn.kim';
80
82
  const NEWTV_UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:136.0) Gecko/20100101 Firefox/136.0 /OS.GatuNewTV v1.0';
81
83
 
82
84
  // One verified session works for every catalog, so every instance made from this module shares it:
83
- // in the library that's all three catalogs. A registry load compiles each entry's bundle on its own,
84
- // so there each catalog unlocks its own session.
85
+ // all three catalogs, in the library and in a registry load alike (a manager runs a bundle once per
86
+ // sha256, and the three entries share this one).
85
87
  const sessions = new Map<string, { token: string; ts: number }>();
86
88
  const pendingUnlocks = new Map<string, Promise<string>>();
87
89
 
90
+ // A title's NewTV post (post.php), kept when its status is ok, so a search, then that title's info,
91
+ // load it once. The answer depends on the catalog (the Ott header), so it is part of the key.
92
+ const newTvPosts = ttlCache<NewTvPost>({
93
+ ttlMs: PAGE_TTL_MS,
94
+ maxEntries: 32,
95
+ keep: (post) => post?.status === 'ok',
96
+ });
97
+
88
98
  interface NetMirrorSearchResult {
89
99
  status?: string;
90
100
  searchResult?: Array<{ id: string | number; t: string; y?: string; r?: string }>;
@@ -228,7 +238,7 @@ function createNetMirror(ctx: ProviderContext, platform: NetMirrorPlatform, cust
228
238
  .join('; ');
229
239
  const host = baseUrl.replace(/^https?:\/\//, '').replace(/\/.*$/, '');
230
240
 
231
- await axios
241
+ const adVisit = axios
232
242
  .get(`https://userver.${host}/?hee5=${addhash}&a=y&t=${Math.random()}`, {
233
243
  headers: { 'User-Agent': APP_UA, 'Referer': `${baseUrl}/mobile/home?app=1`, 'Cookie': initialCookie },
234
244
  maxRedirects: 0,
@@ -236,6 +246,9 @@ function createNetMirror(ctx: ProviderContext, platform: NetMirrorPlatform, cust
236
246
  timeout: 10000,
237
247
  })
238
248
  .catch(() => undefined);
249
+ // The 2 s before the first poll run while the ad visit loads, not after it.
250
+ let firstWait: Promise<unknown> | undefined = sleep(2000);
251
+ await adVisit;
239
252
 
240
253
  // As the app does: ext_name is the id of the site's browser extension, which the poll reports.
241
254
  const pollCookie = [
@@ -248,7 +261,8 @@ function createNetMirror(ctx: ProviderContext, platform: NetMirrorPlatform, cust
248
261
 
249
262
  const deadline = Date.now() + UNLOCK_TIMEOUT_MS;
250
263
  while (Date.now() < deadline) {
251
- await sleep(2000);
264
+ await (firstWait || sleep(2000));
265
+ firstWait = undefined;
252
266
  const res = await axios
253
267
  .post(`${baseUrl}/mobile/verify2.php`, `verify=${encodeURIComponent(addhash)}`, {
254
268
  headers: {
@@ -335,6 +349,12 @@ function createNetMirror(ctx: ProviderContext, platform: NetMirrorPlatform, cust
335
349
  return data;
336
350
  };
337
351
 
352
+ /** A title's NewTV post, which search and info share (see newTvPosts). */
353
+ const getNewTvPost = (id: string): Promise<NewTvPost> => {
354
+ const path = `post.php?id=${id}`;
355
+ return newTvPosts.get(`${platform.ott}|${NEWTV_API}/newtv/${path}`, () => getNewTv<NewTvPost>(path));
356
+ };
357
+
338
358
  const postUrl = (id: string) => `${baseUrl}/mobile/${platform.path}post.php?id=${id}`;
339
359
  const playlistUrl = (id: string) => `${baseUrl}/mobile/${platform.path}playlist.php?id=${id}`;
340
360
 
@@ -342,7 +362,7 @@ function createNetMirror(ctx: ProviderContext, platform: NetMirrorPlatform, cust
342
362
  // season count, so fill those in from each title's (session-free) post data.
343
363
  const withPostDetails = async (result: IMovieResult): Promise<IMovieResult> => {
344
364
  try {
345
- const post = await getNewTv<NewTvPost>(`post.php?id=${result.id}`);
365
+ const post = await getNewTvPost(result.id);
346
366
  if (post?.status !== 'ok') return result;
347
367
  const isSeries = post.type === 't';
348
368
  return {
@@ -393,7 +413,10 @@ function createNetMirror(ctx: ProviderContext, platform: NetMirrorPlatform, cust
393
413
  const results = await searchNewTv(query).catch(() => searchViaSession(query));
394
414
  return { currentPage: page, hasNextPage: false, results };
395
415
  } catch (err) {
396
- throw new Error(`${config.name} search failed: ${(err as Error).message}`);
416
+ throw providerError(`${config.name} search failed: ${(err as Error).message}`, {
417
+ provider: config.name,
418
+ cause: err,
419
+ });
397
420
  }
398
421
  };
399
422
 
@@ -472,7 +495,7 @@ function createNetMirror(ctx: ProviderContext, platform: NetMirrorPlatform, cust
472
495
  };
473
496
 
474
497
  const fetchMediaInfoNewTv = async (mediaId: string): Promise<IMovieInfo> => {
475
- const post = await getNewTv<NewTvPost>(`post.php?id=${mediaId}`);
498
+ const post = await getNewTvPost(mediaId);
476
499
  if (post?.status !== 'ok') throw new Error('NewTV title unavailable');
477
500
 
478
501
  const detail = (key: string) => post.moredetails?.find((d) => d.k === key)?.v;
@@ -553,14 +576,23 @@ function createNetMirror(ctx: ProviderContext, platform: NetMirrorPlatform, cust
553
576
  try {
554
577
  return await fetchMediaInfoNewTv(mediaId).catch(() => fetchMediaInfoViaSession(mediaId));
555
578
  } catch (err) {
556
- throw new Error(`${config.name} fetchMediaInfo failed: ${(err as Error).message}`);
579
+ throw providerError(`${config.name} fetchMediaInfo failed: ${(err as Error).message}`, {
580
+ provider: config.name,
581
+ cause: err,
582
+ });
557
583
  }
558
584
  };
559
585
 
560
586
  const playlistPath = (episodeId: string) => `/mobile/${platform.path}playlist.php?id=${episodeId}&t=x&tm=${now()}`;
561
587
 
562
588
  const fetchEpisodeServers = async (episodeId: string, _mediaId?: string): Promise<IEpisodeServer[]> => {
563
- return [{ name: serverName('netmirror', platform.label), url: `${baseUrl}${playlistPath(episodeId)}` }];
589
+ return [
590
+ {
591
+ name: serverName('netmirror', platform.label),
592
+ url: `${baseUrl}${playlistPath(episodeId)}`,
593
+ label: platform.label,
594
+ },
595
+ ];
564
596
  };
565
597
 
566
598
  const qualityFromLabel = (label: string): string => {
@@ -625,7 +657,10 @@ function createNetMirror(ctx: ProviderContext, platform: NetMirrorPlatform, cust
625
657
  subtitles,
626
658
  };
627
659
  } catch (err) {
628
- throw new Error(`${config.name} fetchEpisodeSources failed: ${(err as Error).message}`);
660
+ throw providerError(`${config.name} fetchEpisodeSources failed: ${(err as Error).message}`, {
661
+ provider: config.name,
662
+ cause: err,
663
+ });
629
664
  }
630
665
  };
631
666
 
@@ -637,7 +672,10 @@ function createNetMirror(ctx: ProviderContext, platform: NetMirrorPlatform, cust
637
672
  const { data } = await axios.get<string>(master.url, { headers, responseType: 'text' });
638
673
  return data;
639
674
  } catch (err) {
640
- throw new Error(`${config.name} fetchHlsPlaylist failed: ${(err as Error).message}`);
675
+ throw providerError(`${config.name} fetchHlsPlaylist failed: ${(err as Error).message}`, {
676
+ provider: config.name,
677
+ cause: err,
678
+ });
641
679
  }
642
680
  };
643
681
 
@@ -3,8 +3,9 @@ const pathOf = (url: string): string => url.replace(/^https?:\/\/[^/]+/i, '').re
3
3
 
4
4
  /**
5
5
  * The id of a page on a movie site: its path below `baseUrl`, without slashes around it
6
- * (`https://himovies.sx/tv/watch-vincenzo-67955` -> `tv/watch-vincenzo-67955`). Only the path
7
- * counts, so a custom base URL and links to the site's other domains give the same ids.
6
+ * (`https://vegamovies.lease/download-breaking-bad-season-1-5/` ->
7
+ * `download-breaking-bad-season-1-5`). Only the path counts, so a custom base URL and links to the
8
+ * site's other domains give the same ids.
8
9
  */
9
10
  export function pageId(url: string, baseUrl: string): string {
10
11
  const path = pathOf(url);