react-native-consumet 4.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +33 -62
- 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.map +1 -1
- package/lib/commonjs/providers/anime/anikoto/create-anikoto.js +88 -23
- 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 +25 -14
- 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 +33 -62
- 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.map +1 -1
- package/lib/module/providers/anime/anikoto/create-anikoto.js +89 -23
- 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 +26 -15
- 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 +27 -0
- 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 +14 -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 +27 -0
- 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 +14 -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 +33 -62
- 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 +23 -0
- package/src/providers/anime/anikoto/create-anikoto.ts +73 -25
- 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 +23 -13
- 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
|
@@ -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
|
|
84
|
-
//
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 [
|
|
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
|
|
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
|
|
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://
|
|
7
|
-
* counts, so a custom base URL and links to the
|
|
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);
|
|
@@ -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
|
+
}
|