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.
- package/android/src/androidTest/java/com/consumet/TestSupport.kt +12 -6
- package/android/src/androidTest/java/com/consumet/WebViewContractTest.kt +30 -2
- package/android/src/main/java/com/consumet/HttpRequestModule.kt +27 -13
- package/ios/Consumet.mm +42 -19
- package/lib/commonjs/NativeConsumet.ts +13 -8
- package/lib/commonjs/extension-registry.json +35 -64
- package/lib/commonjs/extension-registry.json.sig +1 -1
- package/lib/commonjs/extractors/gofile.js +47 -10
- package/lib/commonjs/extractors/gofile.js.map +1 -1
- package/lib/commonjs/extractors/hubcloud.js +49 -42
- package/lib/commonjs/extractors/hubcloud.js.map +1 -1
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/index.js +9 -1
- package/lib/commonjs/models/index.js.map +1 -1
- package/lib/commonjs/models/meta-error.js +6 -3
- package/lib/commonjs/models/meta-error.js.map +1 -1
- package/lib/commonjs/models/provider-error.js +54 -0
- package/lib/commonjs/models/provider-error.js.map +1 -0
- package/lib/commonjs/models/types.js +3 -2
- package/lib/commonjs/models/types.js.map +1 -1
- package/lib/commonjs/providers/anime/anikoto/create-anikoto.js +90 -25
- package/lib/commonjs/providers/anime/anikoto/create-anikoto.js.map +1 -1
- package/lib/commonjs/providers/anime/{hianime.js → anikoto/hianime.js} +4 -4
- package/lib/commonjs/providers/anime/anikoto/hianime.js.map +1 -0
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js +110 -18
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/commonjs/providers/anime/index.js +1 -9
- package/lib/commonjs/providers/anime/index.js.map +1 -1
- package/lib/commonjs/providers/anime/reanime/create-reanime.js +6 -2
- package/lib/commonjs/providers/anime/reanime/create-reanime.js.map +1 -1
- package/lib/commonjs/providers/common/concurrency.js +38 -0
- package/lib/commonjs/providers/common/concurrency.js.map +1 -0
- package/lib/commonjs/providers/common/errors.js +77 -0
- package/lib/commonjs/providers/common/errors.js.map +1 -0
- package/lib/commonjs/providers/common/servers.js +9 -3
- package/lib/commonjs/providers/common/servers.js.map +1 -1
- package/lib/commonjs/providers/common/ttl-cache.js +59 -0
- package/lib/commonjs/providers/common/ttl-cache.js.map +1 -0
- package/lib/commonjs/providers/manga/asurascans.js +29 -7
- package/lib/commonjs/providers/manga/asurascans.js.map +1 -1
- package/lib/commonjs/providers/meta/anilist-media.js +23 -13
- package/lib/commonjs/providers/meta/anilist-media.js.map +1 -1
- package/lib/commonjs/providers/meta/anilist.js +63 -18
- package/lib/commonjs/providers/meta/anilist.js.map +1 -1
- package/lib/commonjs/providers/meta/mal.js +3 -3
- package/lib/commonjs/providers/meta/mal.js.map +1 -1
- package/lib/commonjs/providers/meta/shared.js +7 -2
- package/lib/commonjs/providers/meta/shared.js.map +1 -1
- package/lib/commonjs/providers/meta/tmdb.js +151 -45
- package/lib/commonjs/providers/meta/tmdb.js.map +1 -1
- package/lib/commonjs/providers/movies/index.js +0 -4
- package/lib/commonjs/providers/movies/index.js.map +1 -1
- package/lib/commonjs/providers/movies/multimovies/create-multimovies.js +2 -1
- package/lib/commonjs/providers/movies/multimovies/create-multimovies.js.map +1 -1
- package/lib/commonjs/providers/movies/multistream/create-multistream.js +1 -1
- package/lib/commonjs/providers/movies/multistream/create-multistream.js.map +1 -1
- package/lib/commonjs/providers/movies/netflixmirror/create-netflixmirror.js +44 -11
- package/lib/commonjs/providers/movies/netflixmirror/create-netflixmirror.js.map +1 -1
- package/lib/commonjs/providers/movies/site-paths.js +3 -2
- package/lib/commonjs/providers/movies/site-paths.js.map +1 -1
- package/lib/commonjs/providers/movies/vegamovies/create-vegamovies.js +95 -44
- package/lib/commonjs/providers/movies/vegamovies/create-vegamovies.js.map +1 -1
- package/lib/commonjs/providers/provider-class.js +1 -1
- package/lib/commonjs/utils/ExtractorManager.js +90 -11
- package/lib/commonjs/utils/ExtractorManager.js.map +1 -1
- package/lib/commonjs/utils/ProviderManager.js +54 -18
- package/lib/commonjs/utils/ProviderManager.js.map +1 -1
- package/lib/commonjs/utils/extension-modules.js +136 -24
- package/lib/commonjs/utils/extension-modules.js.map +1 -1
- package/lib/commonjs/utils/registry-schema.js +3 -2
- package/lib/commonjs/utils/registry-schema.js.map +1 -1
- package/lib/commonjs/utils/tmdb.js +53 -8
- package/lib/commonjs/utils/tmdb.js.map +1 -1
- package/lib/module/NativeConsumet.ts +13 -8
- package/lib/module/extension-registry.json +35 -64
- package/lib/module/extension-registry.json.sig +1 -1
- package/lib/module/extractors/gofile.js +47 -10
- package/lib/module/extractors/gofile.js.map +1 -1
- package/lib/module/extractors/hubcloud.js +49 -42
- package/lib/module/extractors/hubcloud.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/index.js +1 -0
- package/lib/module/models/index.js.map +1 -1
- package/lib/module/models/meta-error.js +7 -3
- package/lib/module/models/meta-error.js.map +1 -1
- package/lib/module/models/provider-error.js +49 -0
- package/lib/module/models/provider-error.js.map +1 -0
- package/lib/module/models/types.js +3 -2
- package/lib/module/models/types.js.map +1 -1
- package/lib/module/providers/anime/anikoto/create-anikoto.js +91 -25
- package/lib/module/providers/anime/anikoto/create-anikoto.js.map +1 -1
- package/lib/module/providers/anime/{hianime.js → anikoto/hianime.js} +4 -4
- package/lib/module/providers/anime/anikoto/hianime.js.map +1 -0
- package/lib/module/providers/anime/animepahe/create-animepahe.js +111 -18
- package/lib/module/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/module/providers/anime/index.js +1 -9
- package/lib/module/providers/anime/index.js.map +1 -1
- package/lib/module/providers/anime/reanime/create-reanime.js +6 -2
- package/lib/module/providers/anime/reanime/create-reanime.js.map +1 -1
- package/lib/module/providers/common/concurrency.js +34 -0
- package/lib/module/providers/common/concurrency.js.map +1 -0
- package/lib/module/providers/common/errors.js +70 -0
- package/lib/module/providers/common/errors.js.map +1 -0
- package/lib/module/providers/common/servers.js +10 -3
- package/lib/module/providers/common/servers.js.map +1 -1
- package/lib/module/providers/common/ttl-cache.js +54 -0
- package/lib/module/providers/common/ttl-cache.js.map +1 -0
- package/lib/module/providers/manga/asurascans.js +29 -7
- package/lib/module/providers/manga/asurascans.js.map +1 -1
- package/lib/module/providers/meta/anilist-media.js +23 -13
- package/lib/module/providers/meta/anilist-media.js.map +1 -1
- package/lib/module/providers/meta/anilist.js +64 -19
- package/lib/module/providers/meta/anilist.js.map +1 -1
- package/lib/module/providers/meta/mal.js +3 -3
- package/lib/module/providers/meta/mal.js.map +1 -1
- package/lib/module/providers/meta/shared.js +8 -3
- package/lib/module/providers/meta/shared.js.map +1 -1
- package/lib/module/providers/meta/tmdb.js +153 -47
- package/lib/module/providers/meta/tmdb.js.map +1 -1
- package/lib/module/providers/movies/index.js +0 -4
- package/lib/module/providers/movies/index.js.map +1 -1
- package/lib/module/providers/movies/multimovies/create-multimovies.js +2 -1
- package/lib/module/providers/movies/multimovies/create-multimovies.js.map +1 -1
- package/lib/module/providers/movies/multistream/create-multistream.js +1 -1
- package/lib/module/providers/movies/multistream/create-multistream.js.map +1 -1
- package/lib/module/providers/movies/netflixmirror/create-netflixmirror.js +44 -11
- package/lib/module/providers/movies/netflixmirror/create-netflixmirror.js.map +1 -1
- package/lib/module/providers/movies/site-paths.js +3 -2
- package/lib/module/providers/movies/site-paths.js.map +1 -1
- package/lib/module/providers/movies/vegamovies/create-vegamovies.js +95 -44
- package/lib/module/providers/movies/vegamovies/create-vegamovies.js.map +1 -1
- package/lib/module/providers/provider-class.js +1 -1
- package/lib/module/utils/ExtractorManager.js +89 -11
- package/lib/module/utils/ExtractorManager.js.map +1 -1
- package/lib/module/utils/ProviderManager.js +54 -18
- package/lib/module/utils/ProviderManager.js.map +1 -1
- package/lib/module/utils/extension-modules.js +136 -24
- package/lib/module/utils/extension-modules.js.map +1 -1
- package/lib/module/utils/registry-schema.js +3 -2
- package/lib/module/utils/registry-schema.js.map +1 -1
- package/lib/module/utils/tmdb.js +51 -7
- package/lib/module/utils/tmdb.js.map +1 -1
- package/lib/typescript/commonjs/src/NativeConsumet.d.ts +13 -8
- package/lib/typescript/commonjs/src/NativeConsumet.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/gofile.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/hubcloud.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +4 -3
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/extension-manifest.d.ts +2 -0
- package/lib/typescript/commonjs/src/models/extension-manifest.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/models/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/meta-error.d.ts +4 -1
- package/lib/typescript/commonjs/src/models/meta-error.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/provider-error.d.ts +32 -0
- package/lib/typescript/commonjs/src/models/provider-error.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/models/types.d.ts +31 -3
- package/lib/typescript/commonjs/src/models/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/anikoto/create-anikoto.d.ts.map +1 -1
- package/lib/typescript/{module/src/providers/anime → commonjs/src/providers/anime/anikoto}/hianime.d.ts +2 -2
- package/lib/typescript/commonjs/src/providers/anime/anikoto/hianime.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/index.d.ts +0 -6
- package/lib/typescript/commonjs/src/providers/anime/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/reanime/create-reanime.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/common/concurrency.d.ts +8 -0
- package/lib/typescript/commonjs/src/providers/common/concurrency.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/common/errors.d.ts +36 -0
- package/lib/typescript/commonjs/src/providers/common/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/common/servers.d.ts +2 -1
- package/lib/typescript/commonjs/src/providers/common/servers.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/common/ttl-cache.d.ts +21 -0
- package/lib/typescript/commonjs/src/providers/common/ttl-cache.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/manga/asurascans.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/meta/anilist-media.d.ts +19 -7
- package/lib/typescript/commonjs/src/providers/meta/anilist-media.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/meta/anilist.d.ts +15 -7
- package/lib/typescript/commonjs/src/providers/meta/anilist.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/meta/mal.d.ts +1 -1
- package/lib/typescript/commonjs/src/providers/meta/shared.d.ts +4 -1
- package/lib/typescript/commonjs/src/providers/meta/shared.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/meta/tmdb.d.ts +65 -6
- package/lib/typescript/commonjs/src/providers/meta/tmdb.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/index.d.ts +0 -3
- package/lib/typescript/commonjs/src/providers/movies/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/multimovies/create-multimovies.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/netflixmirror/create-netflixmirror.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/site-paths.d.ts +3 -2
- package/lib/typescript/commonjs/src/providers/movies/site-paths.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/vegamovies/create-vegamovies.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/provider-class.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/ExtractorManager.d.ts +29 -1
- package/lib/typescript/commonjs/src/utils/ExtractorManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts +19 -5
- package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/extension-modules.d.ts +33 -8
- package/lib/typescript/commonjs/src/utils/extension-modules.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/registry-schema.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/registry-schema.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/tmdb.d.ts +18 -3
- package/lib/typescript/commonjs/src/utils/tmdb.d.ts.map +1 -1
- package/lib/typescript/module/src/NativeConsumet.d.ts +13 -8
- package/lib/typescript/module/src/NativeConsumet.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/gofile.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/hubcloud.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +4 -3
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/models/extension-manifest.d.ts +2 -0
- package/lib/typescript/module/src/models/extension-manifest.d.ts.map +1 -1
- package/lib/typescript/module/src/models/index.d.ts +1 -0
- package/lib/typescript/module/src/models/index.d.ts.map +1 -1
- package/lib/typescript/module/src/models/meta-error.d.ts +4 -1
- package/lib/typescript/module/src/models/meta-error.d.ts.map +1 -1
- package/lib/typescript/module/src/models/provider-error.d.ts +32 -0
- package/lib/typescript/module/src/models/provider-error.d.ts.map +1 -0
- package/lib/typescript/module/src/models/types.d.ts +31 -3
- package/lib/typescript/module/src/models/types.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/anikoto/create-anikoto.d.ts.map +1 -1
- package/lib/typescript/{commonjs/src/providers/anime → module/src/providers/anime/anikoto}/hianime.d.ts +2 -2
- package/lib/typescript/module/src/providers/anime/anikoto/hianime.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/index.d.ts +0 -6
- package/lib/typescript/module/src/providers/anime/index.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/reanime/create-reanime.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/common/concurrency.d.ts +8 -0
- package/lib/typescript/module/src/providers/common/concurrency.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/common/errors.d.ts +36 -0
- package/lib/typescript/module/src/providers/common/errors.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/common/servers.d.ts +2 -1
- package/lib/typescript/module/src/providers/common/servers.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/common/ttl-cache.d.ts +21 -0
- package/lib/typescript/module/src/providers/common/ttl-cache.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/manga/asurascans.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/meta/anilist-media.d.ts +19 -7
- package/lib/typescript/module/src/providers/meta/anilist-media.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/meta/anilist.d.ts +15 -7
- package/lib/typescript/module/src/providers/meta/anilist.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/meta/mal.d.ts +1 -1
- package/lib/typescript/module/src/providers/meta/shared.d.ts +4 -1
- package/lib/typescript/module/src/providers/meta/shared.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/meta/tmdb.d.ts +65 -6
- package/lib/typescript/module/src/providers/meta/tmdb.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/index.d.ts +0 -3
- package/lib/typescript/module/src/providers/movies/index.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/multimovies/create-multimovies.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/netflixmirror/create-netflixmirror.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/site-paths.d.ts +3 -2
- package/lib/typescript/module/src/providers/movies/site-paths.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/vegamovies/create-vegamovies.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/provider-class.d.ts +1 -1
- package/lib/typescript/module/src/utils/ExtractorManager.d.ts +29 -1
- package/lib/typescript/module/src/utils/ExtractorManager.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/ProviderManager.d.ts +19 -5
- package/lib/typescript/module/src/utils/ProviderManager.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/extension-modules.d.ts +33 -8
- package/lib/typescript/module/src/utils/extension-modules.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/registry-schema.d.ts +1 -1
- package/lib/typescript/module/src/utils/registry-schema.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/tmdb.d.ts +18 -3
- package/lib/typescript/module/src/utils/tmdb.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativeConsumet.ts +13 -8
- package/src/extension-registry.json +35 -64
- package/src/extension-registry.json.sig +1 -1
- package/src/extractors/gofile.ts +52 -11
- package/src/extractors/hubcloud.ts +62 -49
- package/src/index.tsx +4 -1
- package/src/models/extension-manifest.ts +3 -0
- package/src/models/index.ts +1 -0
- package/src/models/meta-error.ts +7 -3
- package/src/models/provider-error.ts +57 -0
- package/src/models/types.ts +27 -3
- package/src/providers/anime/anikoto/create-anikoto.ts +75 -27
- package/src/providers/anime/{hianime.ts → anikoto/hianime.ts} +5 -5
- package/src/providers/anime/animepahe/create-animepahe.ts +101 -19
- package/src/providers/anime/index.ts +0 -8
- package/src/providers/anime/reanime/create-reanime.ts +8 -1
- package/src/providers/common/concurrency.ts +32 -0
- package/src/providers/common/errors.ts +84 -0
- package/src/providers/common/servers.ts +7 -3
- package/src/providers/common/ttl-cache.ts +65 -0
- package/src/providers/manga/asurascans.ts +31 -7
- package/src/providers/meta/anilist-media.ts +20 -15
- package/src/providers/meta/anilist.ts +59 -17
- package/src/providers/meta/mal.ts +3 -3
- package/src/providers/meta/shared.ts +10 -3
- package/src/providers/meta/tmdb.ts +173 -38
- package/src/providers/movies/index.ts +0 -4
- package/src/providers/movies/multimovies/create-multimovies.ts +1 -0
- package/src/providers/movies/multistream/create-multistream.ts +1 -1
- package/src/providers/movies/netflixmirror/create-netflixmirror.ts +49 -11
- package/src/providers/movies/site-paths.ts +3 -2
- package/src/providers/movies/vegamovies/create-vegamovies.ts +93 -42
- package/src/providers/provider-class.ts +1 -1
- package/src/utils/ExtractorManager.ts +97 -11
- package/src/utils/ProviderManager.ts +74 -22
- package/src/utils/extension-modules.ts +145 -32
- package/src/utils/registry-schema.ts +2 -1
- package/src/utils/tmdb.ts +53 -7
- package/lib/commonjs/providers/anime/anineko/anineko.js +0 -11
- package/lib/commonjs/providers/anime/anineko/anineko.js.map +0 -1
- package/lib/commonjs/providers/anime/anineko/create-anineko.js +0 -358
- package/lib/commonjs/providers/anime/anineko/create-anineko.js.map +0 -1
- package/lib/commonjs/providers/anime/hianime.js.map +0 -1
- package/lib/commonjs/providers/anime/zoro/create-zoro.js +0 -362
- package/lib/commonjs/providers/anime/zoro/create-zoro.js.map +0 -1
- package/lib/commonjs/providers/anime/zoro/zoro.js +0 -11
- package/lib/commonjs/providers/anime/zoro/zoro.js.map +0 -1
- package/lib/commonjs/providers/movies/himovies/create-himovies.js +0 -231
- package/lib/commonjs/providers/movies/himovies/create-himovies.js.map +0 -1
- package/lib/commonjs/providers/movies/himovies/himovies.js +0 -11
- package/lib/commonjs/providers/movies/himovies/himovies.js.map +0 -1
- package/lib/module/providers/anime/anineko/anineko.js +0 -7
- package/lib/module/providers/anime/anineko/anineko.js.map +0 -1
- package/lib/module/providers/anime/anineko/create-anineko.js +0 -354
- package/lib/module/providers/anime/anineko/create-anineko.js.map +0 -1
- package/lib/module/providers/anime/hianime.js.map +0 -1
- package/lib/module/providers/anime/zoro/create-zoro.js +0 -358
- package/lib/module/providers/anime/zoro/create-zoro.js.map +0 -1
- package/lib/module/providers/anime/zoro/zoro.js +0 -7
- package/lib/module/providers/anime/zoro/zoro.js.map +0 -1
- package/lib/module/providers/movies/himovies/create-himovies.js +0 -227
- package/lib/module/providers/movies/himovies/create-himovies.js.map +0 -1
- package/lib/module/providers/movies/himovies/himovies.js +0 -7
- package/lib/module/providers/movies/himovies/himovies.js.map +0 -1
- package/lib/typescript/commonjs/src/providers/anime/anineko/anineko.d.ts +0 -5
- package/lib/typescript/commonjs/src/providers/anime/anineko/anineko.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/anime/anineko/create-anineko.d.ts +0 -52
- package/lib/typescript/commonjs/src/providers/anime/anineko/create-anineko.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/anime/hianime.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/anime/zoro/create-zoro.d.ts +0 -49
- package/lib/typescript/commonjs/src/providers/anime/zoro/create-zoro.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/anime/zoro/zoro.d.ts +0 -5
- package/lib/typescript/commonjs/src/providers/anime/zoro/zoro.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/movies/himovies/create-himovies.d.ts +0 -28
- package/lib/typescript/commonjs/src/providers/movies/himovies/create-himovies.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/providers/movies/himovies/himovies.d.ts +0 -5
- package/lib/typescript/commonjs/src/providers/movies/himovies/himovies.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/anime/anineko/anineko.d.ts +0 -5
- package/lib/typescript/module/src/providers/anime/anineko/anineko.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/anime/anineko/create-anineko.d.ts +0 -52
- package/lib/typescript/module/src/providers/anime/anineko/create-anineko.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/anime/hianime.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/anime/zoro/create-zoro.d.ts +0 -49
- package/lib/typescript/module/src/providers/anime/zoro/create-zoro.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/anime/zoro/zoro.d.ts +0 -5
- package/lib/typescript/module/src/providers/anime/zoro/zoro.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/movies/himovies/create-himovies.d.ts +0 -28
- package/lib/typescript/module/src/providers/movies/himovies/create-himovies.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/movies/himovies/himovies.d.ts +0 -5
- package/lib/typescript/module/src/providers/movies/himovies/himovies.d.ts.map +0 -1
- package/src/providers/anime/anineko/anineko.ts +0 -6
- package/src/providers/anime/anineko/create-anineko.ts +0 -394
- package/src/providers/anime/zoro/create-zoro.ts +0 -398
- package/src/providers/anime/zoro/zoro.ts +0 -6
- package/src/providers/movies/himovies/create-himovies.ts +0 -252
- package/src/providers/movies/himovies/himovies.ts +0 -6
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from '../../../models';
|
|
13
13
|
import { isFastDl, isGofilePage, isHubCloudPage, qualityIn, unwrapFastDlUrl } from '../../../extractors/file-hosts';
|
|
14
14
|
import { serverName } from '../../common/servers';
|
|
15
|
+
import { PAGE_TTL_MS, ttlCache } from '../../common/ttl-cache';
|
|
15
16
|
import { pageId, pageUrl } from '../site-paths';
|
|
16
17
|
|
|
17
18
|
const cleanTitle = (raw: string): string => {
|
|
@@ -57,6 +58,14 @@ const hostRank = (href: string) => DOWNLOAD_HOSTS.findIndex((host) => href.inclu
|
|
|
57
58
|
// FastDL links come from the site's nexdrive pages, and FastDL wants a Referer from there.
|
|
58
59
|
const NEXDRIVE_URL = 'https://nexdrive.fit/';
|
|
59
60
|
|
|
61
|
+
// Kept at the top level, so they outlive one provider instance (apps build one per query): a link
|
|
62
|
+
// page's (nexdrive) HTML by URL, when it links to a host, so servers, then sources, load it once.
|
|
63
|
+
const linkPages = ttlCache<any>({
|
|
64
|
+
ttlMs: PAGE_TTL_MS,
|
|
65
|
+
maxEntries: 16,
|
|
66
|
+
keep: (html) => typeof html === 'string' && /vcloud|hubcloud|fastdl|fsl\.|filebee|filepress|G-Direct/i.test(html),
|
|
67
|
+
});
|
|
68
|
+
|
|
60
69
|
const qualityRank = (text: string): number => {
|
|
61
70
|
if (/1080p|2160p|4k/i.test(text)) return 3;
|
|
62
71
|
if (/720p/i.test(text)) return 2;
|
|
@@ -436,23 +445,75 @@ export function createVegaMovies(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
436
445
|
};
|
|
437
446
|
};
|
|
438
447
|
|
|
439
|
-
/**
|
|
440
|
-
|
|
441
|
-
|
|
448
|
+
/**
|
|
449
|
+
* The files on a Gofile page (none when Gofile can't read it), and whether Gofile's API took or
|
|
450
|
+
* rejected the account token it keeps: a file (or an empty folder) says the token works, and
|
|
451
|
+
* `error-auth` that Gofile dropped it, so the next read gets a new one.
|
|
452
|
+
*/
|
|
453
|
+
const readGofile = async (source: IVideo): Promise<{ files: IVideo[]; tokenChecked: boolean }> => {
|
|
442
454
|
try {
|
|
443
455
|
const { sources } = await Gofile(ctx).extract(new PolyURL(source.url));
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
456
|
+
const files = sources.map((file) => ({
|
|
457
|
+
...file,
|
|
458
|
+
server: source.server,
|
|
459
|
+
quality: source.quality,
|
|
460
|
+
size: source.size,
|
|
461
|
+
}));
|
|
462
|
+
return { files, tokenChecked: true };
|
|
463
|
+
} catch (err) {
|
|
464
|
+
const message = String((err as Error | undefined)?.message);
|
|
465
|
+
return {
|
|
466
|
+
files: [],
|
|
467
|
+
tokenChecked: /^\[Gofile\] (API returned (error-auth|HTTP 401)$|No downloadable file)/.test(message),
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Each source, or when it is a Gofile page, the files on it, in order. Gofile pages are read one
|
|
474
|
+
* at a time until one checks Gofile's account token, then the others all at once. The token is
|
|
475
|
+
* kept from earlier calls and may have expired: the first page read with it drops it and the
|
|
476
|
+
* others get a new one, as when every page was read one after another.
|
|
477
|
+
*/
|
|
478
|
+
const resolveGofiles = async (sources: IVideo[]): Promise<IVideo[][]> => {
|
|
479
|
+
const resolved: (IVideo[] | Promise<IVideo[]>)[] = [];
|
|
480
|
+
let tokenChecked = false;
|
|
481
|
+
for (const source of sources) {
|
|
482
|
+
if (!isGofilePage(source.url)) {
|
|
483
|
+
resolved.push([source]);
|
|
484
|
+
} else if (tokenChecked) {
|
|
485
|
+
resolved.push(readGofile(source).then((read) => read.files));
|
|
486
|
+
} else {
|
|
487
|
+
const read = await readGofile(source);
|
|
488
|
+
tokenChecked = read.tokenChecked;
|
|
489
|
+
resolved.push(read.files);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
return Promise.all(resolved);
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
/** The files a HubCloud page lists (its Gofile pages read), as sources of an episode of `quality`. */
|
|
496
|
+
const hubCloudFiles = async (url: string, quality: string) => {
|
|
497
|
+
const res = await readHubCloud(url);
|
|
498
|
+
const sources: IVideo[] = [];
|
|
499
|
+
for (const files of await resolveGofiles(res.sources)) {
|
|
500
|
+
for (const file of files) {
|
|
501
|
+
sources.push({ ...file, quality: file.quality && file.quality !== 'auto' ? file.quality : quality });
|
|
502
|
+
}
|
|
447
503
|
}
|
|
504
|
+
return { sources, headers: res.headers };
|
|
448
505
|
};
|
|
449
506
|
|
|
450
|
-
/**
|
|
507
|
+
/**
|
|
508
|
+
* The servers a HubCloud page lists, labelled with HubCloud's name for their host, then the page
|
|
509
|
+
* itself (`hubcloud`), which fetchEpisodeSources reads again.
|
|
510
|
+
*/
|
|
451
511
|
const hubCloudServers = async (url: string): Promise<IEpisodeServer[]> => {
|
|
452
512
|
const servers: IEpisodeServer[] = [];
|
|
453
513
|
try {
|
|
454
|
-
for (const source of (await
|
|
455
|
-
|
|
514
|
+
for (const source of (await HubCloud(ctx).extract(new PolyURL(url))).sources) {
|
|
515
|
+
const name = serverName('hubcloud', source.server);
|
|
516
|
+
if (!servers.some((s) => s.name === name)) servers.push({ name, url: source.url, label: source.server });
|
|
456
517
|
}
|
|
457
518
|
} catch {
|
|
458
519
|
// The page itself stays a server.
|
|
@@ -461,6 +522,9 @@ export function createVegaMovies(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
461
522
|
return servers;
|
|
462
523
|
};
|
|
463
524
|
|
|
525
|
+
/** A link page's (nexdrive) HTML, which servers, then sources, read (see linkPages). */
|
|
526
|
+
const linkPage = (url: string) => linkPages.get(url, async () => (await request(url)).data);
|
|
527
|
+
|
|
464
528
|
/** Where a link page (nexdrive) sends the file: its HubCloud page and its FastDL and FilePress mirrors. */
|
|
465
529
|
const linkPageHosts = (html: string) => {
|
|
466
530
|
const $ = load(html);
|
|
@@ -484,7 +548,7 @@ export function createVegaMovies(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
484
548
|
if (isHubCloudPage(episodeUrl)) return hubCloudServers(episodeUrl);
|
|
485
549
|
if (isFastDl(episodeUrl)) return [{ name: serverName('fastdl'), url: episodeUrl }];
|
|
486
550
|
|
|
487
|
-
const hosts = linkPageHosts(
|
|
551
|
+
const hosts = linkPageHosts(await linkPage(episodeUrl));
|
|
488
552
|
const servers = hosts.hubCloud ? await hubCloudServers(hosts.hubCloud) : [];
|
|
489
553
|
if (hosts.fastDl) servers.push({ name: serverName('fastdl'), url: hosts.fastDl });
|
|
490
554
|
if (hosts.filePress) servers.push({ name: serverName('filepress'), url: hosts.filePress });
|
|
@@ -538,44 +602,31 @@ export function createVegaMovies(ctx: ProviderContext, customBaseURL?: string) {
|
|
|
538
602
|
};
|
|
539
603
|
}
|
|
540
604
|
|
|
541
|
-
// A link page (nexdrive) links to the HubCloud page and to mirrors on FastDL and FilePress
|
|
542
|
-
// Each mirror is optional: when one fails, the others still play.
|
|
543
|
-
|
|
605
|
+
// A link page (nexdrive) links to the HubCloud page and to mirrors on FastDL and FilePress, which
|
|
606
|
+
// all load at once. Each mirror is optional: when one fails, the others still play.
|
|
607
|
+
let hosts: ReturnType<typeof linkPageHosts> | undefined;
|
|
544
608
|
let hubCloudUrl: string | undefined = episodeUrl;
|
|
545
609
|
if (!isHubCloudPage(episodeUrl)) {
|
|
546
|
-
|
|
610
|
+
hosts = linkPageHosts(await linkPage(episodeUrl));
|
|
547
611
|
hubCloudUrl = hosts.hubCloud;
|
|
548
|
-
if (hosts.fastDl) {
|
|
549
|
-
try {
|
|
550
|
-
const file = await fastDlFile(hosts.fastDl, episodeUrl);
|
|
551
|
-
if (file) mirrors.push(fileSource(file, 'fastdl'));
|
|
552
|
-
} catch {}
|
|
553
|
-
}
|
|
554
|
-
if (hosts.filePress) {
|
|
555
|
-
try {
|
|
556
|
-
const file = await filePressFile(hosts.filePress);
|
|
557
|
-
if (file) mirrors.push(fileSource(file, 'filepress'));
|
|
558
|
-
} catch {}
|
|
559
|
-
}
|
|
560
612
|
}
|
|
613
|
+
const [fastDl, filePress, hubCloud] = await Promise.allSettled([
|
|
614
|
+
hosts?.fastDl ? fastDlFile(hosts.fastDl, episodeUrl) : undefined,
|
|
615
|
+
hosts?.filePress ? filePressFile(hosts.filePress) : undefined,
|
|
616
|
+
hubCloudUrl ? hubCloudFiles(hubCloudUrl, episodeQuality) : undefined,
|
|
617
|
+
]);
|
|
618
|
+
|
|
619
|
+
const mirrors: IVideo[] = [];
|
|
620
|
+
if (fastDl.status === 'fulfilled' && fastDl.value) mirrors.push(fileSource(fastDl.value, 'fastdl'));
|
|
621
|
+
if (filePress.status === 'fulfilled' && filePress.value) mirrors.push(fileSource(filePress.value, 'filepress'));
|
|
561
622
|
|
|
562
623
|
let headers: Record<string, string> = { Referer: baseUrl };
|
|
563
|
-
|
|
564
|
-
if (
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
hubCloudSources.push({
|
|
570
|
-
...file,
|
|
571
|
-
quality: file.quality && file.quality !== 'auto' ? file.quality : episodeQuality,
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
headers = res.headers ?? headers;
|
|
576
|
-
} catch (err) {
|
|
577
|
-
if (!mirrors.length) throw err;
|
|
578
|
-
}
|
|
624
|
+
let hubCloudSources: IVideo[] = [];
|
|
625
|
+
if (hubCloud.status === 'rejected') {
|
|
626
|
+
if (!mirrors.length) throw hubCloud.reason;
|
|
627
|
+
} else if (hubCloud.value) {
|
|
628
|
+
hubCloudSources = hubCloud.value.sources;
|
|
629
|
+
headers = hubCloud.value.headers ?? headers;
|
|
579
630
|
}
|
|
580
631
|
|
|
581
632
|
let sources = [...mirrors, ...hubCloudSources];
|
|
@@ -19,7 +19,7 @@ export interface ProviderClass<F extends ProviderFactory, B extends ParserClass>
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* The class form of a provider factory, e.g. `providerClass(AnimeParser,
|
|
22
|
+
* The class form of a provider factory, e.g. `providerClass(AnimeParser, createAniKoto)` for `new ANIME.AniKoto()`.
|
|
23
23
|
* Registry code only has the factory; the class exists so bundled providers keep `new` and `instanceof`.
|
|
24
24
|
*/
|
|
25
25
|
export function providerClass<F extends ProviderFactory, B extends ParserClass>(
|
|
@@ -10,6 +10,8 @@ type LoadedExtractor = { factory: ExtractorFactory; instance: IVideoExtractor };
|
|
|
10
10
|
export class ExtractorManager {
|
|
11
11
|
// Loads by `${extractor name}|${sha256}` (`|bundled` for extractors the registry lacks), see load
|
|
12
12
|
private loads = new Map<string, Promise<LoadedExtractor>>();
|
|
13
|
+
// Lowercased names of the extractors prefetch has started loading
|
|
14
|
+
private prefetched = new Set<string>();
|
|
13
15
|
private compiled: CompiledCodeCache;
|
|
14
16
|
private registry = new Map<string, ExtractorInfo>();
|
|
15
17
|
// Bundled extractors by lowercased name
|
|
@@ -93,14 +95,46 @@ export class ExtractorManager {
|
|
|
93
95
|
return (await this.load(extractorId)).factory;
|
|
94
96
|
}
|
|
95
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Start loading the registry versions of `extractorIds` (extractor or server names) in the
|
|
100
|
+
* background, so the first loadExtractor of each shares a load already under way. Each extractor
|
|
101
|
+
* is prefetched once per manager. Names the registry lacks are skipped, nothing falls back to the
|
|
102
|
+
* bundled extractor, and failures are ignored: a failed load is forgotten as usual, so the next
|
|
103
|
+
* loadExtractor tries the registry again. Never throws.
|
|
104
|
+
*/
|
|
105
|
+
prefetch(extractorIds: readonly string[]): void {
|
|
106
|
+
try {
|
|
107
|
+
if (!Array.isArray(extractorIds)) return;
|
|
108
|
+
for (const extractorId of extractorIds) {
|
|
109
|
+
if (typeof extractorId !== 'string') continue;
|
|
110
|
+
const metadata = this.getExtractorMetadata(extractorId);
|
|
111
|
+
if (!metadata) continue;
|
|
112
|
+
const name = metadata.name.toLowerCase();
|
|
113
|
+
if (this.prefetched.has(name)) continue;
|
|
114
|
+
this.prefetched.add(name);
|
|
115
|
+
this.registryLoad(name, metadata).catch(() => {});
|
|
116
|
+
}
|
|
117
|
+
} catch {
|
|
118
|
+
// A prefetch is only a head start.
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
96
122
|
/**
|
|
97
123
|
* Forget a loaded extractor and its compiled code, so the next load fetches and runs it again.
|
|
98
|
-
* Takes the same names as loadExtractor ('megacloud-hd-1', 'MegaCloud').
|
|
124
|
+
* Takes the same names as loadExtractor ('megacloud-hd-1', 'MegaCloud'). Extractors whose code has
|
|
125
|
+
* the same sha256 share one compiled copy, so forgetting one forgets the others' loads and
|
|
126
|
+
* compiled code too.
|
|
99
127
|
*/
|
|
100
128
|
invalidate(extractorId: string): void {
|
|
101
129
|
const name = this.nameOf(extractorId);
|
|
102
|
-
|
|
103
|
-
this.
|
|
130
|
+
const forgotten = new Set([name, ...this.compiled.forget(name)]);
|
|
131
|
+
const sha256 = this.registry.get(name)?.sha256;
|
|
132
|
+
if (sha256) for (const sibling of this.siblingsOf(sha256)) forgotten.add(sibling.name.toLowerCase());
|
|
133
|
+
for (const id of forgotten) {
|
|
134
|
+
deleteEntriesOf(this.loads, id);
|
|
135
|
+
this.compiled.forget(id);
|
|
136
|
+
this.prefetched.delete(id);
|
|
137
|
+
}
|
|
104
138
|
}
|
|
105
139
|
|
|
106
140
|
/**
|
|
@@ -134,20 +168,33 @@ export class ExtractorManager {
|
|
|
134
168
|
if (!bundled) throw new Error(`Extractor '${extractorId}' not found in registry or static extractors`);
|
|
135
169
|
return memoiseLoad(this.loads, `${name}|bundled`, async () => this.loaded(bundled));
|
|
136
170
|
}
|
|
137
|
-
|
|
138
|
-
// load isn't cached (memoiseLoad forgets it), so a network blip doesn't pin the bundled
|
|
139
|
-
// version: the next load tries the registry again.
|
|
140
|
-
const registryLoad = memoiseLoad(this.loads, `${name}|${metadata.sha256 ?? ''}`, async () => {
|
|
141
|
-
assertCompatibleEntry(metadata);
|
|
142
|
-
return this.loaded(this.compileExtractor(await fetchEntryCode('extractor', metadata.main), metadata));
|
|
143
|
-
});
|
|
144
|
-
return registryLoad.catch((error) => {
|
|
171
|
+
return this.registryLoad(name, metadata).catch((error) => {
|
|
145
172
|
if (!bundled) throw error;
|
|
146
173
|
console.warn(`Extractor '${metadata.name}' from the registry failed; using the bundled one:`, error);
|
|
147
174
|
return this.loaded(bundled);
|
|
148
175
|
});
|
|
149
176
|
}
|
|
150
177
|
|
|
178
|
+
/**
|
|
179
|
+
* The registry version of the extractor `name` (lowercased), loaded once per sha256. A version
|
|
180
|
+
* that needs a newer extension context is refused before it's downloaded, and code this manager
|
|
181
|
+
* already verified against the entry's sha256 (executeExtractorCode with the same code, say) isn't
|
|
182
|
+
* downloaded again. A failed load isn't cached (memoiseLoad forgets it), so a network blip doesn't
|
|
183
|
+
* pin the bundled version: the next load tries the registry again.
|
|
184
|
+
*/
|
|
185
|
+
private registryLoad(name: string, metadata: ExtractorInfo): Promise<LoadedExtractor> {
|
|
186
|
+
return memoiseLoad(this.loads, `${name}|${metadata.sha256 ?? ''}`, async () => {
|
|
187
|
+
assertCompatibleEntry(metadata);
|
|
188
|
+
const compiled = this.compiled.lookup(name, metadata.sha256, metadata.name);
|
|
189
|
+
return this.loaded(compiled ?? this.compileExtractor(await fetchEntryCode('extractor', metadata.main), metadata));
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** The registry extractors whose code has this sha256. */
|
|
194
|
+
private siblingsOf(sha256: string): ExtractorInfo[] {
|
|
195
|
+
return Array.from(this.registry.values()).filter((extractor) => extractor.sha256 === sha256);
|
|
196
|
+
}
|
|
197
|
+
|
|
151
198
|
private loaded(factory: ExtractorFactory): LoadedExtractor {
|
|
152
199
|
return { factory, instance: factory(this.context) };
|
|
153
200
|
}
|
|
@@ -162,7 +209,46 @@ export class ExtractorManager {
|
|
|
162
209
|
code,
|
|
163
210
|
entry: metadata,
|
|
164
211
|
globals: () => extensionGlobals('extractor', id, this.context),
|
|
212
|
+
siblings: () => (metadata?.sha256 ? this.siblingsOf(metadata.sha256).map((extractor) => extractor.name) : []),
|
|
165
213
|
skipIntegrity: options.skipIntegrity,
|
|
166
214
|
}) as ExtractorFactory;
|
|
167
215
|
}
|
|
168
216
|
}
|
|
217
|
+
|
|
218
|
+
// Hosts providers name servers after that aren't extractors (`fastdl`, `netmirror-netflix`).
|
|
219
|
+
const HOST_NAMES = ['FastDL', 'FilePress', 'NetMirror'];
|
|
220
|
+
const DISPLAY_NAMES = new Map(
|
|
221
|
+
[...Object.keys(defaultExtractors), ...HOST_NAMES].map((name): [string, string] => [name.toLowerCase(), name])
|
|
222
|
+
);
|
|
223
|
+
const ACRONYMS = new Set(['hd', 'sd', 'fhd', 'uhd', 'hq', 'cf']);
|
|
224
|
+
|
|
225
|
+
const capitalize = (word: string) => word.charAt(0).toUpperCase() + word.slice(1);
|
|
226
|
+
|
|
227
|
+
/** The label part of a server name, readable: `hd-1` -> `HD-1`, `cf-storage` -> `CF Storage`. */
|
|
228
|
+
function labelFromSlug(slug: string): string {
|
|
229
|
+
const words = slug.toLowerCase().split('-').filter(Boolean);
|
|
230
|
+
return words
|
|
231
|
+
.map((word, index) => {
|
|
232
|
+
const shown = ACRONYMS.has(word) || /^\d+k$/.test(word) ? word.toUpperCase() : capitalize(word);
|
|
233
|
+
if (index === 0) return shown;
|
|
234
|
+
return ACRONYMS.has(words[index - 1]!) && /^\d+$/.test(word) ? `-${shown}` : ` ${shown}`;
|
|
235
|
+
})
|
|
236
|
+
.join('');
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* A server's name for people: its extractor or host, then the site's `label` for it when the
|
|
241
|
+
* provider gives one (IEpisodeServer `label`), else the rest of `name` made readable.
|
|
242
|
+
* `('megaplay-hd-1', 'HD-1')` -> `MegaPlay · HD-1`, `('kwik-subsplease-1080', 'SubsPlease · 1080p')`
|
|
243
|
+
* -> `Kwik · SubsPlease · 1080p`, `('hubcloud-cf-storage')` -> `HubCloud · CF Storage`.
|
|
244
|
+
*/
|
|
245
|
+
export function serverDisplayName(name: string, label?: string): string {
|
|
246
|
+
const [prefix = '', ...rest] = String(name ?? '')
|
|
247
|
+
.trim()
|
|
248
|
+
.split('-');
|
|
249
|
+
const host = DISPLAY_NAMES.get(prefix.toLowerCase()) ?? capitalize(prefix);
|
|
250
|
+
const shownLabel =
|
|
251
|
+
(typeof label === 'string' ? label.replace(/\s+/g, ' ').trim() : '') || labelFromSlug(rest.join('-'));
|
|
252
|
+
if (!host) return shownLabel;
|
|
253
|
+
return shownLabel && shownLabel.toLowerCase() !== host.toLowerCase() ? `${host} · ${shownLabel}` : host;
|
|
254
|
+
}
|
|
@@ -19,7 +19,14 @@ import type {
|
|
|
19
19
|
ProviderType,
|
|
20
20
|
} from '../models/extension-manifest';
|
|
21
21
|
import { IntegrityError, type ExecuteCodeOptions, type IntegrityOptions } from './extension-integrity';
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
CompiledCodeCache,
|
|
24
|
+
deleteEntriesOf,
|
|
25
|
+
extensionGlobals,
|
|
26
|
+
fetchEntryCode,
|
|
27
|
+
memoiseLoad,
|
|
28
|
+
type ExtensionFactory,
|
|
29
|
+
} from './extension-modules';
|
|
23
30
|
import { assertCompatibleEntry, validateRegistry } from './registry-schema';
|
|
24
31
|
|
|
25
32
|
export interface ProviderLoadOptions {
|
|
@@ -65,7 +72,7 @@ const CATEGORIES: Record<ProviderType, { article: string; base?: abstract new ()
|
|
|
65
72
|
};
|
|
66
73
|
|
|
67
74
|
/** Registry ids of the providers in the bundled registry (test/unit/provider-manager.test.ts checks the lists). */
|
|
68
|
-
export type KnownAnimeProviderId = 'animepahe' | 'anikoto'
|
|
75
|
+
export type KnownAnimeProviderId = 'animepahe' | 'anikoto';
|
|
69
76
|
export type KnownMovieProviderId = 'vegamovies' | 'netflixmirror' | 'primemirror' | 'disneymirror';
|
|
70
77
|
|
|
71
78
|
/** Any registry id; known ids autocomplete, and providers added to a registry later still type-check. */
|
|
@@ -88,6 +95,10 @@ export type ProviderOfCategory<C extends ProviderType> = C extends 'anime'
|
|
|
88
95
|
[M in (typeof REQUIRED_PROVIDER_METHODS)[C][number]]: (...args: any[]) => Promise<any>;
|
|
89
96
|
};
|
|
90
97
|
|
|
98
|
+
/** The compiled-code key of an entry: its lowercased id and its factory name. */
|
|
99
|
+
const compileKeyOf = (metadata: { id?: unknown; factoryName?: unknown }) =>
|
|
100
|
+
`${String(metadata?.id ?? metadata?.factoryName).toLowerCase()}|${metadata?.factoryName}`;
|
|
101
|
+
|
|
91
102
|
export class ProviderManager {
|
|
92
103
|
private providerContext: ProviderContext;
|
|
93
104
|
private extractorManager: ExtractorManager;
|
|
@@ -133,7 +144,7 @@ export class ProviderManager {
|
|
|
133
144
|
return this.extensions.filter((ext) => ext.category === category);
|
|
134
145
|
}
|
|
135
146
|
|
|
136
|
-
/** The registry entry for an id or name, case-insensitive ('
|
|
147
|
+
/** The registry entry for an id or name, case-insensitive ('anikoto' or 'AniKoto'). */
|
|
137
148
|
getExtensionMetadata(extensionId: string): ExtensionManifest {
|
|
138
149
|
if (!extensionId) throw new Error('Extension id/name is required');
|
|
139
150
|
const manifest = this.byKey.get(extensionId.toLowerCase());
|
|
@@ -143,7 +154,9 @@ export class ProviderManager {
|
|
|
143
154
|
|
|
144
155
|
/**
|
|
145
156
|
* Load an extension by id or name. Concurrent and later calls for the same extension and base URL
|
|
146
|
-
* share one load; a failed load is retried on the next call.
|
|
157
|
+
* share one load; a failed load is retried on the next call. Code this manager already verified
|
|
158
|
+
* against the entry's sha256 (run by executeProviderCode, or by an entry with the same code) isn't
|
|
159
|
+
* downloaded again. The entry's extractors start loading at the same time (ExtractorManager.prefetch).
|
|
147
160
|
*/
|
|
148
161
|
async loadExtension<T extends string>(
|
|
149
162
|
extensionId: T,
|
|
@@ -156,25 +169,40 @@ export class ProviderManager {
|
|
|
156
169
|
// Keyed on the hash, so a new version is loaded again, and on the base URL override, which
|
|
157
170
|
// builds a different instance.
|
|
158
171
|
const key = `${metadata.id.toLowerCase()}|${metadata.sha256 ?? ''}|${options.baseUrl ?? ''}`;
|
|
159
|
-
return memoiseLoad(this.loads, key, async () =>
|
|
160
|
-
this.
|
|
161
|
-
|
|
172
|
+
return memoiseLoad(this.loads, key, async () => {
|
|
173
|
+
const compiled = this.compiled.lookup(compileKeyOf(metadata), metadata.sha256, metadata.factoryName);
|
|
174
|
+
// The provider's own download goes out first, its extractors' right after it.
|
|
175
|
+
const code = compiled ? undefined : fetchEntryCode('provider', metadata.main);
|
|
176
|
+
this.extractorManager.prefetch(metadata.extractors);
|
|
177
|
+
if (compiled) return this.instantiate(() => compiled, metadata, options);
|
|
178
|
+
return this.executeProviderCode(await code!, metadata, options);
|
|
179
|
+
});
|
|
162
180
|
}
|
|
163
181
|
|
|
164
182
|
/**
|
|
165
183
|
* Forget a loaded extension (for every base URL) and its compiled code, so the next load
|
|
166
|
-
* fetches and runs it again.
|
|
184
|
+
* fetches and runs it again. Entries whose code has the same sha256 (the three NetMirror
|
|
185
|
+
* catalogs) share one compiled copy and its top-level state, so forgetting one forgets that copy
|
|
186
|
+
* and the other entries' loads and compiled code too. Extractors have their own:
|
|
187
|
+
* `getExtractorManager().invalidate(name)`.
|
|
167
188
|
*/
|
|
168
189
|
invalidate(extensionId: string): void {
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
this.compiled.forget(id);
|
|
190
|
+
const metadata = this.byKey.get(extensionId.toLowerCase());
|
|
191
|
+
const id = (metadata?.id ?? extensionId).toLowerCase();
|
|
192
|
+
const forgotten = new Set([id, ...this.compiled.forget(id)]);
|
|
193
|
+
for (const sibling of this.siblingsOf(metadata?.sha256)) forgotten.add(sibling.id.toLowerCase());
|
|
194
|
+
for (const other of forgotten) {
|
|
195
|
+
deleteEntriesOf(this.loads, other);
|
|
196
|
+
this.compiled.forget(other);
|
|
197
|
+
}
|
|
172
198
|
}
|
|
173
199
|
|
|
174
200
|
/**
|
|
175
201
|
* Run an entry's provider code and build the provider with this manager's context. The code must
|
|
176
202
|
* match `metadata.sha256` unless `options.skipIntegrity` is set. Verified code is compiled once per
|
|
177
|
-
*
|
|
203
|
+
* sha256, shared by every entry with that sha256 (so they share its top-level state); each call
|
|
204
|
+
* returns a new instance, an instance of its category's base parser. Once the provider is built,
|
|
205
|
+
* the entry's extractors start loading (ExtractorManager.prefetch).
|
|
178
206
|
*
|
|
179
207
|
* @throws RegistryError before running anything if the entry needs a newer extension context
|
|
180
208
|
* @throws IntegrityError before running anything if the hash or factory name is invalid
|
|
@@ -186,17 +214,36 @@ export class ProviderManager {
|
|
|
186
214
|
): Promise<ProviderInstanceOf<T>> {
|
|
187
215
|
const id = String(metadata?.id ?? metadata?.factoryName);
|
|
188
216
|
assertCompatibleEntry(metadata);
|
|
217
|
+
const provider = this.instantiate(
|
|
218
|
+
() =>
|
|
219
|
+
this.compiled.compile(compileKeyOf(metadata), {
|
|
220
|
+
kind: 'provider',
|
|
221
|
+
id,
|
|
222
|
+
name: metadata.factoryName,
|
|
223
|
+
code,
|
|
224
|
+
entry: metadata,
|
|
225
|
+
globals: () => extensionGlobals('provider', id, this.providerContext),
|
|
226
|
+
siblings: () => this.siblingsOf(metadata.sha256).map((extension) => extension.factoryName),
|
|
227
|
+
skipIntegrity: options.skipIntegrity,
|
|
228
|
+
}),
|
|
229
|
+
metadata,
|
|
230
|
+
options
|
|
231
|
+
);
|
|
232
|
+
this.extractorManager.prefetch(metadata.extractors);
|
|
233
|
+
return provider;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Build the provider of an entry with the factory `factoryOf` gives (compiling it, say) and check
|
|
238
|
+
* it has its category's methods. Errors other than IntegrityError become provider code errors.
|
|
239
|
+
*/
|
|
240
|
+
private instantiate(
|
|
241
|
+
factoryOf: () => ExtensionFactory,
|
|
242
|
+
metadata: ExtensionManifest,
|
|
243
|
+
options: ProviderLoadOptions
|
|
244
|
+
): any {
|
|
189
245
|
try {
|
|
190
|
-
const
|
|
191
|
-
kind: 'provider',
|
|
192
|
-
id,
|
|
193
|
-
name: metadata.factoryName,
|
|
194
|
-
code,
|
|
195
|
-
entry: metadata,
|
|
196
|
-
globals: () => extensionGlobals('provider', id, this.providerContext),
|
|
197
|
-
skipIntegrity: options.skipIntegrity,
|
|
198
|
-
});
|
|
199
|
-
const instance = factory(this.providerContext, options.baseUrl ?? metadata.baseUrl);
|
|
246
|
+
const instance = factoryOf()(this.providerContext, options.baseUrl ?? metadata.baseUrl);
|
|
200
247
|
this.assertProviderOf(instance, metadata.category);
|
|
201
248
|
const base = CATEGORIES[metadata.category].base;
|
|
202
249
|
if (base && !(instance instanceof base)) Object.setPrototypeOf(instance, base.prototype);
|
|
@@ -208,6 +255,11 @@ export class ProviderManager {
|
|
|
208
255
|
}
|
|
209
256
|
}
|
|
210
257
|
|
|
258
|
+
/** The registry entries whose code has this sha256 (none without one). */
|
|
259
|
+
private siblingsOf(sha256: string | undefined): ExtensionManifest[] {
|
|
260
|
+
return sha256 ? this.extensions.filter((extension) => extension.sha256 === sha256) : [];
|
|
261
|
+
}
|
|
262
|
+
|
|
211
263
|
/** Throws unless the instance has the methods its category requires (REQUIRED_PROVIDER_METHODS). */
|
|
212
264
|
private assertProviderOf(instance: any, category: ProviderType): void {
|
|
213
265
|
const requiredMethods = (REQUIRED_PROVIDER_METHODS as Record<string, readonly string[] | undefined>)[category];
|