kenjitsu-extensions 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of kenjitsu-extensions might be problematic. Click here for more details.

package/dist/main.d.ts ADDED
@@ -0,0 +1,2522 @@
1
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD';
2
+ interface RequestConfig {
3
+ url: string;
4
+ method?: HttpMethod;
5
+ headers?: Record<string, string>;
6
+ body?: any;
7
+ params?: Record<string, string>;
8
+ retries?: number;
9
+ timeout?: number;
10
+ delayBetweenRequests?: number;
11
+ }
12
+ interface FetchResponse<T = any> {
13
+ status: number;
14
+ statusText: string;
15
+ headers: Record<string, string>;
16
+ data: T;
17
+ config: RequestConfig;
18
+ }
19
+ type RequestInterceptor = (config: RequestConfig) => Promise<RequestConfig> | RequestConfig;
20
+ type ResponseInterceptor = (response: FetchResponse) => Promise<FetchResponse> | FetchResponse;
21
+ declare class FetchClient {
22
+ private readonly defaultOptions;
23
+ private lastRequestTime;
24
+ private lastUserAgent;
25
+ private readonly requestInterceptors;
26
+ private readonly responseInterceptors;
27
+ constructor(options?: Partial<RequestConfig>);
28
+ useRequestInterceptor(interceptor: RequestInterceptor): void;
29
+ useResponseInterceptor(interceptor: ResponseInterceptor): void;
30
+ getUserAgent(): string | null;
31
+ private delayIfNeeded;
32
+ request<T = any>(config: RequestConfig): Promise<FetchResponse<T>>;
33
+ get<T = any>(url: string, config?: Partial<RequestConfig>): Promise<FetchResponse<T>>;
34
+ post<T = any>(url: string, data?: any, config?: Partial<RequestConfig>): Promise<FetchResponse<T>>;
35
+ }
36
+
37
+ declare abstract class BaseClass {
38
+ protected readonly client: FetchClient;
39
+ constructor(requestTimeout?: number);
40
+ protected createSlug(text: string): string;
41
+ protected normalizeKey(input: string): string;
42
+ protected getMappedValue<T extends string, U extends string>(input: T, mapping: Record<string, U>): U;
43
+ }
44
+
45
+ interface IBase {
46
+ id: string | null;
47
+ name: string | null;
48
+ posterImage: string | null;
49
+ }
50
+ interface IBaseEpisodes {
51
+ episodeId: string | null;
52
+ episodeNumber: number | null;
53
+ }
54
+ interface ISubServers {
55
+ serverId: number | string | null;
56
+ serverName: string | null;
57
+ mediaId: number | string | null;
58
+ eid?: string | null;
59
+ }
60
+ type IDubServers = ISubServers;
61
+ type IRawServers = ISubServers;
62
+ interface IServerInfo {
63
+ sub: ISubServers[];
64
+ dub: IDubServers[];
65
+ raw: IRawServers[];
66
+ episodeNumber: number | null;
67
+ }
68
+ type ISubOrDub = 'sub' | 'dub' | 'raw';
69
+ interface IResponse<T> {
70
+ data: T;
71
+ error?: string;
72
+ }
73
+ interface ISubtitles {
74
+ url: string | null;
75
+ lang: string | null;
76
+ default?: boolean | null;
77
+ }
78
+ interface IOutro {
79
+ start: number | null;
80
+ end: number | null;
81
+ }
82
+ interface ITracks {
83
+ url: string | null;
84
+ type: string | null;
85
+ quality?: string | null;
86
+ }
87
+ interface IVideoSource {
88
+ intro?: IOutro;
89
+ outro?: IOutro;
90
+ subtitles?: ISubtitles[];
91
+ tracks?: ITracks[];
92
+ sources: ISource[];
93
+ download?: string | null;
94
+ posterImage?: string | null;
95
+ }
96
+ interface ISource {
97
+ url: string | null;
98
+ isM3u8: boolean | null;
99
+ type: string | null;
100
+ quality?: string | null;
101
+ }
102
+ type IAnimeCategory = 'MOVIE' | 'TV' | 'ONA' | 'OVA' | 'SPECIALS';
103
+ interface ISourceBaseResponse<T> extends IResponse<T> {
104
+ headers: {
105
+ Referer: string | null;
106
+ };
107
+ }
108
+ interface IBasePaginated<T> extends IResponse<T> {
109
+ hasNextPage: boolean;
110
+ currentPage: number;
111
+ }
112
+ interface IHomeResSpecialPages {
113
+ error?: string;
114
+ }
115
+
116
+ interface IZBase extends IBase {
117
+ romaji: string | null;
118
+ }
119
+ interface IZAnime extends IZBase {
120
+ type?: string | null;
121
+ episodes: {
122
+ sub: number | null;
123
+ dub: number | null;
124
+ };
125
+ totalEpisodes: number | null;
126
+ }
127
+ interface IZSearchSuggestions extends IZBase {
128
+ releaseDate: string | null;
129
+ type: string | null;
130
+ duration: string | null;
131
+ }
132
+ interface IZSpotlight extends IZAnime {
133
+ spotlight?: string | null;
134
+ synopsis: string | null;
135
+ releaseDate: string | null;
136
+ quality: string | null;
137
+ }
138
+ interface IZAnimeInfo extends IZSpotlight {
139
+ anilistId: number | null;
140
+ malId: number | null;
141
+ altnames: string | null;
142
+ japanese: string | null;
143
+ status: string | null;
144
+ score: string | null;
145
+ genres: string[] | null;
146
+ studios: string[] | null;
147
+ rating: string | null;
148
+ producers: string[] | null;
149
+ }
150
+ interface IZRelatedSeasons {
151
+ id: string | null;
152
+ name: string | null;
153
+ season: string | null;
154
+ seasonPoster: string | null;
155
+ }
156
+ interface IZPromotionVIds {
157
+ url: string | null;
158
+ title: string | null;
159
+ thumbnail: string | null;
160
+ }
161
+ interface IZCharacters {
162
+ id: string | null;
163
+ name: string | null;
164
+ posterImage: string | null;
165
+ role: string | null;
166
+ voiceActor: {
167
+ id: string | null;
168
+ name: string | null;
169
+ posterImage: string | null;
170
+ language: string | null;
171
+ } | null;
172
+ }
173
+ interface IZEpisodes {
174
+ episodeId: string | null;
175
+ episodeNumber: number | null;
176
+ romaji: string | null;
177
+ title: string | null;
178
+ hasSub: boolean;
179
+ hasDub: boolean;
180
+ }
181
+ type HiAnimeServers = 'hd-1' | 'hd-2';
182
+ interface IZPaginated$1<T> extends IBasePaginated<T> {
183
+ lastPage: number;
184
+ }
185
+ interface IZHomeResponse<T> extends IHomeResSpecialPages {
186
+ data: IZAnime[];
187
+ trending: IZBase[];
188
+ topAiring: IZAnime[];
189
+ mostPopular: IZAnime[];
190
+ recentlyUpdated: IZAnime[];
191
+ recentlyCompleted: IZAnime[];
192
+ recentlyAdded: IZAnime[];
193
+ favourites: IZAnime[];
194
+ topAnime: {
195
+ daily: IZAnime[];
196
+ weekly: IZAnime[];
197
+ monthly: IZAnime[];
198
+ };
199
+ }
200
+ interface IZSourceResponse<T> extends ISourceBaseResponse<T> {
201
+ syncData?: {
202
+ anilistId: string | null;
203
+ malId: string | null;
204
+ name: string | null;
205
+ };
206
+ }
207
+ interface IZoroAnimeInfoScrape<T> extends IResponse<T> {
208
+ relatedSeasons: IZRelatedSeasons[] | [];
209
+ recommendedAnime: IZAnime[] | [];
210
+ relatedAnime: IZAnime[] | [];
211
+ mostPopular: IZAnime[];
212
+ promotionVideos: IZPromotionVIds[];
213
+ characters: IZCharacters[];
214
+ }
215
+ interface IZoroInfoResponse<T> extends IZoroAnimeInfoScrape<T> {
216
+ providerEpisodes: IZEpisodes[] | [];
217
+ }
218
+ declare const HIGenres: {
219
+ readonly action: "action";
220
+ readonly adventure: "adventure";
221
+ readonly cars: "cars";
222
+ readonly comedy: "comedy";
223
+ readonly dementia: "dementia";
224
+ readonly demons: "demons";
225
+ readonly drama: "drama";
226
+ readonly ecchi: "ecchi";
227
+ readonly fantasy: "fantasy";
228
+ readonly game: "game";
229
+ readonly harem: "harem";
230
+ readonly historical: "historical";
231
+ readonly horror: "horror";
232
+ readonly isekai: "isekai";
233
+ readonly josei: "josei";
234
+ readonly kids: "kids";
235
+ readonly magic: "magic";
236
+ readonly 'martial-arts': "martial-arts";
237
+ readonly mecha: "mecha";
238
+ readonly military: "military";
239
+ readonly music: "music";
240
+ readonly mystery: "mystery";
241
+ readonly parody: "parody";
242
+ readonly police: "police";
243
+ readonly psychological: "psychological";
244
+ readonly romance: "romance";
245
+ readonly samurai: "samurai";
246
+ readonly school: "school";
247
+ readonly 'sci-fi': "sci-fi";
248
+ readonly seinen: "seinen";
249
+ readonly shoujo: "shoujo";
250
+ readonly 'shoujo-ai': "shoujo-ai";
251
+ readonly shounen: "shounen";
252
+ readonly 'shounen-ai': "shounen-ai";
253
+ readonly 'slice-of-life': "slice-of-life";
254
+ readonly space: "space";
255
+ readonly sports: "sports";
256
+ readonly 'super-power': "super-power";
257
+ readonly supernatural: "supernatural";
258
+ readonly thriller: "thriller";
259
+ readonly vampire: "vampire";
260
+ };
261
+ type HIGenre = keyof typeof HIGenres;
262
+
263
+ /**
264
+ * A class for interacting with the HiAnime platform (hianime.to) to search for anime, fetch detailed information,
265
+ * retrieve episode lists, get available streaming servers, and fetch curated anime lists.
266
+ */
267
+ declare class HiAnime extends BaseClass {
268
+ private readonly baseUrl;
269
+ constructor(baseUrl?: string);
270
+ /**
271
+ * Parses paginated anime search results from a Cheerio instance.
272
+ * Extracts anime details and pagination information from the provided HTML selector.
273
+ * @param $ CheerioAPI instance
274
+ * @param selector CSS selector for anime items
275
+ * @returns An object containing anime list and pagination details
276
+ */
277
+ private parsePaginatedResults;
278
+ /**
279
+ * Parses search suggestion results from a Cheerio instance.
280
+ * Extracts anime suggestion details from the provided HTML.
281
+ * @param $ CheerioAPI instance
282
+ * @returns An array containing an array of search suggestions
283
+ */
284
+ private parseSearchSuggestions;
285
+ /**
286
+ * Parses detailed anime information from a Cheerio instance.
287
+ * Extracts anime details, characters, recommendations, related anime, seasons, and promotion videos.
288
+ * @param $ CheerioAPI instance
289
+ * @returns Object containing anime details and related data
290
+ */
291
+ private parseAnimeInfo;
292
+ /**
293
+ * Parses the HiAnime homepage data from a Cheerio instance.
294
+ * Extracts spotlight, trending, top airing, most popular, favorites, recently completed, recently added, recently updated, and top anime rankings.
295
+ * @param $ CheerioAPI instance
296
+ * @returns An object containing various curated anime lists
297
+ */
298
+ private parseHome;
299
+ /**
300
+ * Parses paginated sections like top airing, most popular, etc., from a Cheerio instance.
301
+ * Extracts anime details, pagination information, and top anime rankings.
302
+ * @param $ CheerioAPI instance
303
+ * @returns RepetitiveSections containing anime list, pagination details, and top anime rankings
304
+ */
305
+ private parsePaginatedSections;
306
+ /**
307
+ * Parses episode data for an anime from a Cheerio instance.
308
+ * Extracts episode IDs, titles, and numbers from the provided HTML.
309
+ * @param $ CheerioAPI instance
310
+ * @returns Response containing an array of episode information
311
+ */
312
+ private parseEpisodes;
313
+ /**
314
+ * Parses streaming server data for an episode from a Cheerio instance.
315
+ * Extracts sub, dub, and raw server details along with episode number.
316
+ * @param $ CheerioAPI instance
317
+ * @returns Response containing server information
318
+ */
319
+ private parseServerData;
320
+ /**
321
+ * Finds the server ID for a given category and server name from the server data.
322
+ * @param servers Server information containing sub, dub, and raw server lists
323
+ * @param category Sub or dub category
324
+ * @param server Server name to find
325
+ * @returns The media ID of the matching server
326
+ * @throws Error if the category or server is not found
327
+ */
328
+ private findServerId;
329
+ /**
330
+ * Searches for anime based on the provided query string.
331
+ * @param {string} query - The search query string (required).
332
+ * @param {number} [page=1] - The page number for pagination (optional, defaults to 1).
333
+ * @returns A promise that resolves to an object containing an array of anime titles, pagination details, or an error message.
334
+ */
335
+ search(query: string, page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
336
+ /**
337
+ * Fetches search suggestions for a given query string from the HiAnime platform.
338
+ * @param {string} query - The search query string (required).
339
+ @returns A promise that resolves to an object containing an array of anime titles or an error message.
340
+ */
341
+ searchSuggestions(query: string): Promise<IResponse<IZSearchSuggestions[] | []>>;
342
+ /**
343
+ * Fetches curated lists from the HiAnime homepage.
344
+ * @returns Promise resolving to an object with various curated anime lists
345
+ */
346
+ fetchHome(): Promise<IZHomeResponse<IZSpotlight[] | []>>;
347
+ /**
348
+ * Fetches a paginated list of top airing anime.
349
+ * @param {number} page - Page number for pagination (default: 1)
350
+ * @returns Promise resolving to an object with top airing anime and pagination details
351
+ */
352
+ fetchTopAiring(page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
353
+ /**
354
+ * Fetches a paginated list of the most favorited anime.
355
+ * @param {number} page - Page number for pagination (default: 1)
356
+ * @returns Promise resolving to an object with favorited anime and pagination details
357
+ */
358
+ fetchMostFavourites(page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
359
+ /**
360
+ * Fetches a paginated list of the most popular anime.
361
+ * @param {number} page - Page number for pagination (default: 1)
362
+ * @returns Promise resolving to an object with popular anime and pagination details
363
+ */
364
+ fetchMostPopular(page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
365
+ /**
366
+ * Fetches a paginated list of recently completed anime.
367
+ * @param {number} page - Page number for pagination (default: 1)
368
+ * @returns Promise resolving to an object with recently completed anime and pagination details
369
+ */
370
+ fetchRecentlyCompleted(page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
371
+ /**
372
+ * Fetches a paginated list of recently added anime.
373
+ * @param {number} page - Page number for pagination (default: 1)
374
+ * @returns Promise resolving to an object with recently added anime and pagination details
375
+ */
376
+ fetchRecentlyAdded(page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
377
+ /**
378
+ * Fetches a paginated list of recently updated anime.
379
+ * @param {number} page - Page number for pagination (default: 1)
380
+ * @returns Promise resolving to an object with recently updated anime and pagination details
381
+ */
382
+ fetchRecentlyUpdated(page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
383
+ /**
384
+ * Fetches a list of anime titles sorted alphabetically, optionally filtered by a starting character.
385
+ * @param {any} sort Optional letter (A-Z) or "0-9" to filter anime
386
+ * @param {number} page - Page number for pagination (default: 1)
387
+ *@returns Promise resolving to an object with alphabetically sorted anime and pagination details
388
+ */
389
+ fetchAtoZList(sort?: any, page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
390
+ /**
391
+ * Fetches a list of anime by genre.
392
+ * @param {string} genre -The genre to filter anime by
393
+ * @param {number} page - Page number for pagination (default: 1)
394
+ * @returns Promise resolving to an object with genre-specific anime and pagination details
395
+ */
396
+ fetchGenre(genre: string, page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
397
+ /**
398
+ * Fetches a list of subbed anime.
399
+ * @param {number} page - Page number for pagination (default: 1)
400
+ * @returns Promise resolving to an object with subbed anime and pagination details
401
+ */
402
+ fetchSubbedAnime(page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
403
+ /**
404
+ * Fetches a list of dubbed anime.
405
+ * @param {number} page - Page number for pagination (default: 1)
406
+ * @returns Promise resolving to an object with dubbed anime and pagination details
407
+ */
408
+ fetchDubbedAnime(page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
409
+ /**
410
+ * Fetches a list of anime by category.
411
+ * @param { IAnimeCategory} category - The category of anime to fetch (MOVIE, TV, ONA, OVA, SPECIALS).
412
+ * @param {number} [page=1] - The page number for pagination (default: 1).
413
+ * @returns - Promise resolving to paginated anime results.
414
+ */
415
+ fetchAnimeCategory(category: IAnimeCategory, page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
416
+ /**
417
+ * Fetches detailed information about a specific anime including episodes.
418
+ * @param {string} animeId - The unique identifier for the anime (e.g., "bleach-806") (required).
419
+ * @returns A promise that resolves to an object containing anime details,provider episodes, related seasons, characters, recommendations, or an error message.
420
+ */
421
+ fetchAnimeInfo(animeId: string): Promise<IZoroInfoResponse<IZAnimeInfo | null>>;
422
+ /**
423
+ * Fetches episode data for a specific anime.
424
+ * @param {string} animeId - The unique identifier for the anime (e.g., "bleach-806") (required).
425
+ * @returns A promise that resolves to an object containing an array of episode information or an error message.
426
+ */
427
+ fetchEpisodes(animeId: string): Promise<IResponse<IZEpisodes[] | []>>;
428
+ /**
429
+ * Fetches available streaming servers for a specific anime episode.
430
+ * @param {string} episodeId - The unique identifier for the episode (required).
431
+ * @returns A promise that resolves to an object containing available streaming server details (sub, dub, raw) or an error message.
432
+ */
433
+ fetchServers(episodeId: string): Promise<IResponse<IServerInfo | null>>;
434
+ /**
435
+ * Fetches streaming sources for a given anime episode from a specified server and category.
436
+ * @param {string} episodeId - The unique identifier for the episode (required).
437
+ * @param {HiAnimeServers} server - The streaming server to use (optional, defaults to hd-2). Note: hd-1 may return a 403 error due to CORS restrictions; use a proxy or switch to hd-2 or hd-3
438
+ * @param {HISubOrDub} category - The audio category (Subtitled or Dubbed) (optional, defaults to SubOrDub.SUB).
439
+ * @returns A promise that resolves to an object containing streaming sources, headers, sync data (AniList/MAL IDs), or an error message.
440
+ */
441
+ fetchSources(episodeId: string, server?: HiAnimeServers, category?: ISubOrDub): Promise<IZSourceResponse<IVideoSource | null>>;
442
+ }
443
+
444
+ interface IAllAnimeInfo extends IBase {
445
+ native: string;
446
+ type: string;
447
+ season: string;
448
+ releaseDate: number;
449
+ score: number;
450
+ genres: string[];
451
+ synopsis: string;
452
+ studios: string[];
453
+ status: string;
454
+ }
455
+ interface IAllAnime extends IBase {
456
+ native: string | null;
457
+ romaji: string | null;
458
+ }
459
+ interface IAllAnimeEpisodes extends IBaseEpisodes {
460
+ hasSub: boolean | null;
461
+ hasDub: boolean | null;
462
+ hasRaw: boolean;
463
+ }
464
+ type AllAnimeServers = 'mp4upload' | 'internal-s-mp4' | 'internal-default-hls' | 'internal-ak' | 'internal-yt-mp4';
465
+
466
+ interface IMovieTvBase {
467
+ id: string | null;
468
+ name: string | null;
469
+ posterImage: string | null;
470
+ type: 'Movie' | 'TV' | null;
471
+ quality?: string | null;
472
+ }
473
+ interface IMovieSlider extends IMovieTvBase {
474
+ synopsis: string | null;
475
+ score: number | null;
476
+ duration: string | null;
477
+ genre: string[] | null;
478
+ }
479
+ interface IMovie extends IMovieTvBase {
480
+ type: 'Movie';
481
+ releaseDate: string | number | null;
482
+ duration: string | null;
483
+ }
484
+ interface ITvShow extends IMovieTvBase {
485
+ type: 'TV';
486
+ seasons: number | null;
487
+ totalEpisodes: number | null;
488
+ }
489
+ interface IMovieInfo extends IMovieTvBase {
490
+ releaseDate: string | null;
491
+ synopsis: string | null;
492
+ duration: string | null;
493
+ production: string[] | null;
494
+ country: string[] | null;
495
+ casts: string[] | null;
496
+ trailer: string | null;
497
+ score: number | null;
498
+ genre: string[] | null;
499
+ }
500
+ type IMovieOrTv = IMovie | ITvShow;
501
+ interface IMovieInfoResponse<T> extends IResponse<T> {
502
+ recommended: IMovieOrTv[] | [];
503
+ providerEpisodes: IMovieEpisodes[] | [];
504
+ }
505
+ interface IMovieEpisodes {
506
+ title: string | null;
507
+ episodeId: string | null;
508
+ seasonNumber: number | null;
509
+ episodeNumber: number | null;
510
+ }
511
+ interface IMovieServers {
512
+ serverId: string | null;
513
+ serverName: string | null;
514
+ }
515
+ interface IHomeHIResponse<T> extends IHomeResSpecialPages {
516
+ featured?: IMovieSlider[] | [];
517
+ trending: {
518
+ Movies: IMovieOrTv[] | [];
519
+ Tv: IMovieOrTv[] | [];
520
+ };
521
+ recentReleases: {
522
+ Movies: IMovieOrTv[] | [];
523
+ Tv: IMovieOrTv[] | [];
524
+ };
525
+ upcoming: IMovieOrTv[] | [];
526
+ }
527
+ interface IZPaginated<T> extends IBasePaginated<T> {
528
+ lastPage: number;
529
+ }
530
+ declare const HIMovieGenres: {
531
+ readonly action: "action";
532
+ readonly actionandadventure: "action-adventure";
533
+ readonly adventure: "adventure";
534
+ readonly animation: "animation";
535
+ readonly biography: "biography";
536
+ readonly comedy: "comedy";
537
+ readonly crime: "crime";
538
+ readonly documentary: "documentary";
539
+ readonly drama: "drama";
540
+ readonly family: "family";
541
+ readonly fantasy: "fantasy";
542
+ readonly history: "history";
543
+ readonly horror: "horror";
544
+ readonly kids: "kids";
545
+ readonly music: "music";
546
+ readonly mystery: "mystery";
547
+ readonly news: "news";
548
+ readonly reality: "reality";
549
+ readonly romance: "romance";
550
+ readonly scifiandfantasy: "sci-fi-fantasy";
551
+ readonly sciencefiction: "science-fiction";
552
+ readonly soap: "soap";
553
+ readonly talk: "talk";
554
+ readonly thriller: "thriller";
555
+ readonly tvmovie: "tv-movie";
556
+ readonly war: "war";
557
+ readonly warandpolitics: "war-politics";
558
+ readonly western: "western";
559
+ };
560
+ type IMovieGenre = keyof typeof HIMovieGenres;
561
+ declare const HIMovieCountryCode: {
562
+ readonly argentina: "AR";
563
+ readonly australia: "AU";
564
+ readonly austria: "AT";
565
+ readonly belgium: "BE";
566
+ readonly brazil: "BR";
567
+ readonly canada: "CA";
568
+ readonly china: "CN";
569
+ readonly czechrepublic: "CZ";
570
+ readonly denmark: "DK";
571
+ readonly finland: "FI";
572
+ readonly france: "FR";
573
+ readonly germany: "DE";
574
+ readonly hongkong: "HK";
575
+ readonly hungary: "HU";
576
+ readonly india: "IN";
577
+ readonly ireland: "IE";
578
+ readonly israel: "IL";
579
+ readonly italy: "IT";
580
+ readonly japan: "JP";
581
+ readonly luxembourg: "LU";
582
+ readonly mexico: "MX";
583
+ readonly netherlands: "NL";
584
+ readonly newzealand: "NZ";
585
+ readonly norway: "NO";
586
+ readonly poland: "PL";
587
+ readonly romania: "RO";
588
+ readonly russia: "RU";
589
+ readonly southafrica: "ZA";
590
+ readonly southkorea: "KR";
591
+ readonly spain: "ES";
592
+ readonly sweden: "SE";
593
+ readonly switzerland: "CH";
594
+ readonly taiwan: "TW";
595
+ readonly thailand: "TH";
596
+ readonly unitedkingdom: "GB";
597
+ readonly unitedstates: "US";
598
+ };
599
+ type IMovieCountry = keyof typeof HIMovieCountryCode;
600
+
601
+ /**
602
+ * Class to handle interactions with the AllAnime API.
603
+ * @extends BaseClass
604
+ */
605
+ declare class AllAnime extends BaseClass {
606
+ /**
607
+ * Base URL for the AllAnime API.
608
+ * @private
609
+ */
610
+ private readonly baseUrl;
611
+ /**
612
+ * Initializes the AllAnime class.
613
+ */
614
+ constructor();
615
+ /**
616
+ * Number of items per page for search results.
617
+ * @private
618
+ */
619
+ private readonly pageSize;
620
+ private advancedSearch;
621
+ /**
622
+ * GraphQL query for searching anime shows.
623
+ * @private
624
+ */
625
+ private SearchQuery;
626
+ /**
627
+ * GraphQL query for fetching animeinfo.
628
+ * @private
629
+ */
630
+ private AnimeInfoQuery;
631
+ /**
632
+ * GraphQL query for fetching episode details for a specific show.
633
+ * @private
634
+ */
635
+ private EpisodesQuery;
636
+ /**
637
+ * GraphQL query for fetching streaming sources for a specific episode.
638
+ * @private
639
+ */
640
+ private StreamsQuery;
641
+ private decryptSource;
642
+ /**
643
+ * Searches for anime based on a query string and pagination.
644
+ * @param query - The search query string.
645
+ * @param page - The page number for paginated results (default: 1).
646
+ * @returns A promise resolving to paginated anime search results.
647
+ * @throws Error if the search query is empty.
648
+ */
649
+ search(query: string): Promise<IResponse<IAllAnime[] | []>>;
650
+ /**
651
+ * Fetches anime details for a specific anime by its ID.
652
+ * @param id - The ID of the anime show.
653
+ * @returns A promise resolving to a anime info or an error.
654
+
655
+ */
656
+ fetchAnimeInfo(id: string): Promise<IResponse<IAllAnimeInfo | null>>;
657
+ /**
658
+ * Fetches episode details for a specific anime by its ID.
659
+ * @param id - The ID of the anime show.
660
+ * @returns A promise resolving to a list of episodes or an error.
661
+ * @throws Error if the ID is empty.
662
+ */
663
+ fetchEpisodes(id: string): Promise<IResponse<IAllAnimeEpisodes[] | []>>;
664
+ /**
665
+ * Fetches available servers for a specific episode.
666
+ * @param id - The episode ID in the format 'allanime-<showId>-episode-<episodeNumber>'.
667
+ * @param category - The translation type (sub, dub, or raw, default: 'sub').
668
+ * @returns A promise resolving to a list of servers or an error.
669
+ */
670
+ fetchServers(id: string, category?: ISubOrDub): Promise<IResponse<IMovieServers[] | []>>;
671
+ private fetchServersInternal;
672
+ private getReferer;
673
+ /**
674
+
675
+ * Fetches streaming sources for a given anime episode from a specified server and category.
676
+ * @param {string} episodeId - The unique identifier for the episode (required).
677
+ * @param {HISubOrDub} version - The audio category (Subtitled or Dubbed) (optional, defaults to SubOrDub.SUB).
678
+ * @param {string} server - The streaming server to use (optional, defaults to okru).
679
+ * @returns A promise that resolves to an object containing streaming sources, headers, or an error message.
680
+ */
681
+ fetchSources(episodeId: string, server?: AllAnimeServers, version?: ISubOrDub): Promise<ISourceBaseResponse<IVideoSource | null>>;
682
+ }
683
+
684
+ interface IAnizone extends IBase {
685
+ releaseDate: string | number | null;
686
+ status: string | null;
687
+ genres: string[] | null;
688
+ type: string | null;
689
+ }
690
+ interface IAnizoneInfo extends IAnizone {
691
+ coverImage: string | null;
692
+ synopsis: string | null;
693
+ totalEpisodes: number | null;
694
+ }
695
+ interface IAniZoneEpisodes extends IBaseEpisodes {
696
+ thumbnail: string | null;
697
+ teaser: string | null;
698
+ airDate: string | null;
699
+ title: string | null;
700
+ }
701
+ interface IAnizoneInfoResponse<T> extends IResponse<T> {
702
+ providerEpisodes: IAniZoneEpisodes[] | [];
703
+ }
704
+ interface IAnizoneUpdates<T> extends IResponse<T> {
705
+ recentlyAdded: IBase[] | [];
706
+ }
707
+
708
+ /**
709
+ * Anizone class for interacting with the Anizone anime streaming platform.
710
+ * Extends BaseClass to provide functionality for searching anime, fetching anime details,
711
+ * retrieving video sources for episodes, and fetching recent updates.
712
+ * @extends BaseClass
713
+ */
714
+ declare class Anizone extends BaseClass {
715
+ private readonly baseUrl;
716
+ constructor(baseUrl?: string);
717
+ /**
718
+ * Parses search results from the Anizone website to extract anime information.
719
+ * @private
720
+ * @param {cheerio.CheerioAPI} $ - Cheerio instance for parsing HTML.
721
+ * @returns {IResponse<IAnizone[] | []>} - An object containing an array of parsed anime data or an empty array.
722
+ */
723
+ private parseSearchResults;
724
+ /**
725
+ * Parses anime information and episode data from the Anizone anime page.
726
+ * @private
727
+ * @param {cheerio.CheerioAPI} $ - Cheerio instance for parsing HTML.
728
+ * @returns {IAnizoneInfoResponse<IAnizoneInfo | null>} - An object containing parsed anime info and episode data, or null if not found.
729
+ */
730
+ private parseAnimeinfo;
731
+ /**
732
+ * Parses video sources, subtitles, and other media data from an episode page.
733
+ * @private
734
+ * @param {cheerio.CheerioAPI} $ - Cheerio instance for parsing HTML.
735
+ * @returns - An object containing parsed video source data.
736
+ */
737
+ private parseSources;
738
+ /**
739
+ * Parses recent updates from the Anizone homepage, including recently added anime and latest episodes.
740
+ * @private
741
+ * @param {cheerio.CheerioAPI} $ - Cheerio instance for parsing HTML.
742
+ * @returns - An object containing arrays of recently added anime and latest episodes.
743
+ */
744
+ private parseUpdates;
745
+ private formatQuery;
746
+ /**
747
+ * Searches for anime on the Anizone platform using a query string.
748
+ * @param {string} query - The search query for finding anime.
749
+ * @returns - A promise resolving to an object containing search results or an error message.
750
+ */
751
+ search(query: string): Promise<IResponse<IAnizone[] | []>>;
752
+ /**
753
+ * Fetches recent updates from the Anizone homepage, including recently added anime and latest episodes.
754
+ * @returns - A promise resolving to an object containing arrays of recently added anime, latest episodes, or an error message.
755
+ */
756
+ fetchUpdates(): Promise<IAnizoneUpdates<IAniZoneEpisodes[] | []>>;
757
+ /**
758
+ * Fetches detailed information and episode list for a specific anime.
759
+ * @param {string} animeId - The unique identifier for the anime.
760
+ * @returns - A promise resolving to an object containing anime details and episodes or an error message.
761
+ */
762
+ fetchAnimeInfo(animeId: string): Promise<IAnizoneInfoResponse<IAnizoneInfo | null>>;
763
+ /**
764
+ * Fetches video sources and related metadata for a specific episode.
765
+ * @param {string} episodeId - The unique identifier for the episode.
766
+ * @returns {Promise<ISourceBaseResponse<IVideoSource | null>>} - A promise resolving to an object containing video sources, headers, or an error message.
767
+ */
768
+ fetchSources(episodeId: string): Promise<ISourceBaseResponse<IVideoSource | null>>;
769
+ }
770
+
771
+ interface IPaheAnime extends IBase {
772
+ score: number | null;
773
+ type: string | null;
774
+ releaseDate: number | null;
775
+ season: string | null;
776
+ totalEpisodes: number | null;
777
+ }
778
+ interface IPaheInfo extends IBase {
779
+ anilistId: number | null;
780
+ malId: number | null;
781
+ altnames: string | null;
782
+ japanese: string | null;
783
+ status: string | null;
784
+ score: string | null;
785
+ genres: string[] | null;
786
+ studios: string | null;
787
+ producers: string | null;
788
+ romaji: string | null;
789
+ episodes: {
790
+ sub: number | null;
791
+ dub: number | null;
792
+ };
793
+ totalEpisodes: number | null;
794
+ duration: string | null;
795
+ type: string | null;
796
+ synopsis: string | null;
797
+ releaseDate: string | null;
798
+ }
799
+ interface IPaheEpisodes extends IBaseEpisodes {
800
+ title: string | null;
801
+ thumbnail: string | null;
802
+ }
803
+ interface IPaheAnimeInfoResponse<T> extends IResponse<T> {
804
+ providerEpisodes: IPaheEpisodes[] | [];
805
+ }
806
+ interface IPaheServersResponse<T> extends IResponse<T> {
807
+ download: IServerInfo | null;
808
+ }
809
+ interface IPahePaginated<T> extends IBasePaginated<T> {
810
+ lastPage: number;
811
+ perPage: number;
812
+ totalResults: number;
813
+ }
814
+
815
+ /**
816
+ * A class for interacting with the Animepahe platform to search for anime, fetch detailed information,
817
+ * retrieve episode lists, get available streaming servers, and sources.
818
+ */
819
+ declare class Animepahe extends BaseClass {
820
+ private readonly baseUrl;
821
+ constructor(baseUrl?: string);
822
+ private headers;
823
+ /**
824
+ * Parses HTML content to extract detailed anime information.
825
+ * @private
826
+ * @param {cheerio.CheerioAPI} $ - The Cheerio API instance for parsing HTML.
827
+ * @param {string} animeId - The unique identifier for the anime.
828
+ * @returns {IPaheInfo} An object containing parsed anime information.
829
+ */
830
+ private parseAnimeInfo;
831
+ /**
832
+ * Parses HTML content to extract streaming server information for an episode.
833
+ * @private
834
+ * @param {cheerio.CheerioAPI} $ - The Cheerio API instance for parsing HTML.
835
+ * @returns {{servers: HIServerInfo; download: HIServerInfo}} An object containing streaming servers and download servers.
836
+ */
837
+ private parseServers;
838
+ /**
839
+ * Finds available server IDs for a specific audio category from the parsed server data.
840
+ * @private
841
+ * @param {IServerInfo} servers - The parsed streaming server information.
842
+ * @param {IServerInfo} download - The parsed download server information.
843
+ * @param {ISubOrDub} category - The audio category to filter servers for ('sub', 'dub', or 'raw').
844
+ * @returns {Array<{serverId: string; serverName: string; downloadId: string | null}>} An array of server objects with IDs and download information.
845
+ * @throws {Error} If no servers are available for the specified category.
846
+ */
847
+ private findServerIds;
848
+ /**
849
+ * Searches for anime based on the provided query string.
850
+ * @param {string} query - The search query string (required).
851
+ * @returns A promise that resolves to an object containing an array of anime titles, pagination details, or an error message.
852
+ */
853
+ search(query: string): Promise<IPahePaginated<IPaheAnime[] | []>>;
854
+ /**
855
+ * Fetches recently updated anime. Mostly those that are airing
856
+ * @param {number} [page] - The page number for pagination (optional, defaults to 1).
857
+ * @returns
858
+ */
859
+ fetchRecentEpisodes(page?: number): Promise<IPahePaginated<IPaheEpisodes[] | []>>;
860
+ /**
861
+ * Fetches detailed information about a specific anime including episodes.
862
+ * @param {string} animeId - The unique identifier for the anime (required).
863
+ * @returns A promise that resolves to an object containing anime details, or an error message.
864
+ */
865
+ fetchAnimeInfo(animeId: string): Promise<IPaheAnimeInfoResponse<IPaheInfo | null>>;
866
+ /**
867
+ * Fetches episode data for a specific anime.
868
+ * @param {string} animeId - The unique identifier for the anime (required).
869
+ * @returns A promise that resolves to an object containing an array of episode information or an error message.
870
+ */
871
+ fetchEpisodes(animeId: string): Promise<IResponse<IPaheEpisodes[] | []>>;
872
+ /**
873
+ * Fetches available streaming servers for a specific anime episode.
874
+ * @param {string} episodeId - The unique identifier for the episode (required).
875
+ * @returns A promise that resolves to an object containing available streaming server details (sub, dub, raw) or an error message.
876
+ */
877
+ fetchServers(episodeId: string): Promise<IPaheServersResponse<IServerInfo | null>>;
878
+ /**
879
+ * Fetches streaming sources for a given anime episode from a specified server and category.
880
+ * @param {string} episodeId - The unique identifier for the episode (required).
881
+ * @param {ISubOrDub} category - The audio category (Subtitled or Dubbed) (optional, defaults to SubOrDub.SUB).
882
+ * @returns A promise that resolves to an object containing streaming sources, headers, or an error message.
883
+ */
884
+ fetchSources(episodeId: string, category?: ISubOrDub): Promise<ISourceBaseResponse<IVideoSource | null>>;
885
+ }
886
+
887
+ interface IAKAnime extends IBase {
888
+ romaji: string | null;
889
+ type: string | null;
890
+ episodes: {
891
+ sub: number | null;
892
+ dub: number | null;
893
+ };
894
+ totalEpisodes: number | null;
895
+ }
896
+ interface IAKSlider extends IAKAnime {
897
+ synopsis: string | null;
898
+ quality: string | null;
899
+ releaseDate: string | null;
900
+ rating: string | null;
901
+ }
902
+ interface IAKEpisodes extends IBaseEpisodes {
903
+ title: string | null;
904
+ hasSub: boolean;
905
+ hasDub: boolean;
906
+ }
907
+ interface IAKRelatedSeasons {
908
+ id: string | null;
909
+ name: string | null;
910
+ season: string | null;
911
+ totalEpisodes: number | null;
912
+ seasonPoster: string | null;
913
+ }
914
+ interface IAKInfo extends IBase {
915
+ anilistId: number | null;
916
+ malId: number | null;
917
+ altnames: string | null;
918
+ japanese: string | null;
919
+ status: string | null;
920
+ score: string | null;
921
+ genres: string[] | null;
922
+ studios: string[] | null;
923
+ rating: string | null;
924
+ producers: string[] | null;
925
+ romaji: string | null;
926
+ episodes: {
927
+ sub: number | null;
928
+ dub: number | null;
929
+ };
930
+ totalEpisodes: number | null;
931
+ type: string | null;
932
+ synopsis: string | null;
933
+ releaseDate: string | null;
934
+ }
935
+ interface IAKPaginated<T> extends IBasePaginated<T> {
936
+ lastPage: number;
937
+ totalResults: number;
938
+ }
939
+ interface IAKHomeResponse<T> extends IHomeResSpecialPages {
940
+ recentlyUpdated: IAKAnime[];
941
+ recentlyCompleted: IAKAnime[];
942
+ recentlyAdded: IAKAnime[];
943
+ data: IAKAnime[];
944
+ trending: {
945
+ now: IAKAnime[];
946
+ daily: IAKAnime[];
947
+ weekly: IAKAnime[];
948
+ monthly: IAKAnime[];
949
+ };
950
+ upcoming: IAKAnime[];
951
+ }
952
+ interface IAKInfoResponse<T> extends IResponse<T> {
953
+ relatedSeasons: IAKRelatedSeasons[] | [];
954
+ recommendedAnime: IAKAnime[] | [];
955
+ relatedAnime: IAKAnime[] | [];
956
+ providerEpisodes: IAKEpisodes[] | [];
957
+ }
958
+
959
+ interface IMetaAnime {
960
+ malId: number;
961
+ anilistId?: number;
962
+ image: string;
963
+ color?: string;
964
+ bannerImage?: string;
965
+ title: {
966
+ romaji: string;
967
+ english: string;
968
+ native: string;
969
+ };
970
+ trailer: string;
971
+ format: string;
972
+ status: string;
973
+ synonyms?: string[];
974
+ country?: string;
975
+ year?: number;
976
+ duration: number;
977
+ score: number;
978
+ genres: string[];
979
+ episodes: number;
980
+ synopsis: string;
981
+ season: string;
982
+ releaseDate: string;
983
+ endDate: string;
984
+ studio: string;
985
+ producers: string[];
986
+ }
987
+ interface IMetaCharacters {
988
+ role: string;
989
+ id: number;
990
+ name: string;
991
+ image: string;
992
+ voiceActors: voiceActors[];
993
+ }
994
+ type voiceActors = {
995
+ name: string;
996
+ image: string;
997
+ language: string;
998
+ };
999
+ interface IAnilistCharacters {
1000
+ anilistId: number;
1001
+ malId: number;
1002
+ title: {
1003
+ romaji: string;
1004
+ english: string;
1005
+ native: string;
1006
+ };
1007
+ characters: IMetaCharacters[];
1008
+ }
1009
+ interface IRelatedAnilistData {
1010
+ anilistId: number;
1011
+ malId: number;
1012
+ title: {
1013
+ romaji: string;
1014
+ english: string;
1015
+ native: string;
1016
+ };
1017
+ type: string;
1018
+ score: number;
1019
+ image: string;
1020
+ bannerImage: string;
1021
+ color: string;
1022
+ synonyms: string[];
1023
+ country: string;
1024
+ year: number;
1025
+ }
1026
+ interface NextAiringEpisode {
1027
+ episode: number;
1028
+ id: number;
1029
+ airingAt: number;
1030
+ timeUntilAiring: number;
1031
+ }
1032
+ interface BaseAnimeSchedule {
1033
+ malId: number;
1034
+ anilistId: number;
1035
+ bannerImage: string;
1036
+ image: string;
1037
+ title: {
1038
+ romaji: string;
1039
+ english: string | null;
1040
+ native: string | null;
1041
+ };
1042
+ format: string;
1043
+ releaseDate: string;
1044
+ endDate: string;
1045
+ status: string;
1046
+ nextAiringEpisode: NextAiringEpisode | null;
1047
+ }
1048
+ interface MediaSchedule extends BaseAnimeSchedule {
1049
+ color: string;
1050
+ duration: number | null;
1051
+ }
1052
+ interface AiringSchedule extends BaseAnimeSchedule {
1053
+ popularity: number;
1054
+ score: number;
1055
+ genres: string[];
1056
+ episodes: number | null;
1057
+ synopsis: string;
1058
+ season: string | null;
1059
+ }
1060
+ type Provider = 'hianime' | 'allanime' | 'animepahe' | 'anizone' | 'animekai';
1061
+ declare const Seasons: readonly ["WINTER", "SPRING", "SUMMER", "FALL"];
1062
+ type Seasons = (typeof Seasons)[number];
1063
+ declare const JSort: readonly ["airing", "bypopularity", "upcoming", "favorite", "rating"];
1064
+ type JSort = (typeof JSort)[number];
1065
+ type IMetaFormat = 'TV' | 'MOVIE' | 'SPECIAL' | 'OVA' | 'ONA' | 'MUSIC';
1066
+ interface IMetaDataMap {
1067
+ native?: string;
1068
+ english?: string;
1069
+ romaji: string;
1070
+ type: string;
1071
+ season: string;
1072
+ year: number;
1073
+ episodes: number;
1074
+ }
1075
+ interface IMetaAnimePaginated<T> extends IBasePaginated<T> {
1076
+ lastPage: number;
1077
+ perPage: number;
1078
+ }
1079
+ interface IMetaProviderEpisodes {
1080
+ episodeNumber: number | null;
1081
+ rating: number | null;
1082
+ aired: boolean | null;
1083
+ episodeId: string | null;
1084
+ title: string | null;
1085
+ overview: string | null;
1086
+ thumbnail: string | null;
1087
+ provider: string | null;
1088
+ }
1089
+ interface IMetaProviderEpisodesResponse<T> extends IResponse<T> {
1090
+ providerEpisodes: IMetaProviderEpisodes[] | [];
1091
+ }
1092
+ interface IProviderId {
1093
+ id: string | null;
1094
+ name: string | null;
1095
+ native?: string | null;
1096
+ romaji: string | null;
1097
+ provider: string | null;
1098
+ score: number | null;
1099
+ }
1100
+ interface IMetaProviderIdResponse<T> extends IResponse<T> {
1101
+ provider: IProviderId | null;
1102
+ }
1103
+
1104
+ /**
1105
+ * A class for interacting with the AnimeKai Provider.
1106
+ *
1107
+ * It aims to search for anime, fetch detailed information, retrieve available streaming servers,
1108
+ * and obtain direct episode sources.
1109
+ */
1110
+ declare class Animekai extends BaseClass {
1111
+ constructor(baseUrl?: string);
1112
+ private readonly baseUrl;
1113
+ private readonly megaup;
1114
+ private readonly headers;
1115
+ /**
1116
+ * Scrapes anime data from recently added/upcoming/recently completed sections.
1117
+ * @private
1118
+ * @param $ - The Cheerio API instance for parsing HTML.
1119
+ * @param selector - CSS selector for the anime elements to scrape.
1120
+ * @returns An array of parsed anime objects.
1121
+ */
1122
+ private scrapeUpdates;
1123
+ /**
1124
+ * Scrapes trending anime cards from different time periods (now, daily, weekly, monthly).
1125
+ * @private
1126
+ * @param $ - The Cheerio API instance for parsing HTML.
1127
+ * @param selector - CSS selector for the trending anime elements.
1128
+ * @returns An array of parsed trending anime objects.
1129
+ */
1130
+ private scrapeTrendingCard;
1131
+ /**
1132
+ * Parses the homepage HTML to extract curated anime sections including featured, trending, and recently updated content.
1133
+ * @param {cheerio.CheerioAPI} $ - The Cheerio API instance for parsing HTML.
1134
+ * @returns An object containing various curated anime lists.
1135
+ */
1136
+ private parseHome;
1137
+ /**
1138
+ * Parses paginated anime search or category results from HTML.
1139
+ * @private
1140
+ * @param {cheerio.CheerioAPI} $ - The Cheerio API instance for parsing HTML.
1141
+ * @param {cheerio.SelectorType} selector - CSS selector for the anime items in the paginated results.
1142
+ * @returns An object containing paginated anime results with metadata.
1143
+ */
1144
+ private parsePaginated;
1145
+ /**
1146
+ * Parses related/recommended anime sections from the anime info page.
1147
+ * @private
1148
+ * @param {cheerio.CheerioAPI} $ - The Cheerio API instance for parsing HTML.
1149
+ * @param {cheerio.SelectorType} selector - CSS selector for the related/recommended anime elements.
1150
+ * @returns An array of parsed related or recommended anime objects.
1151
+ */
1152
+ private parseInfoSections;
1153
+ /**
1154
+ * Parses detailed anime information from the anime watch page.
1155
+ * @private
1156
+ * @param {cheerio.CheerioAPI} $ - The Cheerio API instance for parsing HTML.
1157
+ * @returns An object containing parsed anime info, rating data, related seasons, and recommendations.
1158
+ */
1159
+ private parseAnimeInfo;
1160
+ /**
1161
+ * Parses episode list from the AJAX endpoint response.
1162
+ * @private
1163
+ * @param {cheerio.CheerioAPI} $ - The Cheerio API instance for parsing HTML.
1164
+ * @param {string} animeId - The unique identifier for the anime.
1165
+ * @returns An array of parsed episode objects with language availability.
1166
+ */
1167
+ private parseEpisodes;
1168
+ /**
1169
+ * Parses server information from the episode links AJAX response.
1170
+ * @private
1171
+ * @param {cheerio.CheerioAPI} $ - The Cheerio API instance for parsing HTML.
1172
+ * @returns An object containing parsed server information.
1173
+ */
1174
+ private parseServers;
1175
+ /**
1176
+ * Extracts media IDs for a specific audio category from the server information.
1177
+ * @private
1178
+ * @param {IServerInfo} servers - The parsed server information object.
1179
+ * @param {ISubOrDub} category - The audio category to filter servers for ('sub', 'dub', or 'raw').
1180
+ * @param {string} server - The streaming server to use (optional, defaults to server-1).
1181
+ * @returns {string} A valid media ID for the specified category.
1182
+ * @throws {Error} If no servers or valid media IDs are found for the category.
1183
+ */
1184
+ private findServerIds;
1185
+ /**
1186
+ * Fetches curated lists from the Animekai homepage.
1187
+ * @returns Promise resolving to an object with various curated anime lists
1188
+ */
1189
+ fetchHome(): Promise<IAKHomeResponse<IAKSlider[] | []>>;
1190
+ /**
1191
+ * Fetches a list of anime by category.
1192
+ * @param { IAnimeCategory} category - The category of anime to fetch (MOVIE, TV, ONA, OVA, SPECIALS).
1193
+ * @param {number} [page=1] - The page number for pagination (default: 1).
1194
+ * @returns - Promise resolving to paginated anime results.
1195
+ */
1196
+ fetchAnimeCategory(category: IAnimeCategory, page?: number): Promise<IAKPaginated<IAKAnime[] | []>>;
1197
+ /**
1198
+ * Searches for anime titles based on the provided query string.
1199
+ * @param {string} query - The search query string (required).
1200
+ * @param {number} [page] - The page number for pagination (optional, defaults to 1).
1201
+ * @returns A promise that resolves to an object containing an array of anime results related to the search query.
1202
+ */
1203
+ search(query: string, page?: number): Promise<IAKPaginated<IAKAnime[] | []>>;
1204
+ /**
1205
+ * Fetches a paginated list of recently added anime.
1206
+ * @param {IMetaFormat} category - The format which to fetch anime (optional, defaults to TV)
1207
+ * @param {number} page - Page number for pagination (default: 1)
1208
+ * @returns Promise resolving to an object with recently added anime and pagination details
1209
+ */
1210
+ fetchRecentlyAdded(category: IMetaFormat, page?: number): Promise<IAKPaginated<IAKAnime[] | []>>;
1211
+ /**
1212
+ * Fetches a paginated list of recently added anime.
1213
+ * @param {IMetaFormat} category - The format which to fetch anime (optional, defaults to TV)
1214
+ * @param {number} page - Page number for pagination (default: 1)
1215
+ * @returns Promise resolving to an object with top airing anime and pagination details
1216
+ */
1217
+ fetchTopAiring(category?: IMetaFormat, page?: number): Promise<IAKPaginated<IAKAnime[] | []>>;
1218
+ /**
1219
+ * Fetches a paginated list of recently updated anime.
1220
+ * @param {IMetaFormat} category - The format which to fetch anime (optional, defaults to TV)
1221
+ * @param {number} page - Page number for pagination (default: 1)
1222
+ * @returns Promise resolving to an object with recently updated anime and pagination details
1223
+ */
1224
+ fetchRecentlyUpdated(category?: IMetaFormat, page?: number): Promise<IAKPaginated<IAKAnime[] | []>>;
1225
+ /**
1226
+ * Fetches a paginated list of recently completed anime.
1227
+ * @param {IMetaFormat} category - The format which to fetch anime (optional, defaults to TV)
1228
+ * @param {number} page - Page number for pagination (default: 1)
1229
+ * @returns Promise resolving to an object with recently completed anime and pagination details
1230
+ */
1231
+ fetchRecentlyCompleted(category?: IMetaFormat, page?: number): Promise<IAKPaginated<IAKAnime[] | []>>;
1232
+ /**
1233
+ * Fetches a paginated list of genre curated anime.
1234
+ * @param {AKGenre} genre - The genre which to fetch anime (required)
1235
+ * @param {number} page - Page number for pagination (default: 1)
1236
+ * @returns Promise resolving to an object with anime curated by genre and pagination details
1237
+ */
1238
+ fetchGenres(genre: string, page?: number): Promise<IAKPaginated<IAKAnime[] | []>>;
1239
+ /**
1240
+ * Fetches detailed information about a specific anime.
1241
+ * @param {string} animeId - The unique identifier for the anime (required).
1242
+ * @returns A promise that resolves to an object containing anime details, related seasons provider episodeslists ,recommendations, or an error message.
1243
+ */
1244
+ fetchAnimeInfo(animeId: string): Promise<IAKInfoResponse<IAKInfo | null>>;
1245
+ /**
1246
+ * Fetches server information for a specific episode using the token-based AJAX endpoint.
1247
+ * @private
1248
+ * @param {string} episodeId - The unique identifier for the episode containing the token.
1249
+ * @returns {Promise<IResponse<IServerInfo | null>>} A promise resolving to server information or an error.
1250
+ * @throws {Error} If the episodeId is missing or has invalid format.
1251
+ */
1252
+ fetchServers(episodeId: string): Promise<IResponse<IServerInfo | null>>;
1253
+ /**
1254
+ * **⚠️ . Very unstable
1255
+ * Fetches streaming sources for a given anime episode from a specified server and category.
1256
+ * @param {string} episodeId - The unique identifier for the episode (required).
1257
+ * @param {HISubOrDub} category - The audio category (Subtitled or Dubbed) (optional, defaults to SubOrDub.SUB).
1258
+ * @param {string} server - The streaming server to use (optional, defaults to server-1).
1259
+ * @returns A promise that resolves to an object containing streaming sources, headers, sync data (AniList/MAL IDs), or an error message.
1260
+ */
1261
+ fetchSources(episodeId: string, category?: ISubOrDub, server?: 'server-1' | 'server-2'): Promise<ISourceBaseResponse<IVideoSource | null>>;
1262
+ }
1263
+
1264
+ type AnimeSearchResults = {
1265
+ id: string | null;
1266
+ name: string | null;
1267
+ romaji?: string | null;
1268
+ provider?: string | null;
1269
+ type?: string | null;
1270
+ native?: string | null;
1271
+ season?: string | null;
1272
+ totalEpisodes?: number | null;
1273
+ releaseDate?: number | string | null;
1274
+ };
1275
+ declare abstract class BaseAnimeMeta {
1276
+ protected client: FetchClient;
1277
+ protected allanime: AllAnime;
1278
+ protected animekai: Animekai;
1279
+ protected anizone: Anizone;
1280
+ protected hianime: HiAnime;
1281
+ protected animepahe: Animepahe;
1282
+ constructor(provider: 'jikan' | 'anilist');
1283
+ /**
1284
+ * Extract year from ISO date string (YYYY-MM-DD format)
1285
+ * Handles both full dates and partial years
1286
+ * @param dateString - Full date like "2018-10-16" or just "2018"
1287
+ * @returns Year as number or null if invalid
1288
+ */
1289
+ private extractYear;
1290
+ protected createTitleSlug(text: string): string;
1291
+ protected createTitleSlugV2(text: string): string;
1292
+ protected mapAnimeProviderId(metadata: IMetaDataMap | null, results: AnimeSearchResults[] | null, provider: Provider): {
1293
+ id: string;
1294
+ name: string | null;
1295
+ romaji: string | null;
1296
+ provider: Provider;
1297
+ score: number;
1298
+ } | null;
1299
+ protected formatAnizipData(data: any): {
1300
+ animeTitles: {};
1301
+ mappings: {};
1302
+ episodes: never[];
1303
+ images?: undefined;
1304
+ titles?: undefined;
1305
+ } | {
1306
+ images: any;
1307
+ titles: {
1308
+ english: any;
1309
+ japanese: any;
1310
+ german: any;
1311
+ romanized: any;
1312
+ traditionalChinese: any;
1313
+ simplifiedChinese: any;
1314
+ };
1315
+ mappings: {
1316
+ animePlanetId: any;
1317
+ kitsuId: any;
1318
+ malId: any;
1319
+ anilistId: any;
1320
+ anisearchId: any;
1321
+ anidbId: any;
1322
+ notifymoeId: any;
1323
+ livechartId: any;
1324
+ imdbId: any;
1325
+ themoviedbId: any;
1326
+ };
1327
+ episodes: {
1328
+ episodeAnizipNumber: number | null;
1329
+ title: {
1330
+ english: any;
1331
+ japanese: any;
1332
+ german: any;
1333
+ romanizedJapanese: any;
1334
+ };
1335
+ airDate: any;
1336
+ runtime: any;
1337
+ overview: any;
1338
+ image: any;
1339
+ rating: any;
1340
+ aired: boolean;
1341
+ }[];
1342
+ animeTitles?: undefined;
1343
+ };
1344
+ protected anilistAnizip(id: number): Promise<{
1345
+ error: string;
1346
+ data: null;
1347
+ images?: undefined;
1348
+ titles?: undefined;
1349
+ episodes?: undefined;
1350
+ mapping?: undefined;
1351
+ } | {
1352
+ images: any;
1353
+ titles: {
1354
+ english: any;
1355
+ japanese: any;
1356
+ german: any;
1357
+ romanized: any;
1358
+ traditionalChinese: any;
1359
+ simplifiedChinese: any;
1360
+ } | undefined;
1361
+ episodes: never[] | {
1362
+ episodeAnizipNumber: number | null;
1363
+ title: {
1364
+ english: any;
1365
+ japanese: any;
1366
+ german: any;
1367
+ romanizedJapanese: any;
1368
+ };
1369
+ airDate: any;
1370
+ runtime: any;
1371
+ overview: any;
1372
+ image: any;
1373
+ rating: any;
1374
+ aired: boolean;
1375
+ }[];
1376
+ mapping: {
1377
+ animePlanetId: any;
1378
+ kitsuId: any;
1379
+ malId: any;
1380
+ anilistId: any;
1381
+ anisearchId: any;
1382
+ anidbId: any;
1383
+ notifymoeId: any;
1384
+ livechartId: any;
1385
+ imdbId: any;
1386
+ themoviedbId: any;
1387
+ } | {};
1388
+ error?: undefined;
1389
+ data?: undefined;
1390
+ }>;
1391
+ protected malAnizip(id: number): Promise<{
1392
+ error: string;
1393
+ data: null;
1394
+ images?: undefined;
1395
+ titles?: undefined;
1396
+ episodes?: undefined;
1397
+ mapping?: undefined;
1398
+ } | {
1399
+ images: any;
1400
+ titles: {
1401
+ english: any;
1402
+ japanese: any;
1403
+ german: any;
1404
+ romanized: any;
1405
+ traditionalChinese: any;
1406
+ simplifiedChinese: any;
1407
+ } | undefined;
1408
+ episodes: never[] | {
1409
+ episodeAnizipNumber: number | null;
1410
+ title: {
1411
+ english: any;
1412
+ japanese: any;
1413
+ german: any;
1414
+ romanizedJapanese: any;
1415
+ };
1416
+ airDate: any;
1417
+ runtime: any;
1418
+ overview: any;
1419
+ image: any;
1420
+ rating: any;
1421
+ aired: boolean;
1422
+ }[];
1423
+ mapping: {
1424
+ animePlanetId: any;
1425
+ kitsuId: any;
1426
+ malId: any;
1427
+ anilistId: any;
1428
+ anisearchId: any;
1429
+ anidbId: any;
1430
+ notifymoeId: any;
1431
+ livechartId: any;
1432
+ imdbId: any;
1433
+ themoviedbId: any;
1434
+ } | {};
1435
+ error?: undefined;
1436
+ data?: undefined;
1437
+ }>;
1438
+ protected mergeEpisodeData(providerEp: any, aniZipEp: any, provider: string): {
1439
+ episodeNumber: any;
1440
+ episodeId: any;
1441
+ title: any;
1442
+ rating: any;
1443
+ aired: any;
1444
+ airDate: any;
1445
+ overview: any;
1446
+ thumbnail: any;
1447
+ provider: string;
1448
+ hasDub: any;
1449
+ hasSub: any;
1450
+ };
1451
+ protected fetchAnizipByMapping(type: 'anilist_id' | 'mal_id', id: number): Promise<{
1452
+ error: string;
1453
+ data: null;
1454
+ images?: undefined;
1455
+ titles?: undefined;
1456
+ episodes?: undefined;
1457
+ mapping?: undefined;
1458
+ } | {
1459
+ images: any;
1460
+ titles: {
1461
+ english: any;
1462
+ japanese: any;
1463
+ german: any;
1464
+ romanized: any;
1465
+ traditionalChinese: any;
1466
+ simplifiedChinese: any;
1467
+ } | undefined;
1468
+ episodes: never[] | {
1469
+ episodeAnizipNumber: number | null;
1470
+ title: {
1471
+ english: any;
1472
+ japanese: any;
1473
+ german: any;
1474
+ romanizedJapanese: any;
1475
+ };
1476
+ airDate: any;
1477
+ runtime: any;
1478
+ overview: any;
1479
+ image: any;
1480
+ rating: any;
1481
+ aired: boolean;
1482
+ }[];
1483
+ mapping: {
1484
+ animePlanetId: any;
1485
+ kitsuId: any;
1486
+ malId: any;
1487
+ anilistId: any;
1488
+ anisearchId: any;
1489
+ anidbId: any;
1490
+ notifymoeId: any;
1491
+ livechartId: any;
1492
+ imdbId: any;
1493
+ themoviedbId: any;
1494
+ } | {};
1495
+ error?: undefined;
1496
+ data?: undefined;
1497
+ }>;
1498
+ }
1499
+
1500
+ /**
1501
+ * A class for interacting with the Anilist API to search for anime, fetch detailed information,
1502
+ * retrieve various lists (trending, popular, top-rated, seasonal, upcoming), and get character
1503
+ * and episode information from specific providers.
1504
+ *
1505
+ *
1506
+ */
1507
+ declare class Anilist extends BaseAnimeMeta {
1508
+ constructor();
1509
+ private readonly baseUrl;
1510
+ private readonly mappingUrl;
1511
+ /**
1512
+ * Maps Anilist anime data to HiAnime (Zoro) provider ID.
1513
+ *
1514
+ * @private
1515
+ * @param anilistId - The Anilist ID of the anime
1516
+ * @returns Promise resolving to provider mapping data
1517
+ */
1518
+ fetchZoroProviderId(anilistId: number): Promise<IMetaProviderIdResponse<IMetaAnime | null>>;
1519
+ /**
1520
+ * Maps Anilist anime data to Anizone provider ID.
1521
+ *
1522
+ * @private
1523
+ * @param anilistId - The Anilist ID of the anime
1524
+ * @returns Promise resolving to provider mapping data
1525
+ */
1526
+ fetchAnizoneProviderId(anilistId: number): Promise<IMetaProviderIdResponse<IMetaAnime | null>>;
1527
+ /**
1528
+ * Maps Anilist anime data to AllAnime provider ID.
1529
+ *
1530
+ * @private
1531
+ * @param anilistId - The Anilist ID of the anime
1532
+ * @returns Promise resolving to provider mapping data
1533
+ */
1534
+ fetchAllAnimeProviderId(anilistId: number): Promise<IMetaProviderIdResponse<IMetaAnime | null>>;
1535
+ /**
1536
+ * Maps Anilist anime data to AnimePahe provider ID.
1537
+ *
1538
+ * @private
1539
+ * @param anilistId - The Anilist ID of the anime
1540
+ * @returns Promise resolving to provider mapping data
1541
+ */
1542
+ fetchAnimepaheProviderId(anilistId: number): Promise<IMetaProviderIdResponse<IMetaAnime | null>>;
1543
+ /**
1544
+ * Maps Anilist anime data to AnimeKai provider ID.
1545
+ *
1546
+ * @private
1547
+ * @param anilistId - The Anilist ID of the anime
1548
+ * @returns Promise resolving to provider mapping data
1549
+ */
1550
+ fetchAnimeKaiProviderId(anilistId: number): Promise<IMetaProviderIdResponse<IMetaAnime | null>>;
1551
+ /**
1552
+ * Fetches episodes from AllAnime provider and enriches with Anizip data.
1553
+ *
1554
+ * @private
1555
+ * @param anilistId - The Anilist ID of the anime
1556
+ * @returns Promise resolving to episode data enriched with additional metadata
1557
+ */
1558
+ fetchAllAnimeProviderEpisodes(anilistId: number): Promise<IMetaProviderEpisodesResponse<IMetaAnime | null>>;
1559
+ /**
1560
+ * Fetches episodes from AllAnime provider and enriches with Anizip data.
1561
+ *
1562
+ * @private
1563
+ * @param anilistId - The Anilist ID of the anime
1564
+ * @returns Promise resolving to episode data enriched with additional metadata
1565
+ */
1566
+ fetchAnizoneProviderEpisodes(anilistId: number): Promise<IMetaProviderEpisodesResponse<IMetaAnime | null>>;
1567
+ /**
1568
+ * Fetches episodes from HiAnime (Zoro) provider and enriches with Anizip data.
1569
+ *
1570
+ * @private
1571
+ * @param anilistId - The Anilist ID of the anime
1572
+ * @returns Promise resolving to episode data enriched with additional metadata
1573
+ */
1574
+ fetchZoroProviderEpisodes(anilistId: number): Promise<IMetaProviderEpisodesResponse<IMetaAnime | null>>;
1575
+ /**
1576
+ * Fetches episodes from Animekai provider and enriches with Anizip data.
1577
+ *
1578
+ *
1579
+ * @param anilistId - The Anilist ID of the anime
1580
+ * @returns Promise resolving to episode data enriched with additional metadata
1581
+ */
1582
+ fetchAnimeKaiProviderEpisodes(anilistId: number): Promise<IMetaProviderEpisodesResponse<IMetaAnime | null>>;
1583
+ /**
1584
+ * Fetches episodes from AnimePahe provider and enriches with Anizip data.
1585
+ *
1586
+ *
1587
+ * @param anilistId - The Anilist ID of the anime
1588
+ * @returns Promise resolving to episode data enriched with additional metadata
1589
+ */
1590
+ fetchAnimePaheProviderEpisodes(anilistId: number): Promise<IMetaProviderEpisodesResponse<IMetaAnime | null>>;
1591
+ /**
1592
+ * Searches for anime based on the provided query string.
1593
+ *
1594
+ * @param search - The search query string (required)
1595
+ * @param page - The page number for pagination (optional, defaults to 1)
1596
+ * @param perPage - The number of results per page (optional, defaults to 20)
1597
+ * @returns Promise that resolves to paginated search results containing anime data
1598
+ */
1599
+ search(search: string, page?: number, perPage?: number): Promise<IMetaAnimePaginated<IMetaAnime[] | []>>;
1600
+ /**
1601
+ * Fetches detailed information about a specific anime using its Anilist ID.
1602
+ *
1603
+ * @param id - The unique Anilist anime ID (required)
1604
+ * @returns Promise that resolves to detailed anime information
1605
+ */
1606
+ fetchInfo(id: number): Promise<IResponse<IMetaAnime | null>>;
1607
+ /**
1608
+ * Fetches a list of the most anticipated upcoming anime.
1609
+ *
1610
+ * @param page - The page number for pagination (optional, defaults to 1)
1611
+ * @param perPage - The number of results per page (optional, defaults to 20)
1612
+ * @param sort - The sorting order for results (optional, defaults to POPULARITY_DESC)
1613
+ * @returns Promise that resolves to paginated list of upcoming anime
1614
+ */
1615
+ fetchTopUpcoming(page?: number, perPage?: number, sort?: 'SCORE_DESC' | 'POPULARITY_DESC', status?: 'NOT_YET_RELEASED' | 'RELEASING'): Promise<IMetaAnimePaginated<IMetaAnime[] | []>>;
1616
+ /**
1617
+ * Fetches a list of the top airing anime.
1618
+ *
1619
+ * @param page - The page number for pagination (optional, defaults to 1)
1620
+ * @param perPage - The number of results per page (optional, defaults to 20)
1621
+ * @param sort - The sorting order for results (optional, defaults to POPULARITY_DESC)
1622
+ * @returns Promise that resolves to paginated list of airing anime
1623
+ */
1624
+ fetchTopAiring(page?: number, perPage?: number, sort?: 'SCORE_DESC' | 'POPULARITY_DESC', status?: 'NOT_YET_RELEASED' | 'RELEASING'): Promise<IMetaAnimePaginated<IMetaAnime[] | []>>;
1625
+ /**
1626
+ * Fetches a list of the most popular anime.
1627
+ *
1628
+ * @param page - The page number for pagination (optional, defaults to 1)
1629
+ * @param perPage - The number of results per page (optional, defaults to 20)
1630
+ * @param format - The anime format to filter by (optional, defaults to TV)
1631
+ * @returns Promise that resolves to paginated list of popular anime
1632
+ */
1633
+ fetchMostPopular(page?: number, perPage?: number, format?: IMetaFormat, sort?: 'SCORE_DESC' | 'POPULARITY_DESC'): Promise<IMetaAnimePaginated<IMetaAnime[] | []>>;
1634
+ /**
1635
+ * Fetches a list of the top-rated anime.
1636
+ *
1637
+ * @param page - The page number for pagination (optional, defaults to 1)
1638
+ * @param perPage - The number of results per page (optional, defaults to 20)
1639
+ * @param format - The anime format to filter by (optional, defaults to TV)
1640
+
1641
+ * @returns Promise that resolves to paginated list of top-rated anime
1642
+ */
1643
+ fetchTopRatedAnime(page?: number, perPage?: number, format?: IMetaFormat, sort?: 'SCORE_DESC' | 'POPULARITY_DESC'): Promise<IMetaAnimePaginated<IMetaAnime[] | []>>;
1644
+ /**
1645
+ * Fetches seasonal anime for a given year and season.
1646
+ *
1647
+ * @param season - The target season (e.g., WINTER, SPRING, SUMMER, FALL) (required)
1648
+ * @param seasonYear - The target year (e.g., 2023, 2024) (required)
1649
+ * @param page - The page number for pagination (optional, defaults to 1)
1650
+ * @param perPage - The number of results per page (optional, defaults to 20)
1651
+ * @param format - The anime format to filter by (optional, defaults to TV)
1652
+ * @returns Promise that resolves to paginated list of seasonal anime
1653
+ */
1654
+ fetchSeasonalAnime(season: Seasons, seasonYear: number, page?: number, perPage?: number, format?: IMetaFormat): Promise<IMetaAnimePaginated<IMetaAnime[] | []>>;
1655
+ /**
1656
+ * Fetches a list of currently trending anime.
1657
+ *
1658
+ * @param page - The page number for pagination (optional, defaults to 1)
1659
+ * @param perPage - The number of results per page (optional, defaults to 20)
1660
+ * @returns Promise that resolves to paginated list of trending anime
1661
+ */
1662
+ fetchTrending(page?: number, perPage?: number): Promise<IMetaAnimePaginated<IMetaAnime[] | []>>;
1663
+ /**
1664
+ * Fetches anime titles related to a specific anime ID, such as sequels, prequels, or spin-offs.
1665
+ *
1666
+ * @param mediaId - The unique Anilist anime ID (required)
1667
+ * @returns Promise that resolves to related anime information
1668
+ */
1669
+ fetchRelatedAnime(mediaId: number): Promise<IResponse<IRelatedAnilistData[] | []>>;
1670
+ /**
1671
+ * Fetches characters associated with a specific anime.
1672
+ *
1673
+ * @param mediaId - The unique Anilist anime ID (required)
1674
+ * @returns Promise that resolves to anime characters and their voice actors
1675
+ */
1676
+ fetchCharacters(mediaId: number): Promise<IResponse<IAnilistCharacters | null>>;
1677
+ /**
1678
+ * Fetches the airing schedule for a specific anime by its Anilist ID.
1679
+ *
1680
+ * @param {number} mediaId - The unique Anilist anime ID (required).
1681
+ * @returns A promise that resolves to an object containing the airing schedule data or an error.
1682
+ * **/
1683
+ fetchMediaSchedule(mediaId: number): Promise<IResponse<MediaSchedule | null>>;
1684
+ /**
1685
+ * Fetches a paginated list of airing schedules for anime with a minimum score.
1686
+ *
1687
+ * @param {number} page - The page number to fetch (deafault=1).
1688
+ * @param {number} [score=60] - The minimum average or mean score for filtering anime (default: 60).If you have bad taste you can lower this
1689
+ * **/
1690
+ fetchAiringSchedule(page?: number, score?: number): Promise<IBasePaginated<AiringSchedule[] | []>>;
1691
+ }
1692
+
1693
+ /**
1694
+ * A class for interacting with the Jikan API (MyAnimeList unofficial API) to search for anime,
1695
+ * fetch detailed information, retrieve various top lists (airing, movies, popular, upcoming),
1696
+ * seasonal anime, character details, and episode information from MyAnimeList.
1697
+ *
1698
+ *
1699
+ */
1700
+ declare class Jikan extends BaseAnimeMeta {
1701
+ constructor();
1702
+ /** Base URL for the Jikan API (MyAnimeList unofficial API) */
1703
+ private readonly baseUrl;
1704
+ /**
1705
+ * Maps MyAnimeList anime data to Zoro provider ID.
1706
+ *
1707
+ * @private
1708
+ * @param malId - The MyAnimeList ID of the anime
1709
+ * @returns Promise resolving to provider mapping data
1710
+ */
1711
+ private fetchZoroProviderId;
1712
+ /**
1713
+ * Maps MyAnimeList anime data to Animekai provider ID.
1714
+ *
1715
+ * @private
1716
+ * @param malId - The MyAnimeList ID of the anime
1717
+ * @returns Promise resolving to provider mapping data
1718
+ */
1719
+ private fetchAnimekaiProviderId;
1720
+ /**
1721
+ * Maps MyAnimeList anime data to Anizone provider ID.
1722
+ *
1723
+ * @private
1724
+ * @param malId - The MyAnimeList ID of the anime
1725
+ * @returns Promise resolving to provider mapping data
1726
+ */
1727
+ private fetchAnizoneProviderId;
1728
+ /**
1729
+ * Maps MyAnimeList anime data to AllAnime provider ID.
1730
+ *
1731
+ * @private
1732
+ * @param malId - The MyAnimeList ID of the anime
1733
+ * @returns Promise resolving to provider mapping data
1734
+ */
1735
+ private fetchAllAnimeProviderId;
1736
+ /**
1737
+ * Maps MyAnimeList anime data to AnimePahe provider ID.
1738
+ *
1739
+ * @private
1740
+ * @param malId - The MyAnimeList ID of the anime
1741
+ * @returns Promise resolving to provider mapping data
1742
+ */
1743
+ private fetchAnimepaheProviderId;
1744
+ /**
1745
+ * Fetches episodes from AllAnime provider and enriches with Anizip data for a given MAL ID.
1746
+ *
1747
+ * @private
1748
+ * @param malId - The MyAnimeList ID of the anime
1749
+ * @returns Promise resolving to episode data enriched with additional metadata
1750
+ */
1751
+ private fetchAllAnimeProviderEpisodes;
1752
+ /**
1753
+ * Fetches episodes from AllAnime provider and enriches with Anizip data for a given MAL ID.
1754
+ *
1755
+ * @private
1756
+ * @param malId - The MyAnimeList ID of the anime
1757
+ * @returns Promise resolving to episode data enriched with additional metadata
1758
+ */
1759
+ private fetchAnizoneProviderEpisodes;
1760
+ /**
1761
+ * Fetches episodes from HiAnime (Zoro) provider and enriches with Anizip data for a given MAL ID.
1762
+ *
1763
+ * @private
1764
+ * @param malId - The MyAnimeList ID of the anime
1765
+ * @returns Promise resolving to episode data enriched with additional metadata
1766
+ */
1767
+ private fetchZoroProviderEpisodes;
1768
+ /**
1769
+ * Fetches episodes from Animekai provider and enriches with Anizip data for a given MAL ID.
1770
+ *
1771
+ * @private
1772
+ * @param malId - The MyAnimeList ID of the anime
1773
+ * @returns Promise resolving to episode data enriched with additional metadata
1774
+ */
1775
+ private fetchAnimekaiProviderEpisodes;
1776
+ /**
1777
+ * Fetches episodes from AnimePahe provider and enriches with Anizip data for a given MAL ID.
1778
+ *
1779
+ * @private
1780
+ * @param malId - The MyAnimeList ID of the anime
1781
+ * @returns Promise resolving to episode data enriched with additional metadata
1782
+ */
1783
+ private fetchPaheProviderEpisodes;
1784
+ /**
1785
+ * Searches for anime titles based on the provided query string using Jikan API.
1786
+ *
1787
+ * @param query - The search query string (required)
1788
+ * @param page - The page number for pagination (optional, defaults to 1)
1789
+ * @param perPage - The number of results per page (optional, defaults to 20, maximum 25)
1790
+ * @returns Promise that resolves to paginated search results containing anime data
1791
+ */
1792
+ search(query: string, page?: number, perPage?: number): Promise<IMetaAnimePaginated<IMetaAnime[] | []>>;
1793
+ /**
1794
+ * Fetches detailed information about a specific anime using its MyAnimeList (MAL) ID.
1795
+ *
1796
+ * @param malId - The unique MyAnimeList (MAL) ID for the anime (required)
1797
+ * @returns Promise that resolves to comprehensive detailed anime information
1798
+ */
1799
+ fetchInfo(malId: number): Promise<IResponse<IMetaAnime | null>>;
1800
+ /**
1801
+ * Fetches characters associated with a specific anime from MyAnimeList.
1802
+ *
1803
+ * @param malId - The unique MyAnimeList (MAL) ID for the anime (required)
1804
+ * @returns Promise that resolves to anime characters with voice actor information
1805
+ */
1806
+ fetchAnimeCharacters(malId: number): Promise<IResponse<IMetaCharacters[] | []>>;
1807
+ /**
1808
+ * Fetches the anime list for the current season from MyAnimeList.
1809
+ *
1810
+ * @param page - The page number for pagination (required)
1811
+ * @param perPage - The number of results per page (required, maximum 25)
1812
+ * @param format - The format type to filter by (optional, defaults to TV)
1813
+ * @returns Promise that resolves to paginated list of current seasonal anime
1814
+ */
1815
+ fetchCurrentSeason(page?: number, perPage?: number, format?: IMetaFormat): Promise<IMetaAnimePaginated<IMetaAnime[] | []>>;
1816
+ /**
1817
+ * Fetches the anime list for the upcoming season from MyAnimeList.
1818
+ *
1819
+ * @param page - The page number for pagination (optional, defaults to 1)
1820
+ * @param perPage - The number of results per page (optional, defaults to 20, maximum 25)
1821
+ * @param format - The format type to filter by (optional, defaults to TV)
1822
+ * @returns Promise that resolves to paginated list of upcoming season's anime
1823
+ */
1824
+ fetchNextSeason(page?: number, perPage?: number, format?: IMetaFormat): Promise<IMetaAnimePaginated<IMetaAnime[] | []>>;
1825
+ /**
1826
+ * Fetches seasonal anime for a given year and season from MyAnimeList.
1827
+ *
1828
+ * @param season - The target season (e.g., WINTER, SPRING, SUMMER, FALL) (required)
1829
+ * @param year - The target year (e.g., 2023, 2024) (required)
1830
+ * @param format - The anime format to filter by (optional, defaults to TV)
1831
+ * @param page - The page number for pagination (optional, defaults to 1)
1832
+ * @param perPage - The number of results per page (optional, defaults to 20, maximum 25)
1833
+ * @returns Promise that resolves to paginated list of seasonal anime
1834
+ */
1835
+ fetchSeasonalAnime(season: Seasons, year: number, format?: IMetaFormat, page?: number, perPage?: number): Promise<IMetaAnimePaginated<IMetaAnime[] | []>>;
1836
+ /**
1837
+ * Fetches a list of the top-rated anime from MyAnimeList.
1838
+ *
1839
+ * @param page - The page number for pagination (optional, defaults to 1)
1840
+ * @param perPage - The number of results per page (optional, defaults to 20)
1841
+ * @param format - The anime format to filter by (optional, defaults to TV)
1842
+ * @param sort - The sorting criteria (optional, defaults to 'rating')
1843
+ * @returns Promise that resolves to paginated list of top-rated anime
1844
+ */
1845
+ fetchTopAnime(page?: number, perPage?: number, format?: IMetaFormat, sort?: JSort): Promise<IMetaAnimePaginated<IMetaAnime[] | []>>;
1846
+ /**
1847
+ * Fetches a list of the top airing anime from MyAnimeList.
1848
+ *
1849
+ * @param page - The page number for pagination (optional, defaults to 1)
1850
+ * @param perPage - The number of results per page (optional, defaults to 20, maximum 25)
1851
+ * @param format - The format type to filter by (optional, defaults to TV)
1852
+ * @returns Promise that resolves to paginated list of top airing anime
1853
+ */
1854
+ fetchTopAiring(page?: number, perPage?: number, format?: IMetaFormat, sort?: JSort): Promise<IMetaAnimePaginated<IMetaAnime[] | []>>;
1855
+ /**
1856
+ * Fetches a list of the most anticipated upcoming anime from MyAnimeList.
1857
+ *
1858
+ * @param page - The page number for pagination (optional, defaults to 1)
1859
+ * @param perPage - The number of results per page (optional, defaults to 20, maximum 25)
1860
+ * @param format - The format type to filter by (optional, defaults to TV)
1861
+ * @returns Promise that resolves to paginated list of upcoming anime resources
1862
+ */
1863
+ fetchTopUpcoming(page?: number, perPage?: number, format?: IMetaFormat, sort?: JSort): Promise<IMetaAnimePaginated<IMetaAnime[] | []>>;
1864
+ /**
1865
+ * Fetches a list of the most popular anime from MyAnimeList.
1866
+ *
1867
+ * @param page - The page number for pagination (optional, defaults to 1)
1868
+ * @param perPage - The number of results per page (optional, defaults to 20, maximum 25)
1869
+ * @param format - The format type to filter by (optional, defaults to TV)
1870
+ * @param sort - The sorting criteria (optional, defaults to 'bypopularity')
1871
+ * @returns Promise that resolves to paginated list of most popular anime
1872
+ */
1873
+ fetchMostPopular(page?: number, perPage?: number, format?: IMetaFormat, sort?: JSort): Promise<IMetaAnimePaginated<IMetaAnime[] | []>>;
1874
+ /**
1875
+ * Fetches a list of the most favorite anime from MyAnimeList.
1876
+ *
1877
+ * @param page - The page number for pagination (optional, defaults to 1)
1878
+ * @param perPage - The number of results per page (optional, defaults to 20, maximum 25)
1879
+ * @param format - The format type to filter by (optional, defaults to TV)
1880
+ * @param sort - The sorting criteria (optional, defaults to 'bypopularity')
1881
+ * @returns Promise that resolves to paginated list of most favorite anime
1882
+ */
1883
+ fetchMostFavorite(page?: number, perPage?: number, format?: IMetaFormat, sort?: JSort): Promise<IMetaAnimePaginated<IMetaAnime[] | []>>;
1884
+ /**
1885
+ * Fetches anime information along with a provider-specific anime ID for MyAnimeList entries.
1886
+ *
1887
+ * @param malId - The unique MyAnimeList anime ID (required)
1888
+ * @param provider - The anime provider to fetch data from (optional, defaults to HiAnime)
1889
+ * @returns Promise that resolves to provider-specific anime ID and core anime info
1890
+ */
1891
+ fetchProviderId(malId: number, provider?: 'hianime' | 'allanime' | 'animepahe' | 'anizone' | 'animekai'): Promise<IMetaProviderIdResponse<IMetaAnime | null>>;
1892
+ /**
1893
+ * Fetches anime information along with provider-specific episode details using the MAL ID.
1894
+ *
1895
+ * @param malId - The unique MAL ID of the anime (required)
1896
+ * @param provider - The anime provider to fetch episodes from (optional, defaults to HiAnime)
1897
+ * @returns Promise that resolves to anime info and its episodes from the specified provider
1898
+ */
1899
+ fetchAnimeProviderEpisodes(malId: number, provider?: 'hianime' | 'allanime' | 'animepahe' | 'anizone' | 'animekai'): Promise<IMetaProviderEpisodesResponse<IMetaAnime | null>>;
1900
+ }
1901
+
1902
+ /**
1903
+ * A scraper and API wrapper for the unofficial FlixHQ website,
1904
+ * providing methods to fetch and parse movies, TV shows, and related data.
1905
+ *
1906
+ *
1907
+ */
1908
+ declare class FlixHQ extends BaseClass {
1909
+ private readonly baseUrl;
1910
+ constructor(baseUrl?: string);
1911
+ /**
1912
+ * Parses movie/TV show items from a Cheerio selection for standard item lists.
1913
+ *
1914
+ * @private
1915
+ * @param $ - Cheerio API instance
1916
+ * @param selector - CSS selector for the items to parse
1917
+ * @returns Array of parsed movie or TV show objects
1918
+ */
1919
+ private parseItems;
1920
+ /**
1921
+ * Parses mixed movie/TV show items from a Cheerio selection for upcoming content sections.
1922
+ *
1923
+ * @private
1924
+ * @param $ - Cheerio API instance
1925
+ * @param selector - CSS selector for the mixed items to parse
1926
+ * @returns Array of parsed movie or TV show objects with additional release date information
1927
+ */
1928
+ private parseMixedSection;
1929
+ /**
1930
+ * Parses the complete homepage structure from FlixHQ including featured slider, trending, recent releases, and upcoming content.
1931
+ *
1932
+ * @private
1933
+ * @param $ - Cheerio API instance containing homepage HTML
1934
+ * @returns Complete homepage data structure with all sections parsed
1935
+ */
1936
+ private parseHome;
1937
+ /**
1938
+ * Parses paginated results from FlixHQ search, category, or filter pages.
1939
+ *
1940
+ * @private
1941
+ * @param $ - Cheerio API instance containing paginated HTML content
1942
+ * @param selector - CSS selector for the media items in the paginated results
1943
+ * @returns Paginated results object with media items and pagination metadata
1944
+ */
1945
+ private parsePaginatedResults;
1946
+ /**
1947
+ * Parses search suggestions from FlixHQ AJAX autocomplete response.
1948
+ *
1949
+ * @private
1950
+ * @param $ - Cheerio API instance containing search suggestions HTML
1951
+ * @returns Response object containing parsed search suggestion items
1952
+ */
1953
+ private parseSearchSuggestions;
1954
+ /**
1955
+ * Parses the recommended section from individual media info pages.
1956
+ *
1957
+ * @private
1958
+ * @param $ - Cheerio API instance containing media info page HTML
1959
+ * @returns Array of recommended movie or TV show items
1960
+ */
1961
+ private parseInfoRecommendedSection;
1962
+ /**
1963
+ * Parses detailed media information from FlixHQ media detail pages.
1964
+ *
1965
+ * @private
1966
+ * @param $ - Cheerio API instance containing media info page HTML
1967
+ * @returns Media information object with detailed metadata and recommendations
1968
+ */
1969
+ private parseInfo;
1970
+ /**
1971
+ * Parses available seasons from FlixHQ TV show season dropdown.
1972
+ *
1973
+ * @private
1974
+ * @param $ - Cheerio API instance containing season dropdown HTML
1975
+ * @returns Array of season objects with season IDs and numbers
1976
+ */
1977
+ private parseSeasons;
1978
+ /**
1979
+ * Constructs AJAX URLs for different FlixHQ endpoints for episode and server data.
1980
+ *
1981
+ * @private
1982
+ * @param id - The media or season identifier
1983
+ * @param kind - The type of AJAX request ('movie-server', 'tv-server', 'tv', 'season')
1984
+ * @returns Complete AJAX URL for the specified endpoint type
1985
+ */
1986
+ private buildAjaxUrl;
1987
+ /**
1988
+ * Parses episode information from FlixHQ season episodes AJAX response.
1989
+ *
1990
+ * @private
1991
+ * @param $ - Cheerio API instance containing season episodes HTML
1992
+ * @param seasonNumber - The season number these episodes belong to
1993
+ * @param tvInfo - Tv data used to construct episodeId
1994
+ * @param media - The media identifier for constructing episode IDs
1995
+ * @returns Array of parsed episode objects with titles and numbering
1996
+ */
1997
+ private parseEpisodes;
1998
+ /**
1999
+ * Parses available streaming servers from FlixHQ server list AJAX response.
2000
+ *
2001
+ * @private
2002
+ * @param $ - Cheerio API instance containing server list HTML
2003
+ * @returns Array of server objects with server IDs and names
2004
+ */
2005
+ private parseServers;
2006
+ /**
2007
+ * Finds the server ID for a specific server name from the available servers list.
2008
+ *
2009
+ * @private
2010
+ * @param servers - Array of available server objects
2011
+ * @param server - The target server name to find ('upcloud', 'vidcloud', or 'akcloud')
2012
+ * @returns The server ID for the specified server
2013
+ * @throws Error if the specified server is not available
2014
+ */
2015
+ private findServerId;
2016
+ /**
2017
+ * Fetches paginated content from FlixHQ for various categories, filters, and search endpoints.
2018
+ *
2019
+ * @private
2020
+ * @param path - The URL path, filter string, or category identifier
2021
+ * @param page - The page number for pagination
2022
+ * @returns Promise resolving to paginated media results with error handling
2023
+ */
2024
+ private fetchPaginated;
2025
+ /**
2026
+ * Fetches curated lists from the FlixHQ homepage including featured slider, trending content, recent releases, and upcoming media.
2027
+ *
2028
+ * @returns Promise resolving to complete homepage data structure with all curated sections
2029
+ */
2030
+ fetchHome(): Promise<IHomeHIResponse<IMovieOrTv[] | []>>;
2031
+ /**
2032
+ * Searches for movies and TV shows based on the provided query string across FlixHQ catalog.
2033
+ *
2034
+ * @param query - The search query string (required)
2035
+ * @param page - The page number for pagination (optional, defaults to 1)
2036
+ * @returns Promise resolving to paginated search results containing matching media items
2037
+ */
2038
+ search(query: string, page?: number): Promise<IZPaginated<IMovieOrTv[] | []>>;
2039
+ /**
2040
+ * Performs an advanced search with multiple filter criteria including type, quality, genre, and country.
2041
+ *
2042
+ * Performs an advanced search with filters.
2043
+ * @param {'all' | 'movie' | 'tv'} [type] - The media type filter (default=all).
2044
+ * @param {'all' | 'HD' | 'SD' | 'CAM'} [quality] - The quality filter (default=all).
2045
+ * @param genre - Genre filter using HIMoviesGenreID mapping (optional, defaults to 'all')
2046
+ * @param country - Country filter using HIMoviesCountryID mapping (optional, defaults to 'all')
2047
+ * @param page - Page number for pagination (optional, defaults to 1)
2048
+ * @returns Promise resolving to paginated results filtered by all specified criteria
2049
+ */
2050
+ advancedSearch(type?: 'all' | 'movie' | 'tv', quality?: 'all' | 'HD' | 'SD' | 'CAM', genre?: string, country?: string, year?: string, page?: number): Promise<IZPaginated<IMovieOrTv[] | []>>;
2051
+ /**
2052
+ * Fetches search suggestions for autocomplete functionality based on partial query input.
2053
+ *
2054
+ * @param query - The partial search query string (required)
2055
+ * @returns Promise resolving to search suggestions containing matching media items
2056
+ */
2057
+ searchSuggestions(query: string): Promise<IResponse<IMovieOrTv[] | []>>;
2058
+ /**
2059
+ * Fetches a paginated list of the most popular movies from FlixHQ catalog.
2060
+ *
2061
+ * @param page - Page number for pagination (optional, defaults to 1)
2062
+ * @returns Promise resolving to paginated list of popular movies sorted by popularity
2063
+ */
2064
+ fetchPopularMovies(page?: number): Promise<IZPaginated<IMovieOrTv[] | []>>;
2065
+ /**
2066
+ * Fetches a paginated list of the most popular TV shows.
2067
+ * @param {number} [page=1] - Page number for pagination (default: 1).
2068
+ * @returns Paginated popular TV shows
2069
+ */
2070
+ fetchPopularTv(page?: number): Promise<IZPaginated<IMovieOrTv[] | []>>;
2071
+ /**
2072
+ * Fetches a paginated list of top rated movies.
2073
+ * @param {number} [page=1] - Page number for pagination (default: 1).
2074
+ * @returns Paginated top-rated movies
2075
+ */
2076
+ fetchTopMovies(page?: number): Promise<IZPaginated<IMovieOrTv[] | []>>;
2077
+ /**
2078
+ * Fetches a paginated list of top rated TV shows.
2079
+ * @param {number} [page=1] - Page number for pagination (default: 1).
2080
+ * @returns Paginated top-rated TV shows
2081
+ */
2082
+ fetchTopTv(page?: number): Promise<IZPaginated<IMovieOrTv[] | []>>;
2083
+ /**
2084
+ * Fetches a paginated list of upcoming media to be added.
2085
+ * @param {number} [page=1] - Page number for pagination (default: 1).
2086
+ * @returns Paginated media for upcoming
2087
+ */
2088
+ fetchUpcoming(page?: number): Promise<IZPaginated<IMovieOrTv[] | []>>;
2089
+ /**
2090
+ * Fetches media by genre.
2091
+ * @param {string} genre - The genre to filter by.
2092
+ * @param {number} [page=1] - Page number for pagination (default: 1).
2093
+ * @returns Paginated media by genre
2094
+ */
2095
+ fetchGenre(genre: string, page?: number): Promise<IZPaginated<IMovieOrTv[] | []>>;
2096
+ /**
2097
+ * Fetches media by country.
2098
+ * @param {string} country - The country code to filter by.
2099
+ * @param {number} [page=1] - Page number for pagination (default: 1).
2100
+ * @returns Paginated media by country
2101
+ */
2102
+ fetchByCountry(country: string, page?: number): Promise<IZPaginated<IMovieOrTv[] | []>>;
2103
+ /**
2104
+ * Fetches detailed information about a specific movie or TV show.
2105
+ * @param {string} mediaId - The unique identifier for the movie or TV show (required).
2106
+ * @returns A promise that resolves to an object containing detailed media information, recommendations, including episodes for TV shows.
2107
+ */
2108
+ fetchMediaInfo(mediaId: string): Promise<IMovieInfoResponse<IMovieInfo | null>>;
2109
+ /**
2110
+ * Fetches available server information for a specific episodeId.
2111
+ * @param {string} episodeId - The unique identifier for the episode/movie (required). Found in the episodes array.
2112
+ * @returns A promise that resolves to an object containing server information for the episode.
2113
+ */
2114
+ fetchServers(episodeId: string): Promise<IResponse<IMovieServers[] | []>>;
2115
+ /**
2116
+ * Fetches streaming sources for a selected media episode from a specified server.
2117
+ * @param {string} episodeId - The unique identifier for the episode/movie (required). Found in the episodes array
2118
+ * @param [server] - The server to use (optional, defaults to Vidcloud). Note: Upcloud is CORS protected (Error 403). Use a proxy or switch to Vidcloud or Akcloud(🤷) .
2119
+ * @returns A promise that resolves to an object containing streaming sources for the media.
2120
+ */
2121
+ fetchSources(episodeId: string, server?: 'upcloud' | 'vidcloud' | 'akcloud'): Promise<ISourceBaseResponse<IVideoSource | null>>;
2122
+ }
2123
+
2124
+ /**
2125
+ * A scraper and API wrapper for the unofficial HiMovies website,
2126
+ * providing methods to fetch and parse movies, TV shows, and related data.
2127
+ *
2128
+ *
2129
+ */
2130
+ declare class HiMovies extends BaseClass {
2131
+ private readonly baseUrl;
2132
+ constructor(baseUrl?: string);
2133
+ /**
2134
+ * Parses movie/TV show items from a Cheerio selection for standard item lists.
2135
+ *
2136
+ * @private
2137
+ * @param $ - Cheerio API instance
2138
+ * @param selector - CSS selector for the items to parse
2139
+ * @returns Array of parsed movie or TV show objects
2140
+ */
2141
+ private parseItems;
2142
+ /**
2143
+ * Parses mixed movie/TV show items from a Cheerio selection for upcoming content sections.
2144
+ *
2145
+ * @private
2146
+ * @param $ - Cheerio API instance
2147
+ * @param selector - CSS selector for the mixed items to parse
2148
+ * @returns Array of parsed movie or TV show objects with additional release date information
2149
+ */
2150
+ private parseMixedSection;
2151
+ /**
2152
+ * Parses the complete homepage structure from HIMovies including, trending, recent releases, and upcoming content.
2153
+ *
2154
+ * @private
2155
+ * @param $ - Cheerio API instance containing homepage HTML
2156
+ * @returns Complete homepage data structure with all sections parsed
2157
+ */
2158
+ private parseHome;
2159
+ /**
2160
+ * Parses paginated results from search, category, or filter pages.
2161
+ *
2162
+ * @private
2163
+ * @param $ - Cheerio API instance containing paginated HTML content
2164
+ * @param selector - CSS selector for the media items in the paginated results
2165
+ * @returns Paginated results object with media items and pagination metadata
2166
+ */
2167
+ private parsePaginatedResults;
2168
+ /**
2169
+ * Parses search suggestions from AJAX autocomplete response.
2170
+ *
2171
+ * @private
2172
+ * @param $ - Cheerio API instance containing search suggestions HTML
2173
+ * @returns Response object containing parsed search suggestion items
2174
+ */
2175
+ private parseSearchSuggestions;
2176
+ /**
2177
+ * Parses the recommended section from individual media info pages.
2178
+ *
2179
+ * @private
2180
+ * @param $ - Cheerio API instance containing media info page HTML
2181
+ * @returns Array of recommended movie or TV show items
2182
+ */
2183
+ private parseInfoRecommendedSection;
2184
+ /**
2185
+ * Parses detailed media information from media detail pages.
2186
+ *
2187
+ * @private
2188
+ * @param $ - Cheerio API instance containing media info page HTML
2189
+ * @returns Media information object with detailed metadata and recommendations
2190
+ */
2191
+ private parseInfo;
2192
+ /**
2193
+ * Parses available seasons from TV show season dropdown.
2194
+ *
2195
+ * @private
2196
+ * @param $ - Cheerio API instance containing season dropdown HTML
2197
+ * @returns Array of season objects with season IDs and numbers
2198
+ */
2199
+ private parseSeasons;
2200
+ /**
2201
+ * Constructs AJAX URLs for different endpoints for episode and server data.
2202
+ *
2203
+ * @private
2204
+ * @param id - The media or season identifier
2205
+ * @param kind - The type of AJAX request ('movie-server', 'tv-server', 'tv', 'season')
2206
+ * @returns Complete AJAX URL for the specified endpoint type
2207
+ */
2208
+ private buildAjaxUrl;
2209
+ /**
2210
+ * Parses episode information from season episodes AJAX response.
2211
+ *
2212
+ * @private
2213
+ * @param $ - Cheerio API instance containing season episodes HTML
2214
+ * @param seasonNumber - The season number these episodes belong to
2215
+ * @param tvInfo - Tv data used to construct episodeId
2216
+ * @param media - The media identifier for constructing episode IDs
2217
+ * @returns Array of parsed episode objects with titles and numbering
2218
+ */
2219
+ private parseEpisodes;
2220
+ /**
2221
+ * Parses available streaming servers from server list AJAX response.
2222
+ *
2223
+ * @private
2224
+ * @param $ - Cheerio API instance containing server list HTML
2225
+ * @returns Array of server objects with server IDs and names
2226
+ */
2227
+ private parseServers;
2228
+ /**
2229
+ * Finds the server ID for a specific server name from the available servers list.
2230
+ *
2231
+ * @private
2232
+ * @param servers - Array of available server objects
2233
+ * @param server - The target server name to find ('upcloud', 'megacloud', or 'akcloud')
2234
+ * @returns The server ID for the specified server
2235
+ * @throws Error if the specified server is not available
2236
+ */
2237
+ private findServerId;
2238
+ /**
2239
+ * Fetches paginated content for various categories, filters, and search endpoints.
2240
+ *
2241
+ * @private
2242
+ * @param path - The URL path, filter string, or category identifier
2243
+ * @param page - The page number for pagination
2244
+ * @returns Promise resolving to paginated media results with error handling
2245
+ */
2246
+ private fetchPaginated;
2247
+ /**
2248
+ * Fetches curated lists from the HiMovies homepage including , trending content, recent releases, and upcoming media.
2249
+ *
2250
+ * @returns Promise resolving to complete homepage data structure with all curated sections
2251
+ */
2252
+ fetchHome(): Promise<IHomeHIResponse<IMovieOrTv[] | []>>;
2253
+ /**
2254
+ * Searches for media based on the provided query string.
2255
+ * @param {string} query - The search query string (required).
2256
+ * @param {number} [page=1] - The page number for pagination (optional, defaults to 1).
2257
+ * @returns A promise that resolves to an object containing an array of media titles, pagination details, or an error message.
2258
+ */
2259
+ search(query: string, page?: number): Promise<IZPaginated<IMovieOrTv[] | []>>;
2260
+ /**
2261
+ * Performs an advanced search with filters.
2262
+ * @param {'all' | 'movie' | 'tv'} [type] - The media type filter (default=all).
2263
+ * @param {'all' | 'HD' | 'SD' | 'CAM'} [quality] - The quality filter (default=all).
2264
+ * @param {HIMoviesGenreID} [genre] - Genre filter (default ='all').
2265
+ * @param {HIMoviesCountryID} [country] - Country filter (default ='all').
2266
+ * @param {number} [page=1] - Page number for pagination (default ='all').
2267
+ * @returns Paginated filtered search results
2268
+ */
2269
+ advancedSearch(type?: 'all' | 'movie' | 'tv', quality?: 'all' | 'HD' | 'SD' | 'CAM', genre?: string, country?: string, year?: string, page?: number): Promise<IZPaginated<IMovieOrTv[] | []>>;
2270
+ /**
2271
+ * Fetches search suggestions for a query string.
2272
+ * @param {string} query - The search query string (required).
2273
+ * @returns {Promise<IResponse<IMovieOrTv[] | []>>} Search suggestions for autocomplete
2274
+ */
2275
+ searchSuggestions(query: string): Promise<IResponse<IMovieOrTv[] | []>>;
2276
+ /**
2277
+ * Fetches a paginated list of the most popular movies.
2278
+ * @param {number} [page=1] - Page number for pagination (default: 1).
2279
+ * @returns Paginated popular movies
2280
+ */
2281
+ fetchPopularMovies(page?: number): Promise<IZPaginated<IMovieOrTv[] | []>>;
2282
+ /**
2283
+ * Fetches a paginated list of the most popular TV shows.
2284
+ * @param {number} [page=1] - Page number for pagination (default: 1).
2285
+ * @returns Paginated popular TV shows
2286
+ */
2287
+ fetchPopularTv(page?: number): Promise<IZPaginated<IMovieOrTv[] | []>>;
2288
+ /**
2289
+ * Fetches a paginated list of top rated movies.
2290
+ * @param {number} [page=1] - Page number for pagination (default: 1).
2291
+ * @returns Paginated top-rated movies
2292
+ */
2293
+ fetchTopMovies(page?: number): Promise<IZPaginated<IMovieOrTv[] | []>>;
2294
+ /**
2295
+ * Fetches a paginated list of top rated TV shows.
2296
+ * @param {number} [page=1] - Page number for pagination (default: 1).
2297
+ * @returns Paginated top-rated TV shows
2298
+ */
2299
+ fetchTopTv(page?: number): Promise<IZPaginated<IMovieOrTv[] | []>>;
2300
+ /**
2301
+ * Fetches a paginated list of upcoming media to be added.
2302
+ * @param {number} [page=1] - Page number for pagination (default: 1).
2303
+ * @returns Paginated media
2304
+ */
2305
+ fetchUpcoming(page?: number): Promise<IZPaginated<IMovieOrTv[] | []>>;
2306
+ /**
2307
+ * Fetches media by genre.
2308
+ * @param {string} genre - The genre to filter by.
2309
+ * @param {number} [page=1] - Page number for pagination (default: 1).
2310
+ * @returns Paginated media by genre
2311
+ */
2312
+ fetchGenre(genre: string, page?: number): Promise<IZPaginated<IMovieOrTv[] | []>>;
2313
+ /**
2314
+ * Fetches media by country.
2315
+ * @param {string} country - The country code to filter by.
2316
+ * @param {number} [page=1] - Page number for pagination (default: 1).
2317
+ * @returns Paginated media by country
2318
+ */
2319
+ fetchByCountry(country: string, page?: number): Promise<IZPaginated<IMovieOrTv[] | []>>;
2320
+ /**
2321
+ * Fetches detailed information about a specific movie or TV show.
2322
+ * @param {string} mediaId - The unique identifier for the movie or TV show (required).
2323
+ * @returns A promise that resolves to an object containing detailed media information, recommendations, including episodes for TV shows.
2324
+ */
2325
+ fetchMediaInfo(mediaId: string): Promise<IMovieInfoResponse<IMovieInfo | null>>;
2326
+ /**
2327
+ * Fetches available server information for a specific episodeId.
2328
+ * @param {string} episodeId - The unique identifier for the episode/movie (required). Found in the episodes array.
2329
+ * @returns A promise that resolves to an object containing server information for the episode.
2330
+ */
2331
+ fetchServers(episodeId: string): Promise<IResponse<IMovieServers[] | []>>;
2332
+ /**
2333
+ * Fetches streaming sources for a selected media episode from a specified server.
2334
+ * @param {string} episodeId - The unique identifier for the episode/movie (required). Found in the episodes array
2335
+ * @param [server] - The server to use (optional, defaults to Megacloud). Note: Upcloud is CORS protected (Error 403). Use a proxy or switch to Megacloud or Akcloud(🤷) .
2336
+ * @returns A promise that resolves to an object containing streaming sources for the media.
2337
+ */
2338
+ fetchSources(episodeId: string, server?: 'upcloud' | 'megacloud' | 'akcloud'): Promise<ISourceBaseResponse<IVideoSource | null>>;
2339
+ }
2340
+
2341
+ /**
2342
+ * A class for interacting with the HiAnime platform (hianime.to) to search for anime, fetch detailed information,
2343
+ * retrieve episode lists, get available streaming servers, and fetch curated anime lists.
2344
+ */
2345
+ declare class Kaido extends BaseClass {
2346
+ private readonly baseUrl;
2347
+ constructor(baseUrl?: string);
2348
+ /**
2349
+ * Parses paginated anime search results from a Cheerio instance.
2350
+ * Extracts anime details and pagination information from the provided HTML selector.
2351
+ * @param $ CheerioAPI instance
2352
+ * @param selector CSS selector for anime items
2353
+ * @returns An object containing anime list and pagination details
2354
+ */
2355
+ private parsePaginatedResults;
2356
+ /**
2357
+ * Parses search suggestion results from a Cheerio instance.
2358
+ * Extracts anime suggestion details from the provided HTML.
2359
+ * @param $ CheerioAPI instance
2360
+ * @returns An array containing an array of search suggestions
2361
+ */
2362
+ private parseSearchSuggestions;
2363
+ /**
2364
+ * Parses detailed anime information from a Cheerio instance.
2365
+ * Extracts anime details, characters, recommendations, related anime, seasons, and promotion videos.
2366
+ * @param $ CheerioAPI instance
2367
+ * @returns Object containing anime details and related data
2368
+ */
2369
+ private parseAnimeInfo;
2370
+ /**
2371
+ * Parses the HiAnime homepage data from a Cheerio instance.
2372
+ * Extracts spotlight, trending, top airing, most popular, favorites, recently completed, recently added, recently updated, and top anime rankings.
2373
+ * @param $ CheerioAPI instance
2374
+ * @returns An object containing various curated anime lists
2375
+ */
2376
+ private parseHome;
2377
+ /**
2378
+ * Parses paginated sections like top airing, most popular, etc., from a Cheerio instance.
2379
+ * Extracts anime details, pagination information
2380
+ * @param $ CheerioAPI instance
2381
+ * @returns RepetitiveSections containing anime list, pagination details, and top anime rankings
2382
+ */
2383
+ private parsePaginatedSections;
2384
+ /**
2385
+ * Parses episode data for an anime from a Cheerio instance.
2386
+ * Extracts episode IDs, titles, and numbers from the provided HTML.
2387
+ * @param $ CheerioAPI instance
2388
+ * @returns Response containing an array of episode information
2389
+ */
2390
+ private parseEpisodes;
2391
+ /**
2392
+ * Parses streaming server data for an episode from a Cheerio instance.
2393
+ * Extracts sub, dub, and raw server details along with episode number.
2394
+ * @param $ CheerioAPI instance
2395
+ * @returns Response containing server information
2396
+ */
2397
+ private parseServerData;
2398
+ /**
2399
+ * Finds the server ID for a given category and server name from the server data.
2400
+ * @param servers Server information containing sub, dub, and raw server lists
2401
+ * @param category Sub or dub category
2402
+ * @param server Server name to find
2403
+ * @returns The media ID of the matching server
2404
+ * @throws Error if the category or server is not found
2405
+ */
2406
+ private findServerId;
2407
+ /**
2408
+ * Searches for anime based on the provided query string.
2409
+ * @param {string} query - The search query string (required).
2410
+ * @param {number} [page=1] - The page number for pagination (optional, defaults to 1).
2411
+ * @returns A promise that resolves to an object containing an array of anime titles, pagination details, or an error message.
2412
+ */
2413
+ search(query: string, page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
2414
+ /**
2415
+ * Fetches search suggestions for a given query string from the HiAnime platform.
2416
+ * @param {string} query - The search query string (required).
2417
+ @returns A promise that resolves to an object containing an array of anime titles or an error message.
2418
+ */
2419
+ searchSuggestions(query: string): Promise<IResponse<IZSearchSuggestions[] | []>>;
2420
+ /**
2421
+ * Fetches curated lists from the HiAnime homepage.
2422
+ * @returns Promise resolving to an object with various curated anime lists
2423
+ */
2424
+ fetchHome(): Promise<IZHomeResponse<IZSpotlight[] | []>>;
2425
+ /**
2426
+ * Fetches a paginated list of top airing anime.
2427
+ * @param {number} page - Page number for pagination (default: 1)
2428
+ * @returns Promise resolving to an object with top airing anime and pagination details
2429
+ */
2430
+ fetchTopAiring(page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
2431
+ /**
2432
+ * Fetches a paginated list of the most favorited anime.
2433
+ * @param {number} page - Page number for pagination (default: 1)
2434
+ * @returns Promise resolving to an object with favorited anime and pagination details
2435
+ */
2436
+ fetchMostFavourites(page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
2437
+ /**
2438
+ * Fetches a paginated list of the most popular anime.
2439
+ * @param {number} page - Page number for pagination (default: 1)
2440
+ * @returns Promise resolving to an object with popular anime and pagination details
2441
+ */
2442
+ fetchMostPopular(page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
2443
+ /**
2444
+ * Fetches a paginated list of recently completed anime.
2445
+ * @param {number} page - Page number for pagination (default: 1)
2446
+ * @returns Promise resolving to an object with recently completed anime and pagination details
2447
+ */
2448
+ fetchRecentlyCompleted(page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
2449
+ /**
2450
+ * Fetches a paginated list of recently added anime.
2451
+ * @param {number} page - Page number for pagination (default: 1)
2452
+ * @returns Promise resolving to an object with recently added anime and pagination details
2453
+ */
2454
+ fetchRecentlyAdded(page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
2455
+ /**
2456
+ * Fetches a paginated list of recently updated anime.
2457
+ * @param {number} page - Page number for pagination (default: 1)
2458
+ * @returns Promise resolving to an object with recently updated anime and pagination details
2459
+ */
2460
+ fetchRecentlyUpdated(page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
2461
+ /**
2462
+ * Fetches a list of anime titles sorted alphabetically, optionally filtered by a starting character.
2463
+ * @param {any} sort Optional letter (A-Z) or "0-9" to filter anime
2464
+ * @param {number} page - Page number for pagination (default: 1)
2465
+ *@returns Promise resolving to an object with alphabetically sorted anime and pagination details
2466
+ */
2467
+ fetchAtoZList(sort?: any, page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
2468
+ /**
2469
+ * Fetches a list of anime by genre.
2470
+ * @param {string} genre -The genre to filter anime by
2471
+ * @param {number} page - Page number for pagination (default: 1)
2472
+ * @returns Promise resolving to an object with genre-specific anime and pagination details
2473
+ */
2474
+ fetchGenre(genre: string, page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
2475
+ /**
2476
+ * Fetches a list of subbed anime.
2477
+ * @param {number} page - Page number for pagination (default: 1)
2478
+ * @returns Promise resolving to an object with subbed anime and pagination details
2479
+ */
2480
+ fetchSubbedAnime(page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
2481
+ /**
2482
+ * Fetches a list of dubbed anime.
2483
+ * @param {number} page - Page number for pagination (default: 1)
2484
+ * @returns { Promise<IAnimePaginated<IAnime[] | []>>} Promise resolving to an object with dubbed anime and pagination details
2485
+ */
2486
+ fetchDubbedAnime(page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
2487
+ /**
2488
+ * Fetches a list of anime by category.
2489
+ * @param { IAnimeCategory} category - The category of anime to fetch (MOVIE, TV, ONA, OVA, SPECIALS).
2490
+ * @param {number} [page=1] - The page number for pagination (default: 1).
2491
+ * @returns - Promise resolving to paginated anime results.
2492
+ */
2493
+ fetchAnimeCategory(category: IAnimeCategory, page?: number): Promise<IZPaginated$1<IZAnime[] | []>>;
2494
+ /**
2495
+ * Fetches detailed information about a specific anime including episodes.
2496
+ * @param {string} animeId - The unique identifier for the anime (e.g., "bleach-806") (required).
2497
+ * @returns A promise that resolves to an object containing anime details,provider episodes, related seasons, characters, recommendations, or an error message.
2498
+ */
2499
+ fetchAnimeInfo(animeId: string): Promise<IZoroInfoResponse<IZAnimeInfo | null>>;
2500
+ /**
2501
+ * Fetches episode data for a specific anime.
2502
+ * @param {string} animeId - The unique identifier for the anime (e.g., "bleach-806") (required).
2503
+ * @returns A promise that resolves to an object containing an array of episode information or an error message.
2504
+ */
2505
+ fetchEpisodes(animeId: string): Promise<IResponse<IZEpisodes[] | []>>;
2506
+ /**
2507
+ * Fetches available streaming servers for a specific anime episode.
2508
+ * @param {string} episodeId - The unique identifier for the episode (required).
2509
+ * @returns A promise that resolves to an object containing available streaming server details (sub, dub, raw) or an error message.
2510
+ */
2511
+ fetchServers(episodeId: string): Promise<IResponse<IServerInfo | null>>;
2512
+ /**
2513
+ * Fetches streaming sources for a given anime episode from a specified server and category.
2514
+ * @param {string} episodeId - The unique identifier for the episode (required).
2515
+ * @param server - The streaming server to use (optional, defaults to vidcloud). Note: vidstreaming may return a 403 error due to CORS restrictions; use a proxy.
2516
+ * @param {ISubOrDub} category - The audio category (Subtitled or Dubbed) (optional, defaults to SubOrDub.SUB).
2517
+ * @returns A promise that resolves to an object containing streaming sources, headers, sync data (AniList/MAL IDs), or an error message.
2518
+ */
2519
+ fetchSources(episodeId: string, server?: 'vidstreaming' | 'vidcloud', category?: ISubOrDub): Promise<IZSourceResponse<IVideoSource | null>>;
2520
+ }
2521
+
2522
+ export { AllAnime, Anilist, Animekai, Animepahe, Anizone, FlixHQ, type HIGenre, HiAnime, HiMovies, type IAnimeCategory, type IMetaFormat, type IMovieCountry, type IMovieGenre, Jikan, Kaido, Seasons };