react-native-consumet 1.0.0-rc.0 → 1.0.0-rc.2
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/generated/java/com/consumet/NativeConsumetSpec.java +4 -0
- package/android/generated/jni/RNConsumetSpec-generated.cpp +6 -0
- package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI-generated.cpp +8 -0
- package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI.h +9 -0
- package/android/src/main/java/com/consumet/ConsumetModule.kt +7 -0
- package/android/src/main/java/com/consumet/DdosGuardModule.kt +248 -189
- package/ios/generated/RNConsumetSpec/RNConsumetSpec-generated.mm +7 -0
- package/ios/generated/RNConsumetSpec/RNConsumetSpec.h +2 -0
- package/ios/generated/RNConsumetSpecJSI-generated.cpp +8 -0
- package/ios/generated/RNConsumetSpecJSI.h +9 -0
- package/lib/commonjs/NativeConsumet.ts +28 -26
- package/lib/commonjs/extension-registry.json +13 -13
- package/lib/commonjs/extractors/filemoon.js +2 -2
- package/lib/commonjs/extractors/kwik.js +60 -15
- package/lib/commonjs/extractors/kwik.js.map +1 -1
- package/lib/commonjs/extractors/megacloud.js +6 -6
- package/lib/commonjs/index.js +2 -11
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/types.js +4 -4
- package/lib/commonjs/models/video-extractor.js +4 -4
- package/lib/commonjs/providers/anime/animedrive.js +12 -12
- package/lib/commonjs/providers/anime/animekai.js +41 -41
- package/lib/commonjs/providers/anime/animepahe/animepahe.js +16 -15
- package/lib/commonjs/providers/anime/animepahe/animepahe.js.map +1 -1
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js +12 -9
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/commonjs/providers/anime/animesuge/animesuge.js +78 -0
- package/lib/commonjs/providers/anime/animesuge/animesuge.js.map +1 -0
- package/lib/commonjs/providers/anime/animesuge/create-animesuge.js +312 -0
- package/lib/commonjs/providers/anime/animesuge/create-animesuge.js.map +1 -0
- package/lib/commonjs/providers/anime/animeunity.js +13 -13
- package/lib/commonjs/providers/anime/index.js +4 -4
- package/lib/commonjs/providers/anime/index.js.map +1 -1
- package/lib/commonjs/providers/anime/marin.js +12 -12
- package/lib/commonjs/providers/anime/zoro/create-zoro.js +2 -2
- package/lib/commonjs/providers/anime/zoro/create-zoro.js.map +1 -1
- package/lib/commonjs/providers/anime/zoro/zoro.js +76 -74
- package/lib/commonjs/providers/anime/zoro/zoro.js.map +1 -1
- package/lib/commonjs/providers/manga/brmangas.js +3 -3
- package/lib/commonjs/providers/meta/anilist.js +91 -91
- package/lib/commonjs/providers/meta/mal.js +12 -12
- package/lib/commonjs/providers/meta/tmdb.js +21 -21
- package/lib/commonjs/providers/movies/himovies/create-himovies.js +16 -16
- package/lib/commonjs/providers/movies/himovies/himovies.js +16 -16
- package/lib/commonjs/providers/movies/multimovies.js +15 -15
- package/lib/commonjs/providers/movies/multistream/index.js +21 -20
- package/lib/commonjs/providers/movies/multistream/index.js.map +1 -1
- package/lib/commonjs/providers/movies/multistream/utils.js +142 -130
- package/lib/commonjs/providers/movies/multistream/utils.js.map +1 -1
- package/lib/commonjs/utils/ExtractorManager.js +15 -15
- package/lib/commonjs/utils/ExtractorManager.js.map +1 -1
- package/lib/commonjs/utils/ProviderManager.js +2 -1
- package/lib/commonjs/utils/ProviderManager.js.map +1 -1
- package/lib/commonjs/utils/create-extractor-context.js +9 -1
- package/lib/commonjs/utils/create-extractor-context.js.map +1 -1
- package/lib/commonjs/utils/create-provider-context.js +6 -2
- package/lib/commonjs/utils/create-provider-context.js.map +1 -1
- package/lib/commonjs/utils/extension-utils.js +44 -54
- package/lib/commonjs/utils/extension-utils.js.map +1 -1
- package/lib/commonjs/utils/index.js +2 -2
- package/lib/commonjs/utils/provider-maps.js +31 -0
- package/lib/commonjs/utils/provider-maps.js.map +1 -0
- package/lib/commonjs/utils/providers-list.js +4 -4
- package/lib/commonjs/utils/url-polyfill.js +4 -4
- package/lib/module/NativeConsumet.ts +28 -26
- package/lib/module/extension-registry.json +13 -13
- package/lib/module/extractors/filemoon.js +2 -2
- package/lib/module/extractors/kwik.js +60 -15
- package/lib/module/extractors/kwik.js.map +1 -1
- package/lib/module/extractors/megacloud.js +6 -6
- package/lib/module/index.js +3 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/types.js +4 -4
- package/lib/module/models/video-extractor.js +4 -4
- package/lib/module/providers/anime/animedrive.js +12 -12
- package/lib/module/providers/anime/animekai.js +41 -41
- package/lib/module/providers/anime/animepahe/animepahe.js +14 -14
- package/lib/module/providers/anime/animepahe/animepahe.js.map +1 -1
- package/lib/module/providers/anime/animepahe/create-animepahe.js +13 -9
- package/lib/module/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/module/providers/anime/animesuge/animesuge.js +73 -0
- package/lib/module/providers/anime/animesuge/animesuge.js.map +1 -0
- package/lib/module/providers/anime/animesuge/create-animesuge.js +309 -0
- package/lib/module/providers/anime/animesuge/create-animesuge.js.map +1 -0
- package/lib/module/providers/anime/animeunity.js +13 -13
- package/lib/module/providers/anime/index.js +2 -2
- package/lib/module/providers/anime/index.js.map +1 -1
- package/lib/module/providers/anime/marin.js +12 -12
- package/lib/module/providers/anime/zoro/create-zoro.js +3 -2
- package/lib/module/providers/anime/zoro/create-zoro.js.map +1 -1
- package/lib/module/providers/anime/zoro/zoro.js +74 -73
- package/lib/module/providers/anime/zoro/zoro.js.map +1 -1
- package/lib/module/providers/manga/brmangas.js +3 -3
- package/lib/module/providers/meta/anilist.js +91 -91
- package/lib/module/providers/meta/mal.js +12 -12
- package/lib/module/providers/meta/tmdb.js +21 -21
- package/lib/module/providers/movies/himovies/create-himovies.js +16 -16
- package/lib/module/providers/movies/himovies/himovies.js +16 -16
- package/lib/module/providers/movies/multimovies.js +15 -15
- package/lib/module/providers/movies/multistream/index.js +21 -20
- package/lib/module/providers/movies/multistream/index.js.map +1 -1
- package/lib/module/providers/movies/multistream/utils.js +141 -129
- package/lib/module/providers/movies/multistream/utils.js.map +1 -1
- package/lib/module/utils/ExtractorManager.js +16 -16
- package/lib/module/utils/ExtractorManager.js.map +1 -1
- package/lib/module/utils/ProviderManager.js +2 -1
- package/lib/module/utils/ProviderManager.js.map +1 -1
- package/lib/module/utils/create-extractor-context.js +10 -1
- package/lib/module/utils/create-extractor-context.js.map +1 -1
- package/lib/module/utils/create-provider-context.js +8 -4
- package/lib/module/utils/create-provider-context.js.map +1 -1
- package/lib/module/utils/extension-utils.js +23 -33
- package/lib/module/utils/extension-utils.js.map +1 -1
- package/lib/module/utils/index.js +1 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/provider-maps.js +27 -0
- package/lib/module/utils/provider-maps.js.map +1 -0
- package/lib/module/utils/providers-list.js +4 -4
- package/lib/module/utils/url-polyfill.js +4 -4
- package/lib/typescript/commonjs/src/NativeConsumet.d.ts +2 -0
- package/lib/typescript/commonjs/src/NativeConsumet.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/kwik.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +6 -6
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/extractor-context.d.ts +8 -0
- package/lib/typescript/commonjs/src/models/extractor-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/index.d.ts +2 -2
- package/lib/typescript/commonjs/src/models/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/provider-context.d.ts +6 -2
- package/lib/typescript/commonjs/src/models/provider-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/animepahe/animepahe.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts +1 -1
- package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/animesuge/animesuge.d.ts +34 -0
- package/lib/typescript/commonjs/src/providers/anime/animesuge/animesuge.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/anime/animesuge/create-animesuge.d.ts +14 -0
- package/lib/typescript/commonjs/src/providers/anime/animesuge/create-animesuge.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/anime/index.d.ts +2 -2
- package/lib/typescript/commonjs/src/providers/anime/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/zoro/create-zoro.d.ts +1 -1
- package/lib/typescript/commonjs/src/providers/anime/zoro/create-zoro.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/zoro/zoro.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/multistream/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/providers/movies/multistream/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/multistream/utils.d.ts +2 -2
- package/lib/typescript/commonjs/src/providers/movies/multistream/utils.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/create-extractor-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/create-provider-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/extension-utils.d.ts +1 -20
- package/lib/typescript/commonjs/src/utils/extension-utils.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/index.d.ts +2 -1
- package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/provider-maps.d.ts +27 -0
- package/lib/typescript/commonjs/src/utils/provider-maps.d.ts.map +1 -0
- package/lib/typescript/module/src/NativeConsumet.d.ts +2 -0
- package/lib/typescript/module/src/NativeConsumet.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/kwik.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +6 -6
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/models/extractor-context.d.ts +8 -0
- package/lib/typescript/module/src/models/extractor-context.d.ts.map +1 -1
- package/lib/typescript/module/src/models/index.d.ts +2 -2
- package/lib/typescript/module/src/models/index.d.ts.map +1 -1
- package/lib/typescript/module/src/models/provider-context.d.ts +6 -2
- package/lib/typescript/module/src/models/provider-context.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/animepahe/animepahe.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts +1 -1
- package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/animesuge/animesuge.d.ts +34 -0
- package/lib/typescript/module/src/providers/anime/animesuge/animesuge.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/anime/animesuge/create-animesuge.d.ts +14 -0
- package/lib/typescript/module/src/providers/anime/animesuge/create-animesuge.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/anime/index.d.ts +2 -2
- package/lib/typescript/module/src/providers/anime/index.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/zoro/create-zoro.d.ts +1 -1
- package/lib/typescript/module/src/providers/anime/zoro/create-zoro.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/zoro/zoro.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/multistream/index.d.ts +1 -1
- package/lib/typescript/module/src/providers/movies/multistream/index.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/multistream/utils.d.ts +2 -2
- package/lib/typescript/module/src/providers/movies/multistream/utils.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/ProviderManager.d.ts +1 -1
- package/lib/typescript/module/src/utils/ProviderManager.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/create-extractor-context.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/create-provider-context.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/extension-utils.d.ts +1 -20
- package/lib/typescript/module/src/utils/extension-utils.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/index.d.ts +2 -1
- package/lib/typescript/module/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/provider-maps.d.ts +27 -0
- package/lib/typescript/module/src/utils/provider-maps.d.ts.map +1 -0
- package/package.json +6 -2
- package/src/NativeConsumet.ts +2 -0
- package/src/extension-registry.json +81 -81
- package/src/extractors/StreamP2P.ts +60 -60
- package/src/extractors/filemoon.ts +58 -58
- package/src/extractors/index.ts +41 -41
- package/src/extractors/kwik.ts +113 -50
- package/src/extractors/megacloud.ts +163 -163
- package/src/extractors/mixdrop.ts +31 -31
- package/src/extractors/mp4upload.ts +31 -31
- package/src/extractors/streamhub.ts +58 -58
- package/src/extractors/streamwish.ts +120 -120
- package/src/extractors/vidhide.ts +59 -59
- package/src/index.tsx +176 -175
- package/src/models/extension-manifest.ts +77 -77
- package/src/models/extractor-context.ts +55 -41
- package/src/models/index.ts +107 -106
- package/src/models/provider-context.ts +192 -182
- package/src/models/types.ts +531 -531
- package/src/models/video-extractor.ts +48 -48
- package/src/providers/anime/animedrive.ts +245 -245
- package/src/providers/anime/animekai.ts +627 -627
- package/src/providers/anime/animepahe/animepahe.ts +76 -76
- package/src/providers/anime/animepahe/create-animepahe.ts +350 -348
- package/src/providers/anime/animesuge/animesuge.ts +77 -0
- package/src/providers/anime/animesuge/create-animesuge.ts +327 -0
- package/src/providers/anime/animeunity.ts +216 -216
- package/src/providers/anime/index.ts +21 -21
- package/src/providers/anime/marin.ts +319 -319
- package/src/providers/anime/zoro/create-zoro.ts +656 -655
- package/src/providers/anime/zoro/zoro.ts +198 -197
- package/src/providers/index.ts +7 -7
- package/src/providers/manga/brmangas.ts +144 -144
- package/src/providers/meta/anilist.ts +2108 -2108
- package/src/providers/meta/mal.ts +635 -635
- package/src/providers/meta/tmdb.ts +470 -470
- package/src/providers/movies/himovies/create-himovies.ts +529 -529
- package/src/providers/movies/himovies/himovies.ts +90 -90
- package/src/providers/movies/index.ts +15 -15
- package/src/providers/movies/multimovies.ts +495 -495
- package/src/providers/movies/multistream/index.ts +232 -231
- package/src/providers/movies/multistream/utils.ts +147 -270
- package/src/utils/ExtractorManager.ts +311 -311
- package/src/utils/ProviderManager.ts +423 -424
- package/src/utils/create-extractor-context.ts +36 -22
- package/src/utils/create-provider-context.ts +117 -107
- package/src/utils/extension-utils.ts +105 -114
- package/src/utils/index.ts +96 -95
- package/src/utils/provider-maps.ts +31 -0
- package/src/utils/providers-list.ts +27 -27
- package/src/utils/url-polyfill.ts +642 -642
- package/src/utils/utils.ts +374 -374
|
@@ -1,216 +1,216 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { load } from 'cheerio';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
AnimeParser,
|
|
6
|
-
type ISearch,
|
|
7
|
-
type IAnimeInfo,
|
|
8
|
-
type IAnimeResult,
|
|
9
|
-
type ISource,
|
|
10
|
-
type IEpisodeServer,
|
|
11
|
-
SubOrDub,
|
|
12
|
-
} from '../../models';
|
|
13
|
-
|
|
14
|
-
class AnimeUnity extends AnimeParser {
|
|
15
|
-
override readonly name = 'AnimeUnity';
|
|
16
|
-
protected override baseUrl = 'https://www.animeunity.to';
|
|
17
|
-
protected override logo = 'https://www.animeunity.to/favicon-32x32.png';
|
|
18
|
-
protected override classPath = 'ANIME.AnimeUnity';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @param query Search query
|
|
22
|
-
*/
|
|
23
|
-
override search = async (query: string): Promise<ISearch<IAnimeResult>> => {
|
|
24
|
-
try {
|
|
25
|
-
const res = await axios.get(`${this.baseUrl}/archivio?title=${query}`);
|
|
26
|
-
const $ = load(res.data);
|
|
27
|
-
|
|
28
|
-
if (!$) return { results: [] };
|
|
29
|
-
|
|
30
|
-
const items = JSON.parse('' + $('archivio').attr('records') + '');
|
|
31
|
-
|
|
32
|
-
const searchResult: {
|
|
33
|
-
hasNextPage: boolean;
|
|
34
|
-
results: IAnimeResult[];
|
|
35
|
-
} = {
|
|
36
|
-
hasNextPage: false,
|
|
37
|
-
results: [],
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
for (const i in items) {
|
|
41
|
-
searchResult.results.push({
|
|
42
|
-
id: `${items[i].id}-${items[i].slug}`,
|
|
43
|
-
title: items[i].title ?? items[i].title_eng,
|
|
44
|
-
url: `${this.baseUrl}/anime/${items[i].id}-${items[i].slug}`,
|
|
45
|
-
image: items[i].imageurl,
|
|
46
|
-
cover: items[i].imageurl_cover,
|
|
47
|
-
rating: parseFloat(items[i].score),
|
|
48
|
-
releaseDate: items[i].date,
|
|
49
|
-
subOrDub: `${items[i].dub ? SubOrDub.DUB : SubOrDub.SUB}`,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return searchResult;
|
|
54
|
-
} catch (err) {
|
|
55
|
-
throw new Error((err as Error).message);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* @param id Anime id
|
|
61
|
-
* @param page Page number
|
|
62
|
-
*/
|
|
63
|
-
override fetchAnimeInfo = async (id: string, page: number = 1): Promise<IAnimeInfo> => {
|
|
64
|
-
const url = `${this.baseUrl}/anime/${id}`;
|
|
65
|
-
const episodesPerPage = 120;
|
|
66
|
-
const lastPageEpisode = page * episodesPerPage;
|
|
67
|
-
const firstPageEpisode = lastPageEpisode - 119;
|
|
68
|
-
const url2 = `${this.baseUrl}/info_api/${id}/1?start_range=${firstPageEpisode}&end_range=${lastPageEpisode}`;
|
|
69
|
-
|
|
70
|
-
try {
|
|
71
|
-
const res = await axios.get(url);
|
|
72
|
-
const $ = load(res.data);
|
|
73
|
-
|
|
74
|
-
const totalEpisodes = parseInt($('video-player')?.attr('episodes_count') ?? '0');
|
|
75
|
-
const totalPages = Math.round(totalEpisodes / 120) + 1;
|
|
76
|
-
|
|
77
|
-
if (page < 1 || page > totalPages)
|
|
78
|
-
throw new Error(`Argument 'page' for ${id} must be between 1 and ${totalPages}! (You passed ${page})`);
|
|
79
|
-
|
|
80
|
-
const animeInfo: IAnimeInfo = {
|
|
81
|
-
currentPage: page,
|
|
82
|
-
hasNextPage: totalPages > page,
|
|
83
|
-
totalPages: totalPages,
|
|
84
|
-
id: id,
|
|
85
|
-
title: $('h1.title')?.text().trim(),
|
|
86
|
-
url: url,
|
|
87
|
-
alID: $('.banner')?.attr('style')?.split('/')?.pop()?.split('-')[0],
|
|
88
|
-
genres:
|
|
89
|
-
$('.info-wrapper.pt-3.pb-3 small')
|
|
90
|
-
?.map((_, element): string => {
|
|
91
|
-
return $(element).text().replace(',', '').trim();
|
|
92
|
-
})
|
|
93
|
-
.toArray() ?? undefined,
|
|
94
|
-
totalEpisodes: totalEpisodes,
|
|
95
|
-
image: $('img.cover')?.attr('src'),
|
|
96
|
-
// image: $('meta[property="og:image"]')?.attr('content'),
|
|
97
|
-
cover: $('.banner')?.attr('src') ?? $('.banner')?.attr('style')?.replace('background: url(', ''),
|
|
98
|
-
description: $('.description').text().trim(),
|
|
99
|
-
episodes: [],
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
// fetch episodes method 1 (only first page can be fetchedd)
|
|
103
|
-
// const items = JSON.parse("" + $('video-player').attr('episodes') + "")
|
|
104
|
-
|
|
105
|
-
// fetch episodes method 2 (all pages can be fetched)
|
|
106
|
-
const res2 = await axios.get(url2);
|
|
107
|
-
const items = res2.data.episodes;
|
|
108
|
-
|
|
109
|
-
for (const i in items) {
|
|
110
|
-
animeInfo.episodes?.push({
|
|
111
|
-
id: `${id}/${items[i].id}`,
|
|
112
|
-
number: parseInt(items[i].number),
|
|
113
|
-
url: `${url}/${items[i].id}`,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return animeInfo;
|
|
118
|
-
} catch (err) {
|
|
119
|
-
throw new Error((err as Error).message);
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
*
|
|
125
|
-
* @param episodeId Episode id
|
|
126
|
-
*/
|
|
127
|
-
override fetchEpisodeSources = async (episodeId: string): Promise<ISource> => {
|
|
128
|
-
try {
|
|
129
|
-
const res = await axios.get(`${this.baseUrl}/anime/${episodeId}`);
|
|
130
|
-
const $ = load(res.data);
|
|
131
|
-
|
|
132
|
-
const episodeSources: ISource = {
|
|
133
|
-
sources: [],
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const streamUrl = $('video-player').attr('embed_url');
|
|
137
|
-
|
|
138
|
-
if (streamUrl) {
|
|
139
|
-
const res = await axios.get(streamUrl);
|
|
140
|
-
const $ = load(res.data);
|
|
141
|
-
|
|
142
|
-
const domain = $('script:contains("window.video")')
|
|
143
|
-
.text()
|
|
144
|
-
?.match(/url: '(.*)'/)![1];
|
|
145
|
-
const token = $('script:contains("window.video")')
|
|
146
|
-
.text()
|
|
147
|
-
?.match(/token': '(.*)'/)![1];
|
|
148
|
-
const expires = $('script:contains("window.video")')
|
|
149
|
-
.text()
|
|
150
|
-
?.match(/expires': '(.*)'/)![1];
|
|
151
|
-
|
|
152
|
-
const defaultUrl = `${domain}${
|
|
153
|
-
domain?.includes('?') ? '&' : '?'
|
|
154
|
-
}token=${token}&referer=&expires=${expires}&h=1`;
|
|
155
|
-
const m3u8Content = await axios.get(defaultUrl);
|
|
156
|
-
|
|
157
|
-
if (m3u8Content.data.includes('EXTM3U')) {
|
|
158
|
-
const videoList = m3u8Content.data.split('#EXT-X-STREAM-INF:');
|
|
159
|
-
for (const video of videoList ?? []) {
|
|
160
|
-
if (video.includes('BANDWIDTH')) {
|
|
161
|
-
const url = video.split('\n')[1];
|
|
162
|
-
const quality = video.split('RESOLUTION=')[1].split('\n')[0].split('x')[1];
|
|
163
|
-
|
|
164
|
-
episodeSources.sources.push({
|
|
165
|
-
url: url,
|
|
166
|
-
quality: `${quality}p`,
|
|
167
|
-
isM3U8: true,
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
episodeSources.sources.push({
|
|
174
|
-
url: defaultUrl,
|
|
175
|
-
quality: `default`,
|
|
176
|
-
isM3U8: true,
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
episodeSources.download = $('script:contains("window.downloadUrl ")')
|
|
180
|
-
.text()
|
|
181
|
-
?.match(/downloadUrl = '(.*)'/)![1]
|
|
182
|
-
?.toString();
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return episodeSources;
|
|
186
|
-
} catch (err) {
|
|
187
|
-
throw new Error((err as Error).message);
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
*
|
|
193
|
-
* @param episodeId Episode id
|
|
194
|
-
*/
|
|
195
|
-
override fetchEpisodeServers = (episodeId: string): Promise<IEpisodeServer[]> => {
|
|
196
|
-
throw new Error('Method not implemented.');
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export default AnimeUnity;
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* old episode sources fetching method, keep it here.
|
|
204
|
-
*/
|
|
205
|
-
// const domain = $('script:contains("window.video")').text()?.match(/url: '(.*)'/)![1]
|
|
206
|
-
// const token = $('script:contains("window.video")').text()?.match(/token': '(.*)'/)![1]
|
|
207
|
-
// const token360p = $('script:contains("window.video")').text()?.match(/token360p': '(.*)'/)![1]
|
|
208
|
-
// const token480p = $('script:contains("window.video")').text()?.match(/token480p': '(.*)'/)![1]
|
|
209
|
-
// const token720p = $('script:contains("window.video")').text()?.match(/token720p': '(.*)'/)![1]
|
|
210
|
-
// const token1080p = $('script:contains("window.video")').text()?.match(/token1080p': '(.*)'/)![1]
|
|
211
|
-
// const expires = $('script:contains("window.video")').text()?.match(/expires': '(.*)'/)![1]
|
|
212
|
-
|
|
213
|
-
// episodeSources.sources.push({
|
|
214
|
-
// url: `${domain}?token=${token}&token360p=${token360p}&token480p=${token480p}&token720p=${token720p}&token1080p=${token1080p}&referer=&expires=${expires}`,
|
|
215
|
-
// isM3U8: true
|
|
216
|
-
// })
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { load } from 'cheerio';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
AnimeParser,
|
|
6
|
+
type ISearch,
|
|
7
|
+
type IAnimeInfo,
|
|
8
|
+
type IAnimeResult,
|
|
9
|
+
type ISource,
|
|
10
|
+
type IEpisodeServer,
|
|
11
|
+
SubOrDub,
|
|
12
|
+
} from '../../models';
|
|
13
|
+
|
|
14
|
+
class AnimeUnity extends AnimeParser {
|
|
15
|
+
override readonly name = 'AnimeUnity';
|
|
16
|
+
protected override baseUrl = 'https://www.animeunity.to';
|
|
17
|
+
protected override logo = 'https://www.animeunity.to/favicon-32x32.png';
|
|
18
|
+
protected override classPath = 'ANIME.AnimeUnity';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param query Search query
|
|
22
|
+
*/
|
|
23
|
+
override search = async (query: string): Promise<ISearch<IAnimeResult>> => {
|
|
24
|
+
try {
|
|
25
|
+
const res = await axios.get(`${this.baseUrl}/archivio?title=${query}`);
|
|
26
|
+
const $ = load(res.data);
|
|
27
|
+
|
|
28
|
+
if (!$) return { results: [] };
|
|
29
|
+
|
|
30
|
+
const items = JSON.parse('' + $('archivio').attr('records') + '');
|
|
31
|
+
|
|
32
|
+
const searchResult: {
|
|
33
|
+
hasNextPage: boolean;
|
|
34
|
+
results: IAnimeResult[];
|
|
35
|
+
} = {
|
|
36
|
+
hasNextPage: false,
|
|
37
|
+
results: [],
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
for (const i in items) {
|
|
41
|
+
searchResult.results.push({
|
|
42
|
+
id: `${items[i].id}-${items[i].slug}`,
|
|
43
|
+
title: items[i].title ?? items[i].title_eng,
|
|
44
|
+
url: `${this.baseUrl}/anime/${items[i].id}-${items[i].slug}`,
|
|
45
|
+
image: items[i].imageurl,
|
|
46
|
+
cover: items[i].imageurl_cover,
|
|
47
|
+
rating: parseFloat(items[i].score),
|
|
48
|
+
releaseDate: items[i].date,
|
|
49
|
+
subOrDub: `${items[i].dub ? SubOrDub.DUB : SubOrDub.SUB}`,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return searchResult;
|
|
54
|
+
} catch (err) {
|
|
55
|
+
throw new Error((err as Error).message);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @param id Anime id
|
|
61
|
+
* @param page Page number
|
|
62
|
+
*/
|
|
63
|
+
override fetchAnimeInfo = async (id: string, page: number = 1): Promise<IAnimeInfo> => {
|
|
64
|
+
const url = `${this.baseUrl}/anime/${id}`;
|
|
65
|
+
const episodesPerPage = 120;
|
|
66
|
+
const lastPageEpisode = page * episodesPerPage;
|
|
67
|
+
const firstPageEpisode = lastPageEpisode - 119;
|
|
68
|
+
const url2 = `${this.baseUrl}/info_api/${id}/1?start_range=${firstPageEpisode}&end_range=${lastPageEpisode}`;
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
const res = await axios.get(url);
|
|
72
|
+
const $ = load(res.data);
|
|
73
|
+
|
|
74
|
+
const totalEpisodes = parseInt($('video-player')?.attr('episodes_count') ?? '0');
|
|
75
|
+
const totalPages = Math.round(totalEpisodes / 120) + 1;
|
|
76
|
+
|
|
77
|
+
if (page < 1 || page > totalPages)
|
|
78
|
+
throw new Error(`Argument 'page' for ${id} must be between 1 and ${totalPages}! (You passed ${page})`);
|
|
79
|
+
|
|
80
|
+
const animeInfo: IAnimeInfo = {
|
|
81
|
+
currentPage: page,
|
|
82
|
+
hasNextPage: totalPages > page,
|
|
83
|
+
totalPages: totalPages,
|
|
84
|
+
id: id,
|
|
85
|
+
title: $('h1.title')?.text().trim(),
|
|
86
|
+
url: url,
|
|
87
|
+
alID: $('.banner')?.attr('style')?.split('/')?.pop()?.split('-')[0],
|
|
88
|
+
genres:
|
|
89
|
+
$('.info-wrapper.pt-3.pb-3 small')
|
|
90
|
+
?.map((_, element): string => {
|
|
91
|
+
return $(element).text().replace(',', '').trim();
|
|
92
|
+
})
|
|
93
|
+
.toArray() ?? undefined,
|
|
94
|
+
totalEpisodes: totalEpisodes,
|
|
95
|
+
image: $('img.cover')?.attr('src'),
|
|
96
|
+
// image: $('meta[property="og:image"]')?.attr('content'),
|
|
97
|
+
cover: $('.banner')?.attr('src') ?? $('.banner')?.attr('style')?.replace('background: url(', ''),
|
|
98
|
+
description: $('.description').text().trim(),
|
|
99
|
+
episodes: [],
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// fetch episodes method 1 (only first page can be fetchedd)
|
|
103
|
+
// const items = JSON.parse("" + $('video-player').attr('episodes') + "")
|
|
104
|
+
|
|
105
|
+
// fetch episodes method 2 (all pages can be fetched)
|
|
106
|
+
const res2 = await axios.get(url2);
|
|
107
|
+
const items = res2.data.episodes;
|
|
108
|
+
|
|
109
|
+
for (const i in items) {
|
|
110
|
+
animeInfo.episodes?.push({
|
|
111
|
+
id: `${id}/${items[i].id}`,
|
|
112
|
+
number: parseInt(items[i].number),
|
|
113
|
+
url: `${url}/${items[i].id}`,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return animeInfo;
|
|
118
|
+
} catch (err) {
|
|
119
|
+
throw new Error((err as Error).message);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
*
|
|
125
|
+
* @param episodeId Episode id
|
|
126
|
+
*/
|
|
127
|
+
override fetchEpisodeSources = async (episodeId: string): Promise<ISource> => {
|
|
128
|
+
try {
|
|
129
|
+
const res = await axios.get(`${this.baseUrl}/anime/${episodeId}`);
|
|
130
|
+
const $ = load(res.data);
|
|
131
|
+
|
|
132
|
+
const episodeSources: ISource = {
|
|
133
|
+
sources: [],
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const streamUrl = $('video-player').attr('embed_url');
|
|
137
|
+
|
|
138
|
+
if (streamUrl) {
|
|
139
|
+
const res = await axios.get(streamUrl);
|
|
140
|
+
const $ = load(res.data);
|
|
141
|
+
|
|
142
|
+
const domain = $('script:contains("window.video")')
|
|
143
|
+
.text()
|
|
144
|
+
?.match(/url: '(.*)'/)![1];
|
|
145
|
+
const token = $('script:contains("window.video")')
|
|
146
|
+
.text()
|
|
147
|
+
?.match(/token': '(.*)'/)![1];
|
|
148
|
+
const expires = $('script:contains("window.video")')
|
|
149
|
+
.text()
|
|
150
|
+
?.match(/expires': '(.*)'/)![1];
|
|
151
|
+
|
|
152
|
+
const defaultUrl = `${domain}${
|
|
153
|
+
domain?.includes('?') ? '&' : '?'
|
|
154
|
+
}token=${token}&referer=&expires=${expires}&h=1`;
|
|
155
|
+
const m3u8Content = await axios.get(defaultUrl);
|
|
156
|
+
|
|
157
|
+
if (m3u8Content.data.includes('EXTM3U')) {
|
|
158
|
+
const videoList = m3u8Content.data.split('#EXT-X-STREAM-INF:');
|
|
159
|
+
for (const video of videoList ?? []) {
|
|
160
|
+
if (video.includes('BANDWIDTH')) {
|
|
161
|
+
const url = video.split('\n')[1];
|
|
162
|
+
const quality = video.split('RESOLUTION=')[1].split('\n')[0].split('x')[1];
|
|
163
|
+
|
|
164
|
+
episodeSources.sources.push({
|
|
165
|
+
url: url,
|
|
166
|
+
quality: `${quality}p`,
|
|
167
|
+
isM3U8: true,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
episodeSources.sources.push({
|
|
174
|
+
url: defaultUrl,
|
|
175
|
+
quality: `default`,
|
|
176
|
+
isM3U8: true,
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
episodeSources.download = $('script:contains("window.downloadUrl ")')
|
|
180
|
+
.text()
|
|
181
|
+
?.match(/downloadUrl = '(.*)'/)![1]
|
|
182
|
+
?.toString();
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return episodeSources;
|
|
186
|
+
} catch (err) {
|
|
187
|
+
throw new Error((err as Error).message);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
*
|
|
193
|
+
* @param episodeId Episode id
|
|
194
|
+
*/
|
|
195
|
+
override fetchEpisodeServers = (episodeId: string): Promise<IEpisodeServer[]> => {
|
|
196
|
+
throw new Error('Method not implemented.');
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export default AnimeUnity;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* old episode sources fetching method, keep it here.
|
|
204
|
+
*/
|
|
205
|
+
// const domain = $('script:contains("window.video")').text()?.match(/url: '(.*)'/)![1]
|
|
206
|
+
// const token = $('script:contains("window.video")').text()?.match(/token': '(.*)'/)![1]
|
|
207
|
+
// const token360p = $('script:contains("window.video")').text()?.match(/token360p': '(.*)'/)![1]
|
|
208
|
+
// const token480p = $('script:contains("window.video")').text()?.match(/token480p': '(.*)'/)![1]
|
|
209
|
+
// const token720p = $('script:contains("window.video")').text()?.match(/token720p': '(.*)'/)![1]
|
|
210
|
+
// const token1080p = $('script:contains("window.video")').text()?.match(/token1080p': '(.*)'/)![1]
|
|
211
|
+
// const expires = $('script:contains("window.video")').text()?.match(/expires': '(.*)'/)![1]
|
|
212
|
+
|
|
213
|
+
// episodeSources.sources.push({
|
|
214
|
+
// url: `${domain}?token=${token}&token360p=${token360p}&token480p=${token480p}&token720p=${token720p}&token1080p=${token1080p}&referer=&expires=${expires}`,
|
|
215
|
+
// isM3U8: true
|
|
216
|
+
// })
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import AnimePahe from './animepahe/animepahe';
|
|
2
|
-
import
|
|
3
|
-
import Zoro from './zoro/zoro';
|
|
4
|
-
import
|
|
5
|
-
import AnimeDrive from './animedrive';
|
|
6
|
-
import Anify from './anify';
|
|
7
|
-
import Marin from './marin';
|
|
8
|
-
import AnimeUnity from './animeunity';
|
|
9
|
-
import AnimeKai from './animekai';
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
AnimePahe,
|
|
13
|
-
createAnimePahe,
|
|
14
|
-
Zoro,
|
|
15
|
-
createZoro,
|
|
16
|
-
AnimeDrive,
|
|
17
|
-
Anify,
|
|
18
|
-
Marin,
|
|
19
|
-
AnimeUnity,
|
|
20
|
-
AnimeKai,
|
|
21
|
-
};
|
|
1
|
+
import AnimePahe from './animepahe/animepahe';
|
|
2
|
+
import createAnimePahe from './animepahe/create-animepahe';
|
|
3
|
+
import Zoro from './zoro/zoro';
|
|
4
|
+
import createZoro from './zoro/create-zoro';
|
|
5
|
+
import AnimeDrive from './animedrive';
|
|
6
|
+
import Anify from './anify';
|
|
7
|
+
import Marin from './marin';
|
|
8
|
+
import AnimeUnity from './animeunity';
|
|
9
|
+
import AnimeKai from './animekai';
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
AnimePahe,
|
|
13
|
+
createAnimePahe,
|
|
14
|
+
Zoro,
|
|
15
|
+
createZoro,
|
|
16
|
+
AnimeDrive,
|
|
17
|
+
Anify,
|
|
18
|
+
Marin,
|
|
19
|
+
AnimeUnity,
|
|
20
|
+
AnimeKai,
|
|
21
|
+
};
|