@crysoline/lib 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/anime/hianime/types.d.ts +3 -0
- package/dist/core/anime/index.d.ts +29 -1
- package/dist/core/anime/index.js +182 -0
- package/dist/core/hentai/index.d.ts +6 -0
- package/dist/core/hentai/index.js +43 -0
- package/dist/core/manga/index.d.ts +9 -3
- package/dist/core/manga/index.js +52 -0
- package/dist/core/mapper/index.d.ts +24 -1
- package/dist/core/mapper/index.js +21 -0
- package/dist/core/meta/index.d.ts +6 -2
- package/dist/core/meta/index.js +40 -0
- package/dist/core/types.d.ts +6 -0
- package/dist/helpers/fetch.d.ts +72 -43
- package/dist/helpers/fetch.js +8 -75
- package/package.json +12 -2
|
@@ -21,6 +21,9 @@ export interface HianimeSearchMeta {
|
|
|
21
21
|
export interface HianimeEpisodeMeta {
|
|
22
22
|
title_jp: string | null;
|
|
23
23
|
}
|
|
24
|
+
export interface HianimeServerMeta {
|
|
25
|
+
data_id: number | null;
|
|
26
|
+
}
|
|
24
27
|
export interface HianimeInfoMeta {
|
|
25
28
|
year: number | null;
|
|
26
29
|
score: number | null;
|
|
@@ -4,12 +4,14 @@ import type { NEpisodeMeta, NInfoMeta, NSearchMeta } from './animenexus';
|
|
|
4
4
|
import type { OEpisodeMeta, OInfoMeta } from './animeonsen';
|
|
5
5
|
import type { PaheEpisodeMeta, PaheInfoMeta, PaheSearchMeta } from './animepahe';
|
|
6
6
|
import type { AZEpisodeMeta, AZInfoMeta, AZSearchMeta } from './anizone';
|
|
7
|
-
import type { HianimeEpisodeMeta, HianimeInfoMeta, HianimeSearchMeta } from './hianime';
|
|
7
|
+
import type { HianimeEpisodeMeta, HianimeInfoMeta, HianimeSearchMeta, HianimeServerMeta } from './hianime';
|
|
8
8
|
import type { KEpisodeMeta, KInfoMeta, KSearchMeta, KSourceMeta } from './kickassanime';
|
|
9
9
|
import type { LEpisodeMeta, LInfoMeta, LSearchMeta, LSourcesMeta } from './lunar';
|
|
10
10
|
import type { UniqueEpisodeMeta, UniqueInfoMeta, UniqueSearchMeta } from './uniquestream';
|
|
11
11
|
declare const Anime: {
|
|
12
12
|
OneTwoThreeAnime: (apiKey: string) => {
|
|
13
|
+
name: string;
|
|
14
|
+
} & {
|
|
13
15
|
search: (q: string) => Promise<import("../types").Search<OneTwoThreeAnimeSearchMeta>[]>;
|
|
14
16
|
info: (id: string | number) => Promise<import("../types").Info<OneTwoThreeAnimeInfoMeta, import("../types").Episode<unknown>>>;
|
|
15
17
|
episodes: (id: string | number) => Promise<import("../types").Episode<unknown>[]>;
|
|
@@ -21,6 +23,8 @@ declare const Anime: {
|
|
|
21
23
|
}) => Promise<import("../types").Source<unknown>>;
|
|
22
24
|
};
|
|
23
25
|
AnimeParadise: (apiKey: string) => {
|
|
26
|
+
name: string;
|
|
27
|
+
} & {
|
|
24
28
|
search: (q: string) => Promise<import("../types").Search<unknown>[]>;
|
|
25
29
|
info: (id: string | number) => Promise<import("../types").Info<unknown, import("../types").Episode<unknown>>>;
|
|
26
30
|
episodes: (id: string | number) => Promise<import("../types").Episode<unknown>[]>;
|
|
@@ -32,6 +36,8 @@ declare const Anime: {
|
|
|
32
36
|
}) => Promise<import("../types").Source<unknown>>;
|
|
33
37
|
};
|
|
34
38
|
AnimeHeaven: (apiKey: string) => {
|
|
39
|
+
name: string;
|
|
40
|
+
} & {
|
|
35
41
|
search: (q: string) => Promise<import("../types").Search<unknown>[]>;
|
|
36
42
|
info: (id: string | number) => Promise<import("../types").Info<unknown, import("../types").Episode<unknown>>>;
|
|
37
43
|
episodes: (id: string | number) => Promise<import("../types").Episode<unknown>[]>;
|
|
@@ -43,6 +49,8 @@ declare const Anime: {
|
|
|
43
49
|
}) => Promise<import("../types").Source<unknown>>;
|
|
44
50
|
};
|
|
45
51
|
AnimeKai: (apiKey: string) => {
|
|
52
|
+
name: string;
|
|
53
|
+
} & {
|
|
46
54
|
search: (q: string) => Promise<import("../types").Search<KaiSearchMeta>[]>;
|
|
47
55
|
info: (id: string | number) => Promise<import("../types").Info<KaiInfoMeta, import("../types").Episode<KaiEpisodeMeta>>>;
|
|
48
56
|
episodes: (id: string | number) => Promise<import("../types").Episode<KaiEpisodeMeta>[]>;
|
|
@@ -54,6 +62,8 @@ declare const Anime: {
|
|
|
54
62
|
}) => Promise<import("../types").Source<unknown>>;
|
|
55
63
|
};
|
|
56
64
|
AnimeNexus: (apiKey: string) => {
|
|
65
|
+
name: string;
|
|
66
|
+
} & {
|
|
57
67
|
search: (q: string) => Promise<import("../types").Search<NSearchMeta>[]>;
|
|
58
68
|
info: (id: string | number) => Promise<import("../types").Info<NInfoMeta, import("../types").Episode<NEpisodeMeta>>>;
|
|
59
69
|
episodes: (id: string | number) => Promise<import("../types").Episode<NEpisodeMeta>[]>;
|
|
@@ -65,6 +75,8 @@ declare const Anime: {
|
|
|
65
75
|
}) => Promise<import("../types").Source<unknown>>;
|
|
66
76
|
};
|
|
67
77
|
AnimeOnsen: (apiKey: string) => {
|
|
78
|
+
name: string;
|
|
79
|
+
} & {
|
|
68
80
|
search: (q: string) => Promise<import("../types").Search<unknown>[]>;
|
|
69
81
|
info: (id: string | number) => Promise<import("../types").Info<OInfoMeta, import("../types").Episode<OEpisodeMeta>>>;
|
|
70
82
|
episodes: (id: string | number) => Promise<import("../types").Episode<OEpisodeMeta>[]>;
|
|
@@ -76,6 +88,8 @@ declare const Anime: {
|
|
|
76
88
|
}) => Promise<import("../types").Source<unknown>>;
|
|
77
89
|
};
|
|
78
90
|
AnimePahe: (apiKey: string) => {
|
|
91
|
+
name: string;
|
|
92
|
+
} & {
|
|
79
93
|
search: (q: string) => Promise<import("../types").Search<PaheSearchMeta>[]>;
|
|
80
94
|
info: (id: string | number) => Promise<import("../types").Info<PaheInfoMeta, import("../types").Episode<PaheEpisodeMeta>>>;
|
|
81
95
|
episodes: (id: string | number) => Promise<import("../types").Episode<PaheEpisodeMeta>[]>;
|
|
@@ -87,6 +101,8 @@ declare const Anime: {
|
|
|
87
101
|
}) => Promise<import("../types").Source<unknown>>;
|
|
88
102
|
};
|
|
89
103
|
AniZone: (apiKey: string) => {
|
|
104
|
+
name: string;
|
|
105
|
+
} & {
|
|
90
106
|
search: (q: string) => Promise<import("../types").Search<AZSearchMeta>[]>;
|
|
91
107
|
info: (id: string | number) => Promise<import("../types").Info<AZInfoMeta, import("../types").Episode<AZEpisodeMeta>>>;
|
|
92
108
|
episodes: (id: string | number) => Promise<import("../types").Episode<AZEpisodeMeta>[]>;
|
|
@@ -98,6 +114,8 @@ declare const Anime: {
|
|
|
98
114
|
}) => Promise<import("../types").Source<unknown>>;
|
|
99
115
|
};
|
|
100
116
|
HiAnime: (apiKey: string) => {
|
|
117
|
+
name: string;
|
|
118
|
+
} & {
|
|
101
119
|
search: (q: string) => Promise<import("../types").Search<HianimeSearchMeta>[]>;
|
|
102
120
|
info: (id: string | number) => Promise<import("../types").Info<HianimeInfoMeta, import("../types").Episode<HianimeEpisodeMeta>>>;
|
|
103
121
|
episodes: (id: string | number) => Promise<import("../types").Episode<HianimeEpisodeMeta>[]>;
|
|
@@ -107,8 +125,14 @@ declare const Anime: {
|
|
|
107
125
|
subType?: string;
|
|
108
126
|
server?: string;
|
|
109
127
|
}) => Promise<import("../types").Source<unknown>>;
|
|
128
|
+
servers: (params: {
|
|
129
|
+
id: string | number;
|
|
130
|
+
episodeId: string | number;
|
|
131
|
+
}) => Promise<import("../types").Server<HianimeServerMeta>>;
|
|
110
132
|
};
|
|
111
133
|
KickAssAnime: (apiKey: string) => {
|
|
134
|
+
name: string;
|
|
135
|
+
} & {
|
|
112
136
|
search: (q: string) => Promise<import("../types").Search<KSearchMeta>[]>;
|
|
113
137
|
info: (id: string | number) => Promise<import("../types").Info<KInfoMeta, import("../types").Episode<KEpisodeMeta>>>;
|
|
114
138
|
episodes: (id: string | number) => Promise<import("../types").Episode<KEpisodeMeta>[]>;
|
|
@@ -120,6 +144,8 @@ declare const Anime: {
|
|
|
120
144
|
}) => Promise<import("../types").Source<KSourceMeta>>;
|
|
121
145
|
};
|
|
122
146
|
LunarAnime: (apiKey: string) => {
|
|
147
|
+
name: string;
|
|
148
|
+
} & {
|
|
123
149
|
search: (q: string) => Promise<import("../types").Search<LSearchMeta>[]>;
|
|
124
150
|
info: (id: string | number) => Promise<import("../types").Info<LInfoMeta, import("../types").Episode<LEpisodeMeta>>>;
|
|
125
151
|
episodes: (id: string | number) => Promise<import("../types").Episode<LEpisodeMeta>[]>;
|
|
@@ -131,6 +157,8 @@ declare const Anime: {
|
|
|
131
157
|
}) => Promise<import("../types").Source<LSourcesMeta>>;
|
|
132
158
|
};
|
|
133
159
|
UniqueStream: (apiKey: string) => {
|
|
160
|
+
name: string;
|
|
161
|
+
} & {
|
|
134
162
|
search: (q: string) => Promise<import("../types").Search<UniqueSearchMeta>[]>;
|
|
135
163
|
info: (id: string | number) => Promise<import("../types").Info<UniqueInfoMeta, import("../types").Episode<UniqueEpisodeMeta>>>;
|
|
136
164
|
episodes: (id: string | number) => Promise<import("../types").Episode<UniqueEpisodeMeta>[]>;
|
package/dist/core/anime/index.js
CHANGED
|
@@ -1,48 +1,230 @@
|
|
|
1
1
|
import { AnimeFetch } from '../../helpers/fetch';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a 123Anime API client.
|
|
4
|
+
*
|
|
5
|
+
* @param apiKey - Your API key for authentication
|
|
6
|
+
* @returns API client with methods: search, info, episodes, sources
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const client = OneTwoThreeAnime(process.env.API_KEY);
|
|
11
|
+
* const results = await client.search("naruto");
|
|
12
|
+
* const info = await client.info(results[0].id);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
2
15
|
const OneTwoThreeAnime = (apiKey) => AnimeFetch({
|
|
3
16
|
provider: 'onetwothreeanime',
|
|
4
17
|
apiKey,
|
|
5
18
|
});
|
|
19
|
+
/**
|
|
20
|
+
* Creates an AnimeParadise API client.
|
|
21
|
+
*
|
|
22
|
+
* @param apiKey - Your API key for authentication
|
|
23
|
+
* @returns API client with methods: search, info, episodes, sources
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const client = AnimeParadise(process.env.API_KEY);
|
|
28
|
+
* const results = await client.search("one piece");
|
|
29
|
+
* const episodes = await client.episodes(results[0].id);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
6
32
|
const AnimeParadise = (apiKey) => AnimeFetch({
|
|
7
33
|
provider: 'animeparadise',
|
|
8
34
|
apiKey,
|
|
9
35
|
});
|
|
36
|
+
/**
|
|
37
|
+
* Creates an AnimeHeaven API client.
|
|
38
|
+
*
|
|
39
|
+
* @param apiKey - Your API key for authentication
|
|
40
|
+
* @returns API client with methods: search, info, episodes, sources
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* const client = AnimeHeaven(process.env.API_KEY);
|
|
45
|
+
* const results = await client.search("demon slayer");
|
|
46
|
+
* const info = await client.info(results[0].id);
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
10
49
|
const AnimeHeaven = (apiKey) => AnimeFetch({
|
|
11
50
|
provider: 'animeheaven',
|
|
12
51
|
apiKey,
|
|
13
52
|
});
|
|
53
|
+
/**
|
|
54
|
+
* Creates an AnimeKai API client.
|
|
55
|
+
*
|
|
56
|
+
* @param apiKey - Your API key for authentication
|
|
57
|
+
* @returns API client with methods: search, info, episodes, sources
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const client = AnimeKai(process.env.API_KEY);
|
|
62
|
+
* const results = await client.search("attack on titan");
|
|
63
|
+
* const episodes = await client.episodes(results[0].id);
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
14
66
|
const AnimeKai = (apiKey) => AnimeFetch({
|
|
15
67
|
provider: 'animekai',
|
|
16
68
|
apiKey,
|
|
17
69
|
});
|
|
70
|
+
/**
|
|
71
|
+
* Creates an AnimeNexus API client.
|
|
72
|
+
*
|
|
73
|
+
* @param apiKey - Your API key for authentication
|
|
74
|
+
* @returns API client with methods: search, info, episodes, sources
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* const client = AnimeNexus(process.env.API_KEY);
|
|
79
|
+
* const results = await client.search("jujutsu kaisen");
|
|
80
|
+
* const info = await client.info(results[0].id);
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
18
83
|
const AnimeNexus = (apiKey) => AnimeFetch({
|
|
19
84
|
provider: 'animenexus',
|
|
20
85
|
apiKey,
|
|
21
86
|
});
|
|
87
|
+
/**
|
|
88
|
+
* Creates an AnimeOnsen API client.
|
|
89
|
+
*
|
|
90
|
+
* @param apiKey - Your API key for authentication
|
|
91
|
+
* @returns API client with methods: search, info, episodes, sources
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* const client = AnimeOnsen(process.env.API_KEY);
|
|
96
|
+
* const results = await client.search("my hero academia");
|
|
97
|
+
* const episodes = await client.episodes(results[0].id);
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
22
100
|
const AnimeOnsen = (apiKey) => AnimeFetch({
|
|
23
101
|
provider: 'animeonsen',
|
|
24
102
|
apiKey,
|
|
25
103
|
});
|
|
104
|
+
/**
|
|
105
|
+
* Creates an AnimePahe API client.
|
|
106
|
+
*
|
|
107
|
+
* @param apiKey - Your API key for authentication
|
|
108
|
+
* @returns API client with methods: search, info, episodes, sources
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* const client = AnimePahe(process.env.API_KEY);
|
|
113
|
+
* const results = await client.search("chainsaw man");
|
|
114
|
+
* const info = await client.info(results[0].id);
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
26
117
|
const AnimePahe = (apiKey) => AnimeFetch({
|
|
27
118
|
provider: 'animepahe',
|
|
28
119
|
apiKey,
|
|
29
120
|
});
|
|
121
|
+
/**
|
|
122
|
+
* Creates an AniZone API client.
|
|
123
|
+
*
|
|
124
|
+
* @param apiKey - Your API key for authentication
|
|
125
|
+
* @returns API client with methods: search, info, episodes, sources
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* const client = AniZone(process.env.API_KEY);
|
|
130
|
+
* const results = await client.search("spy x family");
|
|
131
|
+
* const episodes = await client.episodes(results[0].id);
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
30
134
|
const AniZone = (apiKey) => AnimeFetch({
|
|
31
135
|
provider: 'anizone',
|
|
32
136
|
apiKey,
|
|
33
137
|
});
|
|
138
|
+
/**
|
|
139
|
+
* Creates a HiAnime API client.
|
|
140
|
+
*
|
|
141
|
+
* **Full-featured provider with server selection support.**
|
|
142
|
+
*
|
|
143
|
+
* @param apiKey - Your API key for authentication
|
|
144
|
+
* @returns API client with methods: search, info, episodes, sources, servers
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```ts
|
|
148
|
+
* const client = HiAnime(process.env.API_KEY);
|
|
149
|
+
*
|
|
150
|
+
* // Search for anime
|
|
151
|
+
* const results = await client.search("alya");
|
|
152
|
+
*
|
|
153
|
+
* // Get anime info
|
|
154
|
+
* const info = await client.info(results[0].id);
|
|
155
|
+
*
|
|
156
|
+
* // Get episodes
|
|
157
|
+
* const episodes = await client.episodes(results[0].id);
|
|
158
|
+
*
|
|
159
|
+
* // Get available servers
|
|
160
|
+
* const servers = await client.servers({
|
|
161
|
+
* id: results[0].id,
|
|
162
|
+
* episodeId: episodes[0].id
|
|
163
|
+
* });
|
|
164
|
+
*
|
|
165
|
+
* // Get streaming sources
|
|
166
|
+
* const sources = await client.sources({
|
|
167
|
+
* id: results[0].id,
|
|
168
|
+
* episodeId: episodes[0].id,
|
|
169
|
+
* subType: "sub"
|
|
170
|
+
* });
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
34
173
|
const HiAnime = (apiKey) => AnimeFetch({
|
|
35
174
|
provider: 'hianime',
|
|
36
175
|
apiKey,
|
|
37
176
|
});
|
|
177
|
+
/**
|
|
178
|
+
* Creates a KickAssAnime API client.
|
|
179
|
+
*
|
|
180
|
+
* @param apiKey - Your API key for authentication
|
|
181
|
+
* @returns API client with methods: search, info, episodes, sources
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```ts
|
|
185
|
+
* const client = KickAssAnime(process.env.API_KEY);
|
|
186
|
+
* const results = await client.search("vinland saga");
|
|
187
|
+
* const sources = await client.sources({
|
|
188
|
+
* id: results[0].id,
|
|
189
|
+
* episodeId: "ep-1"
|
|
190
|
+
* });
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
38
193
|
const KickAssAnime = (apiKey) => AnimeFetch({
|
|
39
194
|
provider: 'kickassanime',
|
|
40
195
|
apiKey,
|
|
41
196
|
});
|
|
197
|
+
/**
|
|
198
|
+
* Creates a LunarAnime API client.
|
|
199
|
+
*
|
|
200
|
+
* @param apiKey - Your API key for authentication
|
|
201
|
+
* @returns API client with methods: search, info, episodes, sources
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```ts
|
|
205
|
+
* const client = LunarAnime(process.env.API_KEY);
|
|
206
|
+
* const results = await client.search("bleach");
|
|
207
|
+
* const info = await client.info(results[0].id);
|
|
208
|
+
* const episodes = await client.episodes(results[0].id);
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
42
211
|
const LunarAnime = (apiKey) => AnimeFetch({
|
|
43
212
|
provider: 'lunaranime',
|
|
44
213
|
apiKey,
|
|
45
214
|
});
|
|
215
|
+
/**
|
|
216
|
+
* Creates a UniqueStream API client.
|
|
217
|
+
*
|
|
218
|
+
* @param apiKey - Your API key for authentication
|
|
219
|
+
* @returns API client with methods: search, info, episodes, sources
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```ts
|
|
223
|
+
* const client = UniqueStream(process.env.API_KEY);
|
|
224
|
+
* const results = await client.search("solo leveling");
|
|
225
|
+
* const episodes = await client.episodes(results[0].id);
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
46
228
|
const UniqueStream = (apiKey) => AnimeFetch({
|
|
47
229
|
provider: 'uniquestream',
|
|
48
230
|
apiKey,
|
|
@@ -4,6 +4,8 @@ import type { HavenEpisodeMeta, HavenInfoMeta, HavenSourceMeta } from './hentaih
|
|
|
4
4
|
import type { HStreamSearchMeta } from './hstream';
|
|
5
5
|
declare const Hentai: {
|
|
6
6
|
HAnime: (apiKey: string) => {
|
|
7
|
+
name: string;
|
|
8
|
+
} & {
|
|
7
9
|
search: (q: string) => Promise<import("../types").Search<HAnimeSearchMeta>[]>;
|
|
8
10
|
info: (id: string | number) => Promise<import("../types").Info<HAnimeInfoMeta, import("../types").Episode<HianimeEpisodeMeta>>>;
|
|
9
11
|
episodes: (id: string | number) => Promise<import("../types").Episode<HianimeEpisodeMeta>[]>;
|
|
@@ -15,6 +17,8 @@ declare const Hentai: {
|
|
|
15
17
|
}) => Promise<import("../types").Source<unknown>>;
|
|
16
18
|
};
|
|
17
19
|
HentaiHaven: (apiKey: string) => {
|
|
20
|
+
name: string;
|
|
21
|
+
} & {
|
|
18
22
|
search: (q: string) => Promise<import("../types").Search<unknown>[]>;
|
|
19
23
|
info: (id: string | number) => Promise<import("../types").Info<HavenInfoMeta, import("../types").Episode<HavenEpisodeMeta>>>;
|
|
20
24
|
episodes: (id: string | number) => Promise<import("../types").Episode<HavenEpisodeMeta>[]>;
|
|
@@ -26,6 +30,8 @@ declare const Hentai: {
|
|
|
26
30
|
}) => Promise<import("../types").Source<HavenSourceMeta>>;
|
|
27
31
|
};
|
|
28
32
|
HStream: (apiKey: string) => {
|
|
33
|
+
name: string;
|
|
34
|
+
} & {
|
|
29
35
|
search: (q: string) => Promise<import("../types").Search<HStreamSearchMeta>[]>;
|
|
30
36
|
info: (id: string | number) => Promise<import("../types").Info<unknown, import("../types").Episode<unknown>>>;
|
|
31
37
|
episodes: (id: string | number) => Promise<import("../types").Episode<unknown>[]>;
|
|
@@ -1,12 +1,55 @@
|
|
|
1
1
|
import { HentaiFetch } from '../../helpers/fetch';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an HAnime API client.
|
|
4
|
+
*
|
|
5
|
+
* @param apiKey - Your API key for authentication
|
|
6
|
+
* @returns API client with methods: search, info, episodes, sources
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const client = HAnime(process.env.API_KEY);
|
|
11
|
+
* const results = await client.search("query");
|
|
12
|
+
* const info = await client.info(results[0].id);
|
|
13
|
+
* const episodes = await client.episodes(results[0].id);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
2
16
|
const HAnime = (apiKey) => HentaiFetch({
|
|
3
17
|
provider: 'hanime',
|
|
4
18
|
apiKey,
|
|
5
19
|
});
|
|
20
|
+
/**
|
|
21
|
+
* Creates a HentaiHaven API client.
|
|
22
|
+
*
|
|
23
|
+
* @param apiKey - Your API key for authentication
|
|
24
|
+
* @returns API client with methods: search, info, episodes, sources
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const client = HentaiHaven(process.env.API_KEY);
|
|
29
|
+
* const info = await client.info("content-id");
|
|
30
|
+
* const sources = await client.sources({
|
|
31
|
+
* id: "content-id",
|
|
32
|
+
* episodeId: "ep-1"
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
6
36
|
const HentaiHaven = (apiKey) => HentaiFetch({
|
|
7
37
|
provider: 'hentaihaven',
|
|
8
38
|
apiKey,
|
|
9
39
|
});
|
|
40
|
+
/**
|
|
41
|
+
* Creates an HStream API client.
|
|
42
|
+
*
|
|
43
|
+
* @param apiKey - Your API key for authentication
|
|
44
|
+
* @returns API client with methods: search, info, episodes, sources
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const client = HStream(process.env.API_KEY);
|
|
49
|
+
* const results = await client.search("query");
|
|
50
|
+
* const info = await client.info(results[0].id);
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
10
53
|
const HStream = (apiKey) => HentaiFetch({
|
|
11
54
|
provider: 'hstream',
|
|
12
55
|
apiKey,
|
|
@@ -3,8 +3,10 @@ import type { MDXInfoMeta, MDXSearchMeta } from './mangadex';
|
|
|
3
3
|
import type { MFInfoMeta, MFSearchMeta } from './mangafire';
|
|
4
4
|
declare const Manga: {
|
|
5
5
|
LunarManga: (apiKey: string) => {
|
|
6
|
+
name: string;
|
|
7
|
+
} & {
|
|
6
8
|
search: (q: string) => Promise<import("../types").Search<LMangaSearchMeta>[]>;
|
|
7
|
-
info: (id: string | number) => Promise<import("../types").Info<LMangaInfoMeta, unknown
|
|
9
|
+
info: (id: string | number) => Promise<import("../types").Info<LMangaInfoMeta, import("../types").Episode<unknown>>>;
|
|
8
10
|
chapters: (id: string | number) => Promise<import("../types").Chapter<unknown>[]>;
|
|
9
11
|
pages: (params: {
|
|
10
12
|
id: string | number;
|
|
@@ -13,8 +15,10 @@ declare const Manga: {
|
|
|
13
15
|
}) => Promise<import("../types").Page[]>;
|
|
14
16
|
};
|
|
15
17
|
MangaDex: (apiKey: string) => {
|
|
18
|
+
name: string;
|
|
19
|
+
} & {
|
|
16
20
|
search: (q: string) => Promise<import("../types").Search<MDXSearchMeta>[]>;
|
|
17
|
-
info: (id: string | number) => Promise<import("../types").Info<MDXInfoMeta, unknown
|
|
21
|
+
info: (id: string | number) => Promise<import("../types").Info<MDXInfoMeta, import("../types").Episode<unknown>>>;
|
|
18
22
|
chapters: (id: string | number) => Promise<import("../types").Chapter<unknown>[]>;
|
|
19
23
|
pages: (params: {
|
|
20
24
|
id: string | number;
|
|
@@ -23,8 +27,10 @@ declare const Manga: {
|
|
|
23
27
|
}) => Promise<import("../types").Page[]>;
|
|
24
28
|
};
|
|
25
29
|
MangaFire: (apiKey: string) => {
|
|
30
|
+
name: string;
|
|
31
|
+
} & {
|
|
26
32
|
search: (q: string) => Promise<import("../types").Search<MFSearchMeta>[]>;
|
|
27
|
-
info: (id: string | number) => Promise<import("../types").Info<MFInfoMeta, unknown
|
|
33
|
+
info: (id: string | number) => Promise<import("../types").Info<MFInfoMeta, import("../types").Episode<unknown>>>;
|
|
28
34
|
chapters: (id: string | number) => Promise<import("../types").Chapter<unknown>[]>;
|
|
29
35
|
pages: (params: {
|
|
30
36
|
id: string | number;
|
package/dist/core/manga/index.js
CHANGED
|
@@ -1,12 +1,64 @@
|
|
|
1
1
|
import { MangaFetch } from '../../helpers/fetch';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a LunarManga API client.
|
|
4
|
+
*
|
|
5
|
+
* @param apiKey - Your API key for authentication
|
|
6
|
+
* @returns API client with methods: search, info, chapters, pages
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const client = LunarManga(process.env.API_KEY);
|
|
11
|
+
* const results = await client.search("one piece");
|
|
12
|
+
* const info = await client.info(results[0].id);
|
|
13
|
+
* const chapters = await client.chapters(results[0].id);
|
|
14
|
+
* const pages = await client.pages({
|
|
15
|
+
* id: results[0].id,
|
|
16
|
+
* chapterId: chapters[0].id
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
2
20
|
const LunarManga = (apiKey) => MangaFetch({
|
|
3
21
|
provider: 'lunarmanga',
|
|
4
22
|
apiKey,
|
|
5
23
|
});
|
|
24
|
+
/**
|
|
25
|
+
* Creates a MangaDex API client.
|
|
26
|
+
*
|
|
27
|
+
* **Popular provider with multi-language support.**
|
|
28
|
+
*
|
|
29
|
+
* @param apiKey - Your API key for authentication
|
|
30
|
+
* @returns API client with methods: search, info, chapters, pages
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const client = MangaDex(process.env.API_KEY);
|
|
35
|
+
* const results = await client.search("chainsaw man");
|
|
36
|
+
* const chapters = await client.chapters(results[0].id);
|
|
37
|
+
* const pages = await client.pages({
|
|
38
|
+
* id: results[0].id,
|
|
39
|
+
* chapterId: chapters[0].id,
|
|
40
|
+
* lang: "en"
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
6
44
|
const MangaDex = (apiKey) => MangaFetch({
|
|
7
45
|
provider: 'mangadex',
|
|
8
46
|
apiKey,
|
|
9
47
|
});
|
|
48
|
+
/**
|
|
49
|
+
* Creates a MangaFire API client.
|
|
50
|
+
*
|
|
51
|
+
* @param apiKey - Your API key for authentication
|
|
52
|
+
* @returns API client with methods: search, info, chapters, pages
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const client = MangaFire(process.env.API_KEY);
|
|
57
|
+
* const results = await client.search("berserk");
|
|
58
|
+
* const info = await client.info(results[0].id);
|
|
59
|
+
* const chapters = await client.chapters(results[0].id);
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
10
62
|
const MangaFire = (apiKey) => MangaFetch({
|
|
11
63
|
provider: 'mangafire',
|
|
12
64
|
apiKey,
|
|
@@ -1,7 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a Mapper API client for converting between provider IDs.
|
|
3
|
+
*
|
|
4
|
+
* **Use this to map AniList IDs to provider-specific IDs.**
|
|
5
|
+
*
|
|
6
|
+
* @param apiKey - Your API key for authentication
|
|
7
|
+
* @returns API client with method: map
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const mapper = Mapper(process.env.API_KEY);
|
|
12
|
+
*
|
|
13
|
+
* // Map AniList ID to provider ID
|
|
14
|
+
* const mapping = await mapper.map({
|
|
15
|
+
* id: 21, // AniList ID for "One Piece"
|
|
16
|
+
* provider: "animepahe"
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* console.log(mapping.idMap); // Provider-specific ID
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
1
22
|
declare const Mapper: (apiKey: string) => {
|
|
23
|
+
name: string;
|
|
24
|
+
} & {
|
|
2
25
|
map: (params: {
|
|
3
26
|
id: number;
|
|
4
27
|
provider: string;
|
|
5
|
-
}) => Promise<
|
|
28
|
+
}) => Promise<import("./types").Mapping>;
|
|
6
29
|
};
|
|
7
30
|
export { Mapper };
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
import { MapperFetch } from '../../helpers/fetch';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a Mapper API client for converting between provider IDs.
|
|
4
|
+
*
|
|
5
|
+
* **Use this to map AniList IDs to provider-specific IDs.**
|
|
6
|
+
*
|
|
7
|
+
* @param apiKey - Your API key for authentication
|
|
8
|
+
* @returns API client with method: map
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const mapper = Mapper(process.env.API_KEY);
|
|
13
|
+
*
|
|
14
|
+
* // Map AniList ID to provider ID
|
|
15
|
+
* const mapping = await mapper.map({
|
|
16
|
+
* id: 21, // AniList ID for "One Piece"
|
|
17
|
+
* provider: "animepahe"
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* console.log(mapping.idMap); // Provider-specific ID
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
2
23
|
const Mapper = (apiKey) => MapperFetch({
|
|
3
24
|
provider: 'mapper',
|
|
4
25
|
apiKey,
|
|
@@ -2,12 +2,16 @@ import type { MInfoMeta, MSearchMeta } from './myanimelist';
|
|
|
2
2
|
import type { MMLInfoMeta, MMSearchMeta } from './mymangalist';
|
|
3
3
|
declare const Meta: {
|
|
4
4
|
MyAnimeList: (apiKey: string) => {
|
|
5
|
+
name: string;
|
|
6
|
+
} & {
|
|
5
7
|
search: (q: string) => Promise<import("../types").Search<MSearchMeta>[]>;
|
|
6
|
-
info: (id: string | number) => Promise<import("../types").Info<MInfoMeta, unknown
|
|
8
|
+
info: (id: string | number) => Promise<import("../types").Info<MInfoMeta, import("../types").Episode<unknown>>>;
|
|
7
9
|
};
|
|
8
10
|
MyMangaList: (apiKey: string) => {
|
|
11
|
+
name: string;
|
|
12
|
+
} & {
|
|
9
13
|
search: (q: string) => Promise<import("../types").Search<MMSearchMeta>[]>;
|
|
10
|
-
info: (id: string | number) => Promise<import("../types").Info<MMLInfoMeta, unknown
|
|
14
|
+
info: (id: string | number) => Promise<import("../types").Info<MMLInfoMeta, import("../types").Episode<unknown>>>;
|
|
11
15
|
};
|
|
12
16
|
};
|
|
13
17
|
export { Meta };
|
package/dist/core/meta/index.js
CHANGED
|
@@ -1,8 +1,48 @@
|
|
|
1
1
|
import { MetaFetch } from '../../helpers/fetch';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a MyAnimeList API client for anime metadata.
|
|
4
|
+
*
|
|
5
|
+
* **Provides comprehensive anime information and statistics from MyAnimeList.**
|
|
6
|
+
*
|
|
7
|
+
* @param apiKey - Your API key for authentication
|
|
8
|
+
* @returns API client with methods: search, info
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const mal = MyAnimeList(process.env.API_KEY);
|
|
13
|
+
*
|
|
14
|
+
* // Search for anime
|
|
15
|
+
* const results = await mal.search("steins gate");
|
|
16
|
+
*
|
|
17
|
+
* // Get detailed info with MAL ratings, stats, and metadata
|
|
18
|
+
* const info = await mal.info(results[0].id);
|
|
19
|
+
* console.log(info.score, info.rank, info.popularity);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
2
22
|
const MyAnimeList = (apiKey) => MetaFetch({
|
|
3
23
|
provider: 'myanimelist',
|
|
4
24
|
apiKey,
|
|
5
25
|
});
|
|
26
|
+
/**
|
|
27
|
+
* Creates a MyMangaList API client for manga metadata.
|
|
28
|
+
*
|
|
29
|
+
* **Provides comprehensive manga information and statistics from MyAnimeList.**
|
|
30
|
+
*
|
|
31
|
+
* @param apiKey - Your API key for authentication
|
|
32
|
+
* @returns API client with methods: search, info
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const mml = MyMangaList(process.env.API_KEY);
|
|
37
|
+
*
|
|
38
|
+
* // Search for manga
|
|
39
|
+
* const results = await mml.search("berserk");
|
|
40
|
+
*
|
|
41
|
+
* // Get detailed info with MAL ratings, stats, and metadata
|
|
42
|
+
* const info = await mml.info(results[0].id);
|
|
43
|
+
* console.log(info.score, info.rank, info.members);
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
6
46
|
const MyMangaList = (apiKey) => MetaFetch({
|
|
7
47
|
provider: 'mymangalist',
|
|
8
48
|
apiKey,
|
package/dist/core/types.d.ts
CHANGED
|
@@ -99,3 +99,9 @@ export interface Source<T = unknown> {
|
|
|
99
99
|
thumbnails?: string | null;
|
|
100
100
|
metadata?: T | null;
|
|
101
101
|
}
|
|
102
|
+
export interface Server<T = unknown> {
|
|
103
|
+
id?: string | number | null;
|
|
104
|
+
name?: string | null;
|
|
105
|
+
type?: string | null;
|
|
106
|
+
metadata?: T | null;
|
|
107
|
+
}
|
package/dist/helpers/fetch.d.ts
CHANGED
|
@@ -1,49 +1,78 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Mapping } from '../core/mapper/types';
|
|
2
|
+
import type { Chapter, Episode, Info, Page, Search, Server, Source } from '../core/types';
|
|
3
|
+
type SearchRoute<T = unknown> = (q: string) => Promise<Search<T>[]>;
|
|
4
|
+
type InfoRoute<T = unknown, E = unknown> = (id: string | number) => Promise<Info<T, E>>;
|
|
5
|
+
type EpisodesRoute<T = unknown> = (id: string | number) => Promise<Episode<T>[]>;
|
|
6
|
+
type SourcesRoute<T> = (params: {
|
|
7
|
+
id: string | number;
|
|
8
|
+
episodeId: string | number;
|
|
9
|
+
subType?: string;
|
|
10
|
+
server?: string;
|
|
11
|
+
}) => Promise<Source<T>>;
|
|
12
|
+
type ServersRoute<T> = (params: {
|
|
13
|
+
id: string | number;
|
|
14
|
+
episodeId: string | number;
|
|
15
|
+
}) => Promise<Server<T>>;
|
|
16
|
+
type ChaptersRoute<T = unknown> = (id: string | number) => Promise<Chapter<T>[]>;
|
|
17
|
+
type PagesRoute = (params: {
|
|
18
|
+
id: string | number;
|
|
19
|
+
chapterId: string | number;
|
|
20
|
+
lang?: string;
|
|
21
|
+
}) => Promise<Page[]>;
|
|
22
|
+
type MapRoute = (params: {
|
|
23
|
+
id: number;
|
|
24
|
+
provider: string;
|
|
25
|
+
}) => Promise<Mapping>;
|
|
26
|
+
type RouteMap<TSearchMeta = unknown, TInfoMeta = unknown, TEpisodeMeta = unknown, TSourceMeta = unknown, TServerMeta = unknown, TChapterMeta = unknown> = {
|
|
27
|
+
search: SearchRoute<TSearchMeta>;
|
|
28
|
+
info: InfoRoute<TInfoMeta, Episode<TEpisodeMeta>>;
|
|
29
|
+
episodes: EpisodesRoute<TEpisodeMeta>;
|
|
30
|
+
sources: SourcesRoute<TSourceMeta>;
|
|
31
|
+
servers: ServersRoute<TServerMeta>;
|
|
32
|
+
chapters: ChaptersRoute<TChapterMeta>;
|
|
33
|
+
pages: PagesRoute;
|
|
34
|
+
map: MapRoute;
|
|
35
|
+
};
|
|
36
|
+
type SelectRoutes = {
|
|
37
|
+
[K in keyof RouteMap]?: boolean;
|
|
38
|
+
};
|
|
39
|
+
type BuildRoutes<T extends SelectRoutes, TSearchMeta = unknown, TInfoMeta = unknown, TEpisodeMeta = unknown, TSourceMeta = unknown, TServerMeta = unknown, TChapterMeta = unknown> = {
|
|
40
|
+
name: string;
|
|
41
|
+
} & {
|
|
42
|
+
[K in keyof T & keyof RouteMap as T[K] extends true ? K : never]: RouteMap<TSearchMeta, TInfoMeta, TEpisodeMeta, TSourceMeta, TServerMeta, TChapterMeta>[K];
|
|
43
|
+
};
|
|
44
|
+
type BuildAnimeRoutes<T extends SelectRoutes, TSearchMeta = unknown, TInfoMeta = unknown, TEpisodeMeta = unknown, TSourceMeta = unknown, TServerMeta = unknown> = BuildRoutes<T, TSearchMeta, TInfoMeta, TEpisodeMeta, TSourceMeta, TServerMeta>;
|
|
45
|
+
type BuildMangaRoutes<T extends SelectRoutes, TSearchMeta = unknown, TInfoMeta = unknown, TChapterMeta = unknown> = BuildRoutes<T, TSearchMeta, TInfoMeta, unknown, unknown, unknown, TChapterMeta>;
|
|
46
|
+
type BuildMetaRoutes<T extends SelectRoutes, TSearchMeta = unknown, TInfoMeta = unknown> = BuildRoutes<T, TSearchMeta, TInfoMeta>;
|
|
2
47
|
interface FetchModuleConfig {
|
|
3
48
|
baseUrl?: string;
|
|
4
49
|
provider: string;
|
|
5
50
|
apiKey: string;
|
|
51
|
+
select?: SelectRoutes;
|
|
6
52
|
}
|
|
7
|
-
export declare const AnimeFetch: <TSearchMeta = unknown, TInfoMeta = unknown, TEpisodeMeta = unknown, TSourceMeta = unknown
|
|
8
|
-
search:
|
|
9
|
-
info:
|
|
10
|
-
episodes:
|
|
11
|
-
sources:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
export declare const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
chapters: (id: string | number) => Promise<Chapter<TChapterMeta>[]>;
|
|
33
|
-
pages: (params: {
|
|
34
|
-
id: string | number;
|
|
35
|
-
chapterId: string | number;
|
|
36
|
-
lang?: string;
|
|
37
|
-
}) => Promise<Page[]>;
|
|
38
|
-
};
|
|
39
|
-
export declare const MetaFetch: <TSearchMeta = unknown, TInfoMeta = unknown>(config: FetchModuleConfig) => {
|
|
40
|
-
search: (q: string) => Promise<Search<TSearchMeta>[]>;
|
|
41
|
-
info: (id: string | number) => Promise<Info<TInfoMeta, unknown>>;
|
|
42
|
-
};
|
|
43
|
-
export declare const MapperFetch: (config: FetchModuleConfig) => {
|
|
44
|
-
map: (params: {
|
|
45
|
-
id: number;
|
|
46
|
-
provider: string;
|
|
47
|
-
}) => Promise<unknown>;
|
|
48
|
-
};
|
|
53
|
+
export declare const AnimeFetch: <TSearchMeta = unknown, TInfoMeta = unknown, TEpisodeMeta = unknown, TSourceMeta = unknown, TServerMeta = unknown, S extends SelectRoutes = {
|
|
54
|
+
search: true;
|
|
55
|
+
info: true;
|
|
56
|
+
episodes: true;
|
|
57
|
+
sources: true;
|
|
58
|
+
}>(config: FetchModuleConfig) => BuildAnimeRoutes<S, TSearchMeta, TInfoMeta, TEpisodeMeta, TSourceMeta, TServerMeta>;
|
|
59
|
+
export declare const HentaiFetch: <TSearchMeta = unknown, TInfoMeta = unknown, TEpisodeMeta = unknown, TSourceMeta = unknown, TServerMeta = unknown, S extends SelectRoutes = {
|
|
60
|
+
search: true;
|
|
61
|
+
info: true;
|
|
62
|
+
episodes: true;
|
|
63
|
+
sources: true;
|
|
64
|
+
}>(config: FetchModuleConfig) => BuildAnimeRoutes<S, TSearchMeta, TInfoMeta, TEpisodeMeta, TSourceMeta, TServerMeta>;
|
|
65
|
+
export declare const MangaFetch: <TSearchMeta = unknown, TInfoMeta = unknown, TChapterMeta = unknown, S extends SelectRoutes = {
|
|
66
|
+
search: true;
|
|
67
|
+
info: true;
|
|
68
|
+
chapters: true;
|
|
69
|
+
pages: true;
|
|
70
|
+
}>(config: FetchModuleConfig) => BuildMangaRoutes<S, TSearchMeta, TInfoMeta, TChapterMeta>;
|
|
71
|
+
export declare const MetaFetch: <TSearchMeta = unknown, TInfoMeta = unknown, S extends SelectRoutes = {
|
|
72
|
+
search: true;
|
|
73
|
+
info: true;
|
|
74
|
+
}>(config: FetchModuleConfig) => BuildMetaRoutes<S, TSearchMeta, TInfoMeta>;
|
|
75
|
+
export declare const MapperFetch: (config: FetchModuleConfig) => BuildRoutes<{
|
|
76
|
+
map: true;
|
|
77
|
+
}>;
|
|
49
78
|
export {};
|
package/dist/helpers/fetch.js
CHANGED
|
@@ -23,101 +23,48 @@ export const AnimeFetch = (config) => {
|
|
|
23
23
|
const { baseUrl = 'https://api.crysoline.moe', provider, apiKey } = config;
|
|
24
24
|
const basePath = `${baseUrl}/api/anime/${provider}/`;
|
|
25
25
|
const fetcher = fetchFn(basePath, apiKey);
|
|
26
|
-
/**
|
|
27
|
-
* Search for anime by query string.
|
|
28
|
-
*
|
|
29
|
-
* @param q - Search query.
|
|
30
|
-
*/
|
|
31
26
|
const search = async (q) => fetcher('search', { q });
|
|
32
|
-
/**
|
|
33
|
-
* Fetch detailed info for a given anime id.
|
|
34
|
-
*
|
|
35
|
-
* @param id - Anime identifier (string or number)
|
|
36
|
-
*/
|
|
37
27
|
const info = async (id) => fetcher(`info/${encodeURIComponent(id)}`);
|
|
38
|
-
/**
|
|
39
|
-
* Fetch episodes list for a given anime id.
|
|
40
|
-
*
|
|
41
|
-
* @param id - Anime identifier (string or number)
|
|
42
|
-
*/
|
|
43
28
|
const episodes = async (id) => fetcher(`episodes/${encodeURIComponent(id)}`);
|
|
44
|
-
/**
|
|
45
|
-
* Fetch sources for a particular episode.
|
|
46
|
-
*
|
|
47
|
-
* @param params - Object containing `id`, `episodeId` and optional `subType` and `server`
|
|
48
|
-
*/
|
|
49
29
|
const sources = (params) => fetcher('sources', params);
|
|
30
|
+
const servers = (params) => fetcher('servers', params);
|
|
50
31
|
return {
|
|
32
|
+
name: provider,
|
|
51
33
|
search,
|
|
52
34
|
info,
|
|
53
35
|
episodes,
|
|
54
36
|
sources,
|
|
37
|
+
servers,
|
|
55
38
|
};
|
|
56
39
|
};
|
|
57
40
|
export const HentaiFetch = (config) => {
|
|
58
41
|
const { baseUrl = 'https://api.crysoline.moe', provider, apiKey } = config;
|
|
59
42
|
const basePath = `${baseUrl}/api/hentai/${provider}/`;
|
|
60
43
|
const fetcher = fetchFn(basePath, apiKey);
|
|
61
|
-
/**
|
|
62
|
-
* Search for hentai by query string.
|
|
63
|
-
*
|
|
64
|
-
* @param q - Search query.
|
|
65
|
-
*/
|
|
66
44
|
const search = async (q) => fetcher('search', { q });
|
|
67
|
-
/**
|
|
68
|
-
* Get detailed info for an item by id.
|
|
69
|
-
*
|
|
70
|
-
* @param id - Item identifier.
|
|
71
|
-
*/
|
|
72
45
|
const info = async (id) => fetcher(`info/${encodeURIComponent(id)}`);
|
|
73
|
-
/**
|
|
74
|
-
* List episodes for a specific item.
|
|
75
|
-
*
|
|
76
|
-
* @param id - Item identifier.
|
|
77
|
-
*/
|
|
78
46
|
const episodes = async (id) => fetcher(`episodes/${encodeURIComponent(id)}`);
|
|
79
|
-
/**
|
|
80
|
-
* Get sources for a specific episode.
|
|
81
|
-
*
|
|
82
|
-
* @param params - Parameters to identify the episode and optional filters.
|
|
83
|
-
*/
|
|
84
47
|
const sources = (params) => fetcher('sources', params);
|
|
48
|
+
const servers = (params) => fetcher('servers', params);
|
|
85
49
|
return {
|
|
50
|
+
name: provider,
|
|
86
51
|
search,
|
|
87
52
|
info,
|
|
88
53
|
episodes,
|
|
89
54
|
sources,
|
|
55
|
+
servers,
|
|
90
56
|
};
|
|
91
57
|
};
|
|
92
58
|
export const MangaFetch = (config) => {
|
|
93
59
|
const { baseUrl = 'https://api.crysoline.moe', provider, apiKey } = config;
|
|
94
60
|
const basePath = `${baseUrl}/api/manga/${provider}/`;
|
|
95
61
|
const fetcher = fetchFn(basePath, apiKey);
|
|
96
|
-
/**
|
|
97
|
-
* Search for manga by query string.
|
|
98
|
-
*
|
|
99
|
-
* @param q - Search query.
|
|
100
|
-
*/
|
|
101
62
|
const search = async (q) => fetcher('search', { q });
|
|
102
|
-
/**
|
|
103
|
-
* Get detailed info for a manga by id.
|
|
104
|
-
*
|
|
105
|
-
* @param id - Manga identifier.
|
|
106
|
-
*/
|
|
107
63
|
const info = async (id) => fetcher(`info/${encodeURIComponent(id)}`);
|
|
108
|
-
/**
|
|
109
|
-
* List chapters for a specific manga.
|
|
110
|
-
*
|
|
111
|
-
* @param id - Manga identifier.
|
|
112
|
-
*/
|
|
113
64
|
const chapters = async (id) => fetcher(`chapters/${encodeURIComponent(id)}`);
|
|
114
|
-
/**
|
|
115
|
-
* Fetch pages for a specific manga chapter.
|
|
116
|
-
*
|
|
117
|
-
* @param params - Object containing `id`, `chapterId` and optional `lang`
|
|
118
|
-
*/
|
|
119
65
|
const pages = (params) => fetcher('pages', params);
|
|
120
66
|
return {
|
|
67
|
+
name: provider,
|
|
121
68
|
search,
|
|
122
69
|
info,
|
|
123
70
|
chapters,
|
|
@@ -128,19 +75,10 @@ export const MetaFetch = (config) => {
|
|
|
128
75
|
const { baseUrl = 'https://api.crysoline.moe', provider, apiKey } = config;
|
|
129
76
|
const basePath = `${baseUrl}/api/meta/${provider}/`;
|
|
130
77
|
const fetcher = fetchFn(basePath, apiKey);
|
|
131
|
-
/**
|
|
132
|
-
* Search meta provider by query string.
|
|
133
|
-
*
|
|
134
|
-
* @param q - Search query.
|
|
135
|
-
*/
|
|
136
78
|
const search = async (q) => fetcher('search', { q });
|
|
137
|
-
/**
|
|
138
|
-
* Get info from meta provider by id.
|
|
139
|
-
*
|
|
140
|
-
* @param id - Resource identifier.
|
|
141
|
-
*/
|
|
142
79
|
const info = async (id) => fetcher(`info/${encodeURIComponent(id)}`);
|
|
143
80
|
return {
|
|
81
|
+
name: provider,
|
|
144
82
|
search,
|
|
145
83
|
info,
|
|
146
84
|
};
|
|
@@ -149,11 +87,6 @@ export const MapperFetch = (config) => {
|
|
|
149
87
|
const { baseUrl = 'https://api.crysoline.moe', provider, apiKey } = config;
|
|
150
88
|
const basePath = `${baseUrl}/api/mapper/${provider}`;
|
|
151
89
|
const fetcher = fetchFn(basePath, apiKey);
|
|
152
|
-
/**
|
|
153
|
-
* Map an id from one provider to another.
|
|
154
|
-
*
|
|
155
|
-
* @param params - Mapping parameters: `id` to map and `provider` to map to.
|
|
156
|
-
*/
|
|
157
90
|
const map = async (params) => fetcher('map', params);
|
|
158
91
|
return {
|
|
159
92
|
map,
|
package/package.json
CHANGED
|
@@ -2,17 +2,27 @@
|
|
|
2
2
|
"name": "@crysoline/lib",
|
|
3
3
|
"description": "The official crysoline library for anime, manga using the Crysoline API",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.3",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
|
-
"files": [
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
10
12
|
"exports": {
|
|
11
13
|
".": {
|
|
12
14
|
"types": "./dist/index.d.ts",
|
|
13
15
|
"default": "./dist/index.js"
|
|
14
16
|
}
|
|
15
17
|
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/crysoline/crysoline-lib.git"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/crysoline/crysoline-lib",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/crysoline/crysoline-lib/issues"
|
|
25
|
+
},
|
|
16
26
|
"scripts": {
|
|
17
27
|
"build": "tsc",
|
|
18
28
|
"prepublishOnly": "npm run build",
|