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
|
@@ -4,9 +4,12 @@ import { toUrl } from "./url.js";
|
|
|
4
4
|
const GOFILE_API = 'https://api.gofile.io';
|
|
5
5
|
const GOFILE_LANGUAGE = 'en-US';
|
|
6
6
|
// Shared by every call, so one guest account and one copy of the site's token script serve them all.
|
|
7
|
+
// Calls made while one is loading wait for that load instead of starting another.
|
|
7
8
|
let cachedAccountToken = null;
|
|
8
9
|
let cachedGenerateWT = null;
|
|
9
10
|
let cachedWTTime = 0;
|
|
11
|
+
let accountTokenLoad = null;
|
|
12
|
+
let generateWTLoad = null;
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
* Globals of the app the site's script must not reach. `new Function` code sees the real global
|
|
@@ -19,11 +22,26 @@ const HIDDEN_GLOBALS = ['global', 'fetch', 'XMLHttpRequest', 'WebSocket', 'Event
|
|
|
19
22
|
* The site's `generateWT`, which makes the X-Website-Token its API wants from the account token.
|
|
20
23
|
* It comes from gofile.io/js/wt.obf.js, run against a stand-in browser; kept for three hours.
|
|
21
24
|
*/
|
|
22
|
-
|
|
25
|
+
function getOrFetchGenerateWT(axiosClient, userAgent) {
|
|
23
26
|
const now = Date.now();
|
|
24
27
|
if (cachedGenerateWT && now - cachedWTTime < 3 * 60 * 60 * 1000) {
|
|
25
|
-
return cachedGenerateWT;
|
|
28
|
+
return Promise.resolve(cachedGenerateWT);
|
|
26
29
|
}
|
|
30
|
+
if (!generateWTLoad) {
|
|
31
|
+
const load = fetchGenerateWT(axiosClient, userAgent).then(generateWT => {
|
|
32
|
+
if (generateWTLoad === load) generateWTLoad = null;
|
|
33
|
+
cachedGenerateWT = generateWT;
|
|
34
|
+
cachedWTTime = now;
|
|
35
|
+
return generateWT;
|
|
36
|
+
}, error => {
|
|
37
|
+
if (generateWTLoad === load) generateWTLoad = null;
|
|
38
|
+
throw error;
|
|
39
|
+
});
|
|
40
|
+
generateWTLoad = load;
|
|
41
|
+
}
|
|
42
|
+
return generateWTLoad;
|
|
43
|
+
}
|
|
44
|
+
async function fetchGenerateWT(axiosClient, userAgent) {
|
|
27
45
|
const res = await axiosClient.get('https://gofile.io/js/wt.obf.js', {
|
|
28
46
|
headers: {
|
|
29
47
|
'User-Agent': userAgent,
|
|
@@ -48,12 +66,24 @@ async function getOrFetchGenerateWT(axiosClient, userAgent) {
|
|
|
48
66
|
// would be the app's global object.
|
|
49
67
|
const generateWT = runner.call(fakeWin, fakeNav, fakeWin, {}, fakeWin.location, fakeWin, fakeWin);
|
|
50
68
|
if (typeof generateWT !== 'function') throw new Error('[Gofile] wt.obf.js no longer defines generateWT');
|
|
51
|
-
cachedGenerateWT = generateWT;
|
|
52
|
-
cachedWTTime = now;
|
|
53
69
|
return generateWT;
|
|
54
70
|
}
|
|
55
|
-
|
|
56
|
-
if (cachedAccountToken) return cachedAccountToken;
|
|
71
|
+
function getOrFetchToken(axiosClient, userAgent) {
|
|
72
|
+
if (cachedAccountToken) return Promise.resolve(cachedAccountToken);
|
|
73
|
+
if (!accountTokenLoad) {
|
|
74
|
+
const load = fetchToken(axiosClient, userAgent).then(token => {
|
|
75
|
+
if (accountTokenLoad === load) accountTokenLoad = null;
|
|
76
|
+
cachedAccountToken = token;
|
|
77
|
+
return token;
|
|
78
|
+
}, error => {
|
|
79
|
+
if (accountTokenLoad === load) accountTokenLoad = null;
|
|
80
|
+
throw error;
|
|
81
|
+
});
|
|
82
|
+
accountTokenLoad = load;
|
|
83
|
+
}
|
|
84
|
+
return accountTokenLoad;
|
|
85
|
+
}
|
|
86
|
+
async function fetchToken(axiosClient, userAgent) {
|
|
57
87
|
const accountResponse = await axiosClient.post(`${GOFILE_API}/accounts`, {}, {
|
|
58
88
|
headers: {
|
|
59
89
|
'User-Agent': userAgent,
|
|
@@ -63,7 +93,6 @@ async function getOrFetchToken(axiosClient, userAgent) {
|
|
|
63
93
|
});
|
|
64
94
|
const token = accountResponse.data?.data?.token;
|
|
65
95
|
if (!token) throw new Error('[Gofile] Did not return an account token');
|
|
66
|
-
cachedAccountToken = token;
|
|
67
96
|
return token;
|
|
68
97
|
}
|
|
69
98
|
function findFirstFile(content) {
|
|
@@ -83,8 +112,13 @@ export function Gofile(ctx) {
|
|
|
83
112
|
const extract = async videoUrl => {
|
|
84
113
|
const url = toUrl(PolyURL, videoUrl);
|
|
85
114
|
const id = url.searchParams.get('c') || url.pathname.split('/').filter(Boolean).pop() || url.href;
|
|
86
|
-
|
|
87
|
-
|
|
115
|
+
|
|
116
|
+
// Both load at once; the token is awaited first, so its error is the one thrown when both fail.
|
|
117
|
+
const tokenLoading = getOrFetchToken(axios, USER_AGENT);
|
|
118
|
+
const generateWTLoading = getOrFetchGenerateWT(axios, USER_AGENT);
|
|
119
|
+
generateWTLoading.catch(() => undefined);
|
|
120
|
+
const token = await tokenLoading;
|
|
121
|
+
const generateWT = await generateWTLoading;
|
|
88
122
|
const response = await axios.get(`${GOFILE_API}/contents/${id}`, {
|
|
89
123
|
params: {
|
|
90
124
|
contentFilter: '',
|
|
@@ -107,7 +141,10 @@ export function Gofile(ctx) {
|
|
|
107
141
|
validateStatus: () => true
|
|
108
142
|
});
|
|
109
143
|
if (response.data?.status !== 'ok') {
|
|
110
|
-
|
|
144
|
+
// Only the token this call used: another call may already have replaced it.
|
|
145
|
+
if ((response.data?.status === 'error-auth' || response.status === 401) && cachedAccountToken === token) {
|
|
146
|
+
cachedAccountToken = null;
|
|
147
|
+
}
|
|
111
148
|
throw new Error(`[Gofile] API returned ${response.data?.status ?? `HTTP ${response.status}`}`);
|
|
112
149
|
}
|
|
113
150
|
const file = findFirstFile(response.data.data);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["toUrl","GOFILE_API","GOFILE_LANGUAGE","cachedAccountToken","cachedGenerateWT","cachedWTTime","HIDDEN_GLOBALS","getOrFetchGenerateWT","axiosClient","userAgent","now","Date","res","get","headers","runner","Function","concat","join","data","fakeNav","language","fakeWin","navigator","location","href","protocol","host","
|
|
1
|
+
{"version":3,"names":["toUrl","GOFILE_API","GOFILE_LANGUAGE","cachedAccountToken","cachedGenerateWT","cachedWTTime","accountTokenLoad","generateWTLoad","HIDDEN_GLOBALS","getOrFetchGenerateWT","axiosClient","userAgent","now","Date","Promise","resolve","load","fetchGenerateWT","then","generateWT","error","res","get","headers","runner","Function","concat","join","data","fakeNav","language","fakeWin","navigator","location","href","protocol","host","call","Error","getOrFetchToken","fetchToken","token","accountResponse","post","findFirstFile","content","type","link","child","Object","values","children","file","undefined","Gofile","ctx","axios","USER_AGENT","PolyURL","extract","videoUrl","url","id","searchParams","pathname","split","filter","Boolean","pop","tokenLoading","generateWTLoading","catch","response","params","contentFilter","page","pageSize","sortField","sortDirection","validateStatus","status","source","isM3U8","includes","isDASH","quality","sources","download"],"sourceRoot":"../../../src","sources":["extractors/gofile.ts"],"mappings":";;AAEA,SAASA,KAAK,QAAQ,UAAO;AAE7B,MAAMC,UAAU,GAAG,uBAAuB;AAC1C,MAAMC,eAAe,GAAG,OAAO;AAS/B;AACA;AACA,IAAIC,kBAAiC,GAAG,IAAI;AAC5C,IAAIC,gBAAoD,GAAG,IAAI;AAC/D,IAAIC,YAAY,GAAG,CAAC;AACpB,IAAIC,gBAAwC,GAAG,IAAI;AACnD,IAAIC,cAAyD,GAAG,IAAI;;AAEpE;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAG,CACrB,QAAQ,EACR,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,SAAS,EACT,QAAQ,EACR,SAAS,EACT,SAAS,EACT,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,E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,IAAI,EAAEL,IAAI,EAAE,MAAM,IAAIT,KAAK,CAAC,wDAAwD,CAAC;IAE1F,MAAM2C,MAAc,GAAG;MACrBpB,GAAG,EAAET,IAAI,CAACL,IAAI;MACdmC,MAAM,EAAE9B,IAAI,CAACL,IAAI,CAACoC,QAAQ,CAAC,OAAO,CAAC;MACnCC,MAAM,EAAEhC,IAAI,CAACL,IAAI,CAACoC,QAAQ,CAAC,MAAM,CAAC;MAClCE,OAAO,EAAE;IACX,CAAC;IAED,OAAO;MACLC,OAAO,EAAE,CAACL,MAAM,CAAC;MACjB1D,OAAO,EAAE;QAAE,YAAY,EAAEkC,UAAU;QAAE,SAAS,EAAE,oBAAoB;QAAE,QAAQ,EAAE,gBAAgBhB,KAAK;MAAG,CAAC;MACzG8C,QAAQ,EAAEnC,IAAI,CAACL;IACjB,CAAC;EACH,CAAC;EAED,OAAO;IAAEY;EAAQ,CAAC;AACpB","ignoreList":[]}
|
|
@@ -18,6 +18,9 @@ function parseSizeInBytes(text) {
|
|
|
18
18
|
|
|
19
19
|
/** The hosts HubCloud names its sources by (`server`), fastest first: the order the sources are listed in. */
|
|
20
20
|
const HOSTS = ['CF Storage', 'CF Worker', 'Gofile', 'Pixeldrain', 'FastDl', 'HubCdn', 'GDrive (download only)'];
|
|
21
|
+
|
|
22
|
+
/** A source a button links to: its URL and host. */
|
|
23
|
+
|
|
21
24
|
/**
|
|
22
25
|
* HubCloud, which also reads V-Cloud pages: the file's hosts, as one source each, fastest first.
|
|
23
26
|
* A Gofile host is listed as its Gofile page (server `Gofile`): run the Gofile extractor on it for
|
|
@@ -72,7 +75,7 @@ export function HubCloud(ctx) {
|
|
|
72
75
|
if (isGofilePage(vcloudLink)) gofilePages.push(vcloudLink);else if (vcloudLink !== url.href) vcloudPage = (await axios.get(vcloudLink, {
|
|
73
76
|
headers: pageHeaders
|
|
74
77
|
})).data;
|
|
75
|
-
const $ = load(vcloudPage
|
|
78
|
+
const $ = vcloudPage ? load(vcloudPage) : $first;
|
|
76
79
|
if (pageQuality === 'auto') {
|
|
77
80
|
pageQuality = qualityIn($('title').text()) || qualityIn($('.card-header').text()) || qualityIn(vcloudLink) || 'auto';
|
|
78
81
|
}
|
|
@@ -88,51 +91,55 @@ export function HubCloud(ctx) {
|
|
|
88
91
|
size: fileSize
|
|
89
92
|
});
|
|
90
93
|
};
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
|
|
95
|
+
/** A button's source, if it has one; for a button that redirects, its request, which never rejects. */
|
|
96
|
+
const buttonSource = btnUrl => {
|
|
97
|
+
switch (true) {
|
|
98
|
+
case btnUrl.includes('pixeld'):
|
|
99
|
+
if (!btnUrl.includes('api')) {
|
|
100
|
+
btnUrl = pixelDrainRedirect(firstPage, vcloudPage) || btnUrl;
|
|
101
|
+
const token = btnUrl.split('/').pop()?.split('?')[0];
|
|
102
|
+
btnUrl = `${btnUrl.split('/').slice(0, -2).join('/')}/api/file/${token}?download`;
|
|
103
|
+
}
|
|
104
|
+
return [btnUrl, 'Pixeldrain'];
|
|
105
|
+
case btnUrl.includes('.dev') && !btnUrl.includes('/?id='):
|
|
106
|
+
return [btnUrl, 'CF Worker'];
|
|
107
|
+
case btnUrl.includes('hubcloud') || btnUrl.includes('/?id='):
|
|
108
|
+
// The button redirects to the Google Drive file, sometimes through a `?link=<url>` page.
|
|
109
|
+
return axios.get(btnUrl, {
|
|
110
|
+
headers: pageHeaders,
|
|
111
|
+
validateStatus: () => true
|
|
112
|
+
}).then(res => {
|
|
113
|
+
const redirected = finalUrl(res, btnUrl);
|
|
114
|
+
return [redirected.includes('?link=') ? redirected.split('?link=')[1] || redirected : redirected, 'GDrive (download only)'];
|
|
115
|
+
}).catch(() => undefined);
|
|
116
|
+
case isGofilePage(btnUrl):
|
|
117
|
+
gofilePages.push(btnUrl);
|
|
118
|
+
return undefined;
|
|
119
|
+
case btnUrl.includes('cloudflarestorage'):
|
|
120
|
+
return [btnUrl, 'CF Storage'];
|
|
121
|
+
case isFastDl(btnUrl):
|
|
122
|
+
return [unwrapFastDlUrl(btnUrl), 'FastDl'];
|
|
123
|
+
case btnUrl.includes('hubcdn') && !btnUrl.includes('/?id='):
|
|
124
|
+
return [btnUrl, 'HubCdn'];
|
|
125
|
+
default:
|
|
126
|
+
return ['.m3u8', '.mp4', '.mkv', '?token='].some(part => btnUrl.includes(part)) ? [btnUrl, 'CF Worker'] : undefined;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// Every button's request starts at once; their sources are added in button order, so the first
|
|
131
|
+
// button keeps a link two buttons share.
|
|
132
|
+
const found = $('.btn-success.btn-lg.h6, .btn-danger, .btn-secondary').toArray().map(element => {
|
|
93
133
|
try {
|
|
94
|
-
|
|
95
|
-
case btnUrl.includes('pixeld'):
|
|
96
|
-
if (!btnUrl.includes('api')) {
|
|
97
|
-
btnUrl = pixelDrainRedirect(firstPage, vcloudPage) || btnUrl;
|
|
98
|
-
const token = btnUrl.split('/').pop()?.split('?')[0];
|
|
99
|
-
btnUrl = `${btnUrl.split('/').slice(0, -2).join('/')}/api/file/${token}?download`;
|
|
100
|
-
}
|
|
101
|
-
add(btnUrl, 'Pixeldrain');
|
|
102
|
-
break;
|
|
103
|
-
case btnUrl.includes('.dev') && !btnUrl.includes('/?id='):
|
|
104
|
-
add(btnUrl, 'CF Worker');
|
|
105
|
-
break;
|
|
106
|
-
case btnUrl.includes('hubcloud') || btnUrl.includes('/?id='):
|
|
107
|
-
{
|
|
108
|
-
// The button redirects to the Google Drive file, sometimes through a `?link=<url>` page.
|
|
109
|
-
const res = await axios.get(btnUrl, {
|
|
110
|
-
headers: pageHeaders,
|
|
111
|
-
validateStatus: () => true
|
|
112
|
-
});
|
|
113
|
-
const redirected = finalUrl(res, btnUrl);
|
|
114
|
-
add(redirected.includes('?link=') ? redirected.split('?link=')[1] || redirected : redirected, 'GDrive (download only)');
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
case isGofilePage(btnUrl):
|
|
118
|
-
gofilePages.push(btnUrl);
|
|
119
|
-
break;
|
|
120
|
-
case btnUrl.includes('cloudflarestorage'):
|
|
121
|
-
add(btnUrl, 'CF Storage');
|
|
122
|
-
break;
|
|
123
|
-
case isFastDl(btnUrl):
|
|
124
|
-
add(unwrapFastDlUrl(btnUrl), 'FastDl');
|
|
125
|
-
break;
|
|
126
|
-
case btnUrl.includes('hubcdn') && !btnUrl.includes('/?id='):
|
|
127
|
-
add(btnUrl, 'HubCdn');
|
|
128
|
-
break;
|
|
129
|
-
default:
|
|
130
|
-
if (['.m3u8', '.mp4', '.mkv', '?token='].some(part => btnUrl.includes(part))) add(btnUrl, 'CF Worker');
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
134
|
+
return buttonSource($(element).attr('href') || '');
|
|
133
135
|
} catch {
|
|
134
136
|
// Each button is a different host; one that fails leaves the others' sources.
|
|
137
|
+
return undefined;
|
|
135
138
|
}
|
|
139
|
+
});
|
|
140
|
+
for (const source of found) {
|
|
141
|
+
const value = await source;
|
|
142
|
+
if (value) add(value[0], value[1]);
|
|
136
143
|
}
|
|
137
144
|
for (const page of gofilePages) add(page, 'Gofile');
|
|
138
145
|
sources.sort((a, b) => HOSTS.indexOf(a.server) - HOSTS.indexOf(b.server));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["finalUrl","isFastDl","isGofilePage","qualityIn","unwrapFastDlUrl","toUrl","pixelDrainRedirect","pages","map","html","match","find","Boolean","parseSizeInBytes","text","undefined","val","parseFloat","unit","toUpperCase","Math","round","HOSTS","HubCloud","ctx","axios","load","CryptoJS","USER_AGENT","PolyURL","decodeBase64","value","base64","replace","length","test","enc","Base64","parse","toString","Latin1","extractUrlFromScript","doubleEncoded","plain","split","extract","videoUrl","referer","url","baseUrl","origin","pageHeaders","data","firstPage","get","href","headers","$first","pageQuality","fileSize","gofilePages","toArray","el","attr","filter","vcloudLink","parent","startsWith","vcloudPage","push","$","sources","add","link","server","some","source","quality","isM3U8","includes","size","
|
|
1
|
+
{"version":3,"names":["finalUrl","isFastDl","isGofilePage","qualityIn","unwrapFastDlUrl","toUrl","pixelDrainRedirect","pages","map","html","match","find","Boolean","parseSizeInBytes","text","undefined","val","parseFloat","unit","toUpperCase","Math","round","HOSTS","HubCloud","ctx","axios","load","CryptoJS","USER_AGENT","PolyURL","decodeBase64","value","base64","replace","length","test","enc","Base64","parse","toString","Latin1","extractUrlFromScript","doubleEncoded","plain","split","extract","videoUrl","referer","url","baseUrl","origin","pageHeaders","data","firstPage","get","href","headers","$first","pageQuality","fileSize","gofilePages","toArray","el","attr","filter","vcloudLink","parent","startsWith","vcloudPage","push","$","sources","add","link","server","some","source","quality","isM3U8","includes","size","buttonSource","btnUrl","token","pop","slice","join","validateStatus","then","res","redirected","catch","part","found","element","page","sort","a","b","indexOf"],"sourceRoot":"../../../src","sources":["extractors/hubcloud.ts"],"mappings":";;AAEA,SAASA,QAAQ,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,SAAS,EAAEC,eAAe,QAAQ,iBAAc;AAC3F,SAASC,KAAK,QAAQ,UAAO;;AAE7B;AACA,MAAMC,kBAAkB,GAAGA,CAAC,GAAGC,KAAe,KAC5CA,KAAK,CAACC,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACC,KAAK,CAAC,qCAAqC,CAAC,GAAG,CAAC,CAAC,CAAC,CAACC,IAAI,CAACC,OAAO,CAAC,IAAI,EAAE;AAEjG,SAASC,gBAAgBA,CAACC,IAAY,EAAsB;EAC1D,MAAMJ,KAAK,GAAGI,IAAI,CAACJ,KAAK,CAAC,0BAA0B,CAAC;EACpD,IAAI,CAACA,KAAK,EAAE,OAAOK,SAAS;EAC5B,MAAMC,GAAG,GAAGC,UAAU,CAACP,KAAK,CAAC,CAAC,CAAE,CAAC;EACjC,MAAMQ,IAAI,GAAGR,KAAK,CAAC,CAAC,CAAC,CAAES,WAAW,CAAC,CAAC;EACpC,IAAID,IAAI,KAAK,IAAI,EAAE,OAAOE,IAAI,CAACC,KAAK,CAACL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,OAAOb,YAAY,CAACX,CAAC,CAACwB,OAAO,CAAC,CAAC/B,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;MACpD,CAAC,CAAC,MAAM;QACN;QACA,OAAOhD,SAAS;MAClB;IACF,CAAC,CAAC;IACJ,KAAK,MAAM6D,MAAM,IAAIiB,KAAK,EAAE;MAC1B,MAAM9D,KAAK,GAAG,MAAM6C,MAAM;MAC1B,IAAI7C,KAAK,EAAEyC,GAAG,CAACzC,KAAK,CAAC,CAAC,CAAC,EAAEA,KAAK,CAAC,CAAC,CAAC,CAAC;IACpC;IAEA,KAAK,MAAMgE,IAAI,IAAInC,WAAW,EAAEY,GAAG,CAACuB,IAAI,EAAE,QAAQ,CAAC;IACnDxB,OAAO,CAACyB,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAK5E,KAAK,CAAC6E,OAAO,CAACF,CAAC,CAACvB,MAAc,CAAC,GAAGpD,KAAK,CAAC6E,OAAO,CAACD,CAAC,CAACxB,MAAc,CAAC,CAAC;IAEzF,OAAO;MAAEH,OAAO;MAAEf,OAAO,EAAE;QAAE,YAAY,EAAE5B,UAAU;QAAE,SAAS,EAAEqB;MAAQ;IAAE,CAAC;EAC/E,CAAC;EAED,OAAO;IAAEJ;EAAQ,CAAC;AACpB","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -11,11 +11,11 @@ export { default as ExtensionRegistry } from './extension-registry.json';
|
|
|
11
11
|
export { ANIME, LIGHT_NOVELS, MANGA, MOVIES, META } from "./providers/index.js";
|
|
12
12
|
export * from "./extractors/index.js";
|
|
13
13
|
export { PolyURL, PolyURLSearchParams };
|
|
14
|
-
export { Topics, Genres, SubOrDub, StreamingServers, MediaStatus, TvType, MediaFormat, WatchListType, AnimeParser, MovieParser, MetaError } from "./models/index.js";
|
|
14
|
+
export { Topics, Genres, SubOrDub, StreamingServers, MediaStatus, TvType, MediaFormat, WatchListType, AnimeParser, MovieParser, MetaError, ProviderError } from "./models/index.js";
|
|
15
15
|
export { createExtractorContext, defaultAxios, defaultExtractorContext, defaultExtractors } from "./utils/create-extractor-context.js";
|
|
16
16
|
export { createProviderContext } from "./utils/create-provider-context.js";
|
|
17
17
|
export { ProviderManager, REQUIRED_PROVIDER_METHODS } from "./utils/ProviderManager.js";
|
|
18
|
-
export { ExtractorManager } from "./utils/ExtractorManager.js";
|
|
18
|
+
export { ExtractorManager, serverDisplayName } from "./utils/ExtractorManager.js";
|
|
19
19
|
export { RegistryFetchError } from "./utils/extension-modules.js";
|
|
20
20
|
export { verifyExtensionCode, IntegrityError } from "./utils/extension-integrity.js";
|
|
21
21
|
export { CONTEXT_VERSION, REGISTRY_SCHEMA_VERSION, RegistryError, validateRegistry, isCompatibleEntry, assertCompatibleEntry } from "./utils/registry-schema.js";
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PolyURL","PolyURLSearchParams","scope","globalThis","URL","URLSearchParams","default","ExtensionRegistry","ANIME","LIGHT_NOVELS","MANGA","MOVIES","META","Topics","Genres","SubOrDub","StreamingServers","MediaStatus","TvType","MediaFormat","WatchListType","AnimeParser","MovieParser","MetaError","createExtractorContext","defaultAxios","defaultExtractorContext","defaultExtractors","createProviderContext","ProviderManager","REQUIRED_PROVIDER_METHODS","ExtractorManager","RegistryFetchError","verifyExtensionCode","IntegrityError","CONTEXT_VERSION","REGISTRY_SCHEMA_VERSION","RegistryError","validateRegistry","isCompatibleEntry","assertCompatibleEntry","REGISTRY_SIGNING_KEYS","RegistrySignatureError","verifyRegistrySignature","parseSignedRegistry","parseChapterNumber","parseVolumeNumber","sortChaptersForReading"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAO,gCAAgC;AACvC,SAASA,OAAO,EAAEC,mBAAmB,QAAQ,yBAAsB;;AAEnE;AACA,MAAMC,KAAK,GAAGC,UAAiB;AAC/B,IAAID,KAAK,IAAI,CAACA,KAAK,CAACE,GAAG,EAAEF,KAAK,CAACE,GAAG,GAAGJ,OAAO;AAC5C,IAAIE,KAAK,IAAI,CAACA,KAAK,CAACG,eAAe,EAAEH,KAAK,CAACG,eAAe,GAAGJ,mBAAmB;AAEhF,SAASK,OAAO,IAAIC,iBAAiB,QAAQ,2BAA2B;AACxE,SAASC,KAAK,EAAEC,YAAY,EAAEC,KAAK,EAAEC,MAAM,EAAEC,IAAI,QAAQ,sBAAa;AACtE,cAAc,uBAAc;AAC5B,SAASZ,OAAO,EAAEC,mBAAmB;AAErC,SACEY,MAAM,EACNC,MAAM,EACNC,QAAQ,EACRC,gBAAgB,EAChBC,WAAW,EACXC,MAAM,EACNC,WAAW,EACXC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,SAAS,
|
|
1
|
+
{"version":3,"names":["PolyURL","PolyURLSearchParams","scope","globalThis","URL","URLSearchParams","default","ExtensionRegistry","ANIME","LIGHT_NOVELS","MANGA","MOVIES","META","Topics","Genres","SubOrDub","StreamingServers","MediaStatus","TvType","MediaFormat","WatchListType","AnimeParser","MovieParser","MetaError","ProviderError","createExtractorContext","defaultAxios","defaultExtractorContext","defaultExtractors","createProviderContext","ProviderManager","REQUIRED_PROVIDER_METHODS","ExtractorManager","serverDisplayName","RegistryFetchError","verifyExtensionCode","IntegrityError","CONTEXT_VERSION","REGISTRY_SCHEMA_VERSION","RegistryError","validateRegistry","isCompatibleEntry","assertCompatibleEntry","REGISTRY_SIGNING_KEYS","RegistrySignatureError","verifyRegistrySignature","parseSignedRegistry","parseChapterNumber","parseVolumeNumber","sortChaptersForReading"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAO,gCAAgC;AACvC,SAASA,OAAO,EAAEC,mBAAmB,QAAQ,yBAAsB;;AAEnE;AACA,MAAMC,KAAK,GAAGC,UAAiB;AAC/B,IAAID,KAAK,IAAI,CAACA,KAAK,CAACE,GAAG,EAAEF,KAAK,CAACE,GAAG,GAAGJ,OAAO;AAC5C,IAAIE,KAAK,IAAI,CAACA,KAAK,CAACG,eAAe,EAAEH,KAAK,CAACG,eAAe,GAAGJ,mBAAmB;AAEhF,SAASK,OAAO,IAAIC,iBAAiB,QAAQ,2BAA2B;AACxE,SAASC,KAAK,EAAEC,YAAY,EAAEC,KAAK,EAAEC,MAAM,EAAEC,IAAI,QAAQ,sBAAa;AACtE,cAAc,uBAAc;AAC5B,SAASZ,OAAO,EAAEC,mBAAmB;AAErC,SACEY,MAAM,EACNC,MAAM,EACNC,QAAQ,EACRC,gBAAgB,EAChBC,WAAW,EACXC,MAAM,EACNC,WAAW,EACXC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,SAAS,EACTC,aAAa,QACR,mBAAU;AA+CjB,SACEC,sBAAsB,EACtBC,YAAY,EACZC,uBAAuB,EACvBC,iBAAiB,QAEZ,qCAAkC;AACzC,SAASC,qBAAqB,QAAoC,oCAAiC;AACnG,SACEC,eAAe,EACfC,yBAAyB,QAQpB,4BAAyB;AAChC,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,6BAA0B;AAE9E,SAASC,kBAAkB,QAAQ,8BAA2B;AAC9D,SACEC,mBAAmB,EACnBC,cAAc,QAIT,gCAA6B;AACpC,SACEC,eAAe,EACfC,uBAAuB,EACvBC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,qBAAqB,QAEhB,4BAAyB;AAChC,SACEC,qBAAqB,EACrBC,sBAAsB,EACtBC,uBAAuB,EACvBC,mBAAmB,QAGd,+BAA4B;AACnC,SAASC,kBAAkB,EAAEC,iBAAiB,EAAEC,sBAAsB,QAAQ,kBAAe","ignoreList":[]}
|
|
@@ -7,5 +7,6 @@ export { default as MovieParser } from "./movie-parser.js";
|
|
|
7
7
|
export { default as MangaParser } from "./manga-parser.js";
|
|
8
8
|
export { default as LightNovelParser } from "./lightnovel-parser.js";
|
|
9
9
|
export { MetaError } from "./meta-error.js";
|
|
10
|
+
export { ProviderError } from "./provider-error.js";
|
|
10
11
|
export * from "./types.js";
|
|
11
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["default","BaseProvider","BaseParser","AnimeParser","MovieParser","MangaParser","LightNovelParser","MetaError"],"sourceRoot":"../../../src","sources":["models/index.ts"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,YAAY,QAAQ,oBAAiB;AACzD,SAASD,OAAO,IAAIE,UAAU,QAAQ,kBAAe;AACrD,SAASF,OAAO,IAAIG,WAAW,QAAQ,mBAAgB;AACvD,SAASH,OAAO,IAAII,WAAW,QAAQ,mBAAgB;AACvD,SAASJ,OAAO,IAAIK,WAAW,QAAQ,mBAAgB;AACvD,SAASL,OAAO,IAAIM,gBAAgB,QAAQ,wBAAqB;AACjE,SAASC,SAAS,QAA8B,iBAAc;
|
|
1
|
+
{"version":3,"names":["default","BaseProvider","BaseParser","AnimeParser","MovieParser","MangaParser","LightNovelParser","MetaError","ProviderError"],"sourceRoot":"../../../src","sources":["models/index.ts"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,YAAY,QAAQ,oBAAiB;AACzD,SAASD,OAAO,IAAIE,UAAU,QAAQ,kBAAe;AACrD,SAASF,OAAO,IAAIG,WAAW,QAAQ,mBAAgB;AACvD,SAASH,OAAO,IAAII,WAAW,QAAQ,mBAAgB;AACvD,SAASJ,OAAO,IAAIK,WAAW,QAAQ,mBAAgB;AACvD,SAASL,OAAO,IAAIM,gBAAgB,QAAQ,wBAAqB;AACjE,SAASC,SAAS,QAA8B,iBAAc;AAC9D,SAASC,aAAa,QAAgC,qBAAkB;AAKxE,cAAc,YAAS","ignoreList":[]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { errorStatus } from "../providers/common/errors.js";
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* Where a meta provider failure came from: a metadata service, the wrapped provider, or GitHub,
|
|
5
7
|
* which hosts the id list `Anilist.fetchRandomAnime` picks from.
|
|
@@ -20,13 +22,15 @@ export class MetaError extends Error {
|
|
|
20
22
|
Object.setPrototypeOf(this, MetaError.prototype);
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Wraps any thrown value, reading the HTTP status from axios errors (or a ProviderError's
|
|
27
|
+
* `status`). A MetaError passes through.
|
|
28
|
+
*/
|
|
24
29
|
static from(source, error, message) {
|
|
25
30
|
if (error instanceof MetaError) return error;
|
|
26
|
-
const status = error?.response?.status;
|
|
27
31
|
return new MetaError(message ?? (error instanceof Error ? error.message : String(error)), {
|
|
28
32
|
source,
|
|
29
|
-
status:
|
|
33
|
+
status: errorStatus(error),
|
|
30
34
|
cause: error
|
|
31
35
|
});
|
|
32
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MetaError","Error","constructor","message","options","name","source","status","cause","Object","setPrototypeOf","prototype","from","error","
|
|
1
|
+
{"version":3,"names":["errorStatus","MetaError","Error","constructor","message","options","name","source","status","cause","Object","setPrototypeOf","prototype","from","error","String"],"sourceRoot":"../../../src","sources":["models/meta-error.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,+BAA4B;;AAExD;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,SAASC,KAAK,CAAC;EAKnCC,WAAWA,CAACC,OAAe,EAAEC,OAAsE,EAAE;IACnG,KAAK,CAACD,OAAO,CAAC;IACd,IAAI,CAACE,IAAI,GAAG,WAAW;IACvB,IAAI,CAACC,MAAM,GAAGF,OAAO,CAACE,MAAM;IAC5B,IAAI,CAACC,MAAM,GAAGH,OAAO,CAACG,MAAM;IAC5B,IAAI,CAACC,KAAK,GAAGJ,OAAO,CAACI,KAAK;IAC1BC,MAAM,CAACC,cAAc,CAAC,IAAI,EAAEV,SAAS,CAACW,SAAS,CAAC;EAClD;;EAEA;AACF;AACA;AACA;EACE,OAAOC,IAAIA,CAACN,MAAuB,EAAEO,KAAc,EAAEV,OAAgB,EAAa;IAChF,IAAIU,KAAK,YAAYb,SAAS,EAAE,OAAOa,KAAK;IAC5C,OAAO,IAAIb,SAAS,CAACG,OAAO,KAAKU,KAAK,YAAYZ,KAAK,GAAGY,KAAK,CAACV,OAAO,GAAGW,MAAM,CAACD,KAAK,CAAC,CAAC,EAAE;MACxFP,MAAM;MACNC,MAAM,EAAER,WAAW,CAACc,KAAK,CAAC;MAC1BL,KAAK,EAAEK;IACT,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { errorKind, errorStatus, isProviderError } from "../providers/common/errors.js";
|
|
4
|
+
/**
|
|
5
|
+
* Error for a failing provider or extractor, with the `kind` of failure (`network`, `blocked`,
|
|
6
|
+
* `not-found` or `parse`), the provider's name, the HTTP status when there was one, and the
|
|
7
|
+
* original error as `cause`. Registry bundles throw plain Errors tagged with the same fields
|
|
8
|
+
* (`name: 'ProviderError'`), so test with ProviderError.is, not instanceof.
|
|
9
|
+
*/
|
|
10
|
+
export class ProviderError extends Error {
|
|
11
|
+
constructor(message, options) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.name = 'ProviderError';
|
|
14
|
+
this.kind = options.kind;
|
|
15
|
+
this.provider = options.provider;
|
|
16
|
+
this.status = options.status;
|
|
17
|
+
this.cause = options.cause;
|
|
18
|
+
Object.setPrototypeOf(this, ProviderError.prototype);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Whether `error` is a ProviderError, including the tagged plain Errors registry bundles throw. */
|
|
22
|
+
static is(error) {
|
|
23
|
+
return isProviderError(error);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* `error` as a ProviderError. A ProviderError (or a tagged one) keeps its kind, provider and
|
|
28
|
+
* cause; anything else (an axios error, a MetaError, a parser's Error) gets the kind its status,
|
|
29
|
+
* network code or cause shows. `provider` fills in a missing provider name.
|
|
30
|
+
*/
|
|
31
|
+
static from(error, options = {}) {
|
|
32
|
+
if (error instanceof ProviderError && (error.provider || !options.provider) && !options.message) return error;
|
|
33
|
+
const inner = providerErrorIn(error);
|
|
34
|
+
return new ProviderError(options.message ?? (error instanceof Error ? error.message : String(error)), {
|
|
35
|
+
kind: errorKind(error),
|
|
36
|
+
provider: inner?.provider ?? options.provider,
|
|
37
|
+
status: errorStatus(error) ?? inner?.status,
|
|
38
|
+
cause: inner && error === inner ? inner.cause : error
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** `error` itself when it is a ProviderError, else the first one in its chain of causes. */
|
|
44
|
+
function providerErrorIn(error, depth = 0) {
|
|
45
|
+
if (isProviderError(error)) return error;
|
|
46
|
+
const cause = error?.cause;
|
|
47
|
+
return cause !== undefined && depth < 4 ? providerErrorIn(cause, depth + 1) : undefined;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=provider-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["errorKind","errorStatus","isProviderError","ProviderError","Error","constructor","message","options","name","kind","provider","status","cause","Object","setPrototypeOf","prototype","is","error","from","inner","providerErrorIn","String","depth","undefined"],"sourceRoot":"../../../src","sources":["models/provider-error.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,WAAW,EAAEC,eAAe,QAAgC,+BAA4B;AAI5G;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,SAASC,KAAK,CAAC;EAMvCC,WAAWA,CACTC,OAAe,EACfC,OAAyF,EACzF;IACA,KAAK,CAACD,OAAO,CAAC;IACd,IAAI,CAACE,IAAI,GAAG,eAAe;IAC3B,IAAI,CAACC,IAAI,GAAGF,OAAO,CAACE,IAAI;IACxB,IAAI,CAACC,QAAQ,GAAGH,OAAO,CAACG,QAAQ;IAChC,IAAI,CAACC,MAAM,GAAGJ,OAAO,CAACI,MAAM;IAC5B,IAAI,CAACC,KAAK,GAAGL,O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":[]}
|
|
@@ -31,8 +31,9 @@ export let MediaFormat = /*#__PURE__*/function (MediaFormat) {
|
|
|
31
31
|
}({});
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* An episode returned by a meta provider (e.g. `META.Anilist.fetchEpisodesListById`). `number`
|
|
35
|
-
*
|
|
34
|
+
* An episode returned by a meta provider (e.g. `META.Anilist.fetchEpisodesListById`). `number`
|
|
35
|
+
* counts from 1 in the season, also when the provider keeps counting from the previous one and
|
|
36
|
+
* ani.zip shows by how much.
|
|
36
37
|
*/
|
|
37
38
|
|
|
38
39
|
/** One entry of `episodes` in an ani.zip `/mappings` response. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MediaFormat","StreamingServers","MediaStatus","WatchListType","SubOrDub","TvType","Genres","Topics","extensionEnums"],"sourceRoot":"../../../src","sources":["models/types.ts"],"mappings":";;AAUA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;;AAUA;;
|
|
1
|
+
{"version":3,"names":["MediaFormat","StreamingServers","MediaStatus","WatchListType","SubOrDub","TvType","Genres","Topics","extensionEnums"],"sourceRoot":"../../../src","sources":["models/types.ts"],"mappings":";;AAUA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;;AAUA;;AAgEA,WAAYA,WAAW,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;;AAkEvB;AACA;AACA;AACA;AACA;;AAkBA;;AAmEA;AACA,WAAYC,gBAAgB,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,g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
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { mapLimit } from "../../common/concurrency.js";
|
|
3
4
|
import { toMediaStatus } from "../../common/media-status.js";
|
|
4
5
|
import { pickServer, serverName } from "../../common/servers.js";
|
|
5
|
-
import {
|
|
6
|
+
import { PAGE_TTL_MS, ttlCache } from "../../common/ttl-cache.js";
|
|
7
|
+
import { IST_TZ_OFFSET, cardPage, linkedGenres, pageUrl, siteEpisodeId, toEpisodeId } from "./hianime.js";
|
|
8
|
+
|
|
9
|
+
// Kept at the top level, so they outlive one provider instance (apps build one per query), by
|
|
10
|
+
// request URL: an episode's server list (`/ajax/server/list`) when it lists servers, and the embed
|
|
11
|
+
// URL of a server's link (`/ajax/server?get=`) when it gives one. Servers, then sources, ask once.
|
|
12
|
+
const serverLists = ttlCache({
|
|
13
|
+
ttlMs: PAGE_TTL_MS,
|
|
14
|
+
maxEntries: 16,
|
|
15
|
+
keep: html => typeof html === 'string' && html.includes('data-link-id')
|
|
16
|
+
});
|
|
17
|
+
const embedUrls = ttlCache({
|
|
18
|
+
ttlMs: PAGE_TTL_MS,
|
|
19
|
+
maxEntries: 32,
|
|
20
|
+
keep: url => !!url
|
|
21
|
+
});
|
|
6
22
|
export function createAniKoto(ctx, customBaseURL) {
|
|
7
23
|
const {
|
|
8
24
|
axios,
|
|
@@ -20,12 +36,12 @@ export function createAniKoto(ctx, customBaseURL) {
|
|
|
20
36
|
const {
|
|
21
37
|
SubOrDub: SubOrDubEnum
|
|
22
38
|
} = enums;
|
|
23
|
-
const baseUrl = createCustomBaseUrl('https://anikototv.
|
|
39
|
+
const baseUrl = createCustomBaseUrl('https://anikototv.bz', customBaseURL);
|
|
24
40
|
const config = {
|
|
25
41
|
name: 'AniKoto',
|
|
26
42
|
languages: 'en',
|
|
27
43
|
classPath: 'ANIME.AniKoto',
|
|
28
|
-
logo: 'https://anikototv.
|
|
44
|
+
logo: 'https://anikototv.bz/favicon-32x32.png',
|
|
29
45
|
baseUrl,
|
|
30
46
|
isNSFW: false,
|
|
31
47
|
isWorking: true,
|
|
@@ -80,7 +96,7 @@ export function createAniKoto(ctx, customBaseURL) {
|
|
|
80
96
|
|
|
81
97
|
/**
|
|
82
98
|
* Search with filters; each is optional. The site has no date filters: `_startDate` and
|
|
83
|
-
* `_endDate` are
|
|
99
|
+
* `_endDate` are accepted and ignored.
|
|
84
100
|
*/
|
|
85
101
|
const fetchAdvancedSearch = async (page = 1, type, status, rated, score, season, language, _startDate, _endDate, sort, genres) => {
|
|
86
102
|
const params = new PolyURLSearchParams();
|
|
@@ -277,38 +293,69 @@ export function createAniKoto(ctx, customBaseURL) {
|
|
|
277
293
|
};
|
|
278
294
|
};
|
|
279
295
|
|
|
280
|
-
/**
|
|
281
|
-
|
|
296
|
+
/**
|
|
297
|
+
* The servers the episode's list has in `subOrDub`, in list order: each one's link id, name and
|
|
298
|
+
* label, and whether it is the dub (unknown when the list has no language groups).
|
|
299
|
+
*/
|
|
300
|
+
const listServers = async (episodeId, subOrDub) => {
|
|
282
301
|
const dataIds = siteEpisodeId(episodeId) ?? episodeId;
|
|
283
302
|
const targetSubDub = subOrDub === SubOrDubEnum.DUB ? 'dub' : 'sub';
|
|
284
|
-
const
|
|
285
|
-
|
|
303
|
+
const url = `${config.baseUrl}/ajax/server/list?servers=${encodeURIComponent(dataIds)}`;
|
|
304
|
+
const html = await serverLists.get(url, async () => {
|
|
305
|
+
const res = await axios.get(url, {
|
|
306
|
+
headers: ajaxHeaders()
|
|
307
|
+
});
|
|
308
|
+
return res.data?.result || res.data;
|
|
286
309
|
});
|
|
287
|
-
const $ = load(
|
|
310
|
+
const $ = load(html);
|
|
288
311
|
|
|
289
312
|
// The list is grouped by language; a page without groups lists every server in one.
|
|
290
313
|
const groups = $('.servers .type[data-type]');
|
|
291
314
|
const serverList = groups.length ? groups.filter(`[data-type="${targetSubDub}"]`).find('li[data-link-id]') : $('.servers li[data-link-id]');
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
const
|
|
295
|
-
|
|
315
|
+
const isDub = groups.length ? targetSubDub === 'dub' : undefined;
|
|
316
|
+
return serverList.toArray().map(el => {
|
|
317
|
+
const label = $(el).text().replace(/\s+/g, ' ').trim();
|
|
318
|
+
return {
|
|
319
|
+
linkId: $(el).attr('data-link-id'),
|
|
320
|
+
name: serverName('megaplay', label),
|
|
321
|
+
label,
|
|
322
|
+
isDub
|
|
323
|
+
};
|
|
324
|
+
});
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
/** The embed URL of a server's link; falsy when the site gives none. */
|
|
328
|
+
const embedUrlOf = linkId => {
|
|
329
|
+
const url = `${config.baseUrl}/ajax/server?get=${encodeURIComponent(linkId)}`;
|
|
330
|
+
return embedUrls.get(url, async () => (await axios.get(url, {
|
|
331
|
+
headers: ajaxHeaders()
|
|
332
|
+
})).data?.result?.url);
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
/** @param episodeId an episode id from fetchAnimeInfo, or the site's own episode id */
|
|
336
|
+
const fetchEpisodeServers = async (episodeId, subOrDub = SubOrDubEnum.SUB) => {
|
|
337
|
+
const servers = await listServers(episodeId, subOrDub);
|
|
338
|
+
const resolved = await mapLimit(servers, 4, async ({
|
|
339
|
+
linkId,
|
|
340
|
+
name,
|
|
341
|
+
label,
|
|
342
|
+
isDub
|
|
343
|
+
}) => {
|
|
344
|
+
if (!linkId) return undefined;
|
|
296
345
|
try {
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
name: serverName('megaplay', $(el).text()),
|
|
305
|
-
url: embedUrl
|
|
306
|
-
});
|
|
346
|
+
const embedUrl = await embedUrlOf(linkId);
|
|
347
|
+
return embedUrl ? {
|
|
348
|
+
name,
|
|
349
|
+
url: embedUrl,
|
|
350
|
+
label,
|
|
351
|
+
isDub
|
|
352
|
+
} : undefined;
|
|
307
353
|
} catch {
|
|
308
354
|
// A server whose link doesn't resolve is left out; the others still play.
|
|
355
|
+
return undefined;
|
|
309
356
|
}
|
|
310
|
-
}
|
|
311
|
-
return
|
|
357
|
+
});
|
|
358
|
+
return resolved.filter(server => !!server);
|
|
312
359
|
};
|
|
313
360
|
const extractFrom = embedUrl => MegaPlay(ctx).extract(new PolyURL(embedUrl), config.baseUrl);
|
|
314
361
|
|
|
@@ -319,6 +366,25 @@ export function createAniKoto(ctx, customBaseURL) {
|
|
|
319
366
|
*/
|
|
320
367
|
const fetchEpisodeSources = async (episodeId, server, subOrDub = SubOrDubEnum.SUB) => {
|
|
321
368
|
if (episodeId.startsWith('http')) return extractFrom(episodeId);
|
|
369
|
+
|
|
370
|
+
// The server pickServer would pick from fetchEpisodeServers: the first, in list order, whose
|
|
371
|
+
// name `server` starts (every server without one) and whose link gives an embed URL. Only the
|
|
372
|
+
// links up to it are resolved.
|
|
373
|
+
const wanted = server?.toLowerCase();
|
|
374
|
+
for (const {
|
|
375
|
+
linkId,
|
|
376
|
+
name
|
|
377
|
+
} of await listServers(episodeId, subOrDub)) {
|
|
378
|
+
if (!linkId || wanted && !name.toLowerCase().startsWith(wanted)) continue;
|
|
379
|
+
let embedUrl;
|
|
380
|
+
try {
|
|
381
|
+
embedUrl = await embedUrlOf(linkId);
|
|
382
|
+
} catch {
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
if (embedUrl) return extractFrom(embedUrl);
|
|
386
|
+
}
|
|
387
|
+
// None does: pickServer throws its error, naming the servers there are.
|
|
322
388
|
return extractFrom(pickServer(await fetchEpisodeServers(episodeId, subOrDub), server).url);
|
|
323
389
|
};
|
|
324
390
|
return {
|