@kuriyona/cecilia 0.2.0 → 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.
package/dist/index.d.mts CHANGED
@@ -1,55 +1,451 @@
1
- //#region src/types/Lyric.d.ts
2
- interface Lyric {
3
- lines: LyricLine[];
4
- translator?: {
5
- id: number;
6
- nickname: string;
7
- };
1
+ //#region src/client.d.ts
2
+ type Crypto = "eapi" | "weapi" | "api";
3
+ interface RequestOptions {
4
+ cookie?: string | Record<string, string>;
5
+ realIP?: string;
6
+ timeout?: number;
7
+ ua?: string;
8
8
  }
9
- type LyricLine = {
10
- time: number;
11
- text: string;
12
- translation?: string;
13
- };
9
+ interface RawResponse {
10
+ status: number;
11
+ body: unknown;
12
+ cookies: string[];
13
+ }
14
+ declare function request(uri: string, data: Record<string, unknown>, crypto: Crypto, options?: RequestOptions, acceptCodes?: number[]): Promise<RawResponse>;
15
+ //#endregion
16
+ //#region src/types/common.d.ts
17
+ /** 全库统一语义词表。字段名不得在本文件之外重新发明。 */
18
+ interface UserRef {
19
+ id: number;
20
+ name: string;
21
+ }
22
+ interface ArtistRef {
23
+ id: number;
24
+ name: string;
25
+ }
26
+ interface AlbumRef {
27
+ id: number;
28
+ name: string;
29
+ coverUrl: string;
30
+ }
31
+ interface Song {
32
+ id: number;
33
+ name: string;
34
+ artists: ArtistRef[];
35
+ album: AlbumRef;
36
+ duration: number;
37
+ alias?: string[];
38
+ fee?: number;
39
+ available?: boolean;
40
+ }
41
+ interface Artist {
42
+ id: number;
43
+ name: string;
44
+ alias?: string[];
45
+ avatarUrl?: string;
46
+ briefDesc?: string;
47
+ albumCount?: number;
48
+ songCount?: number;
49
+ mvCount?: number;
50
+ followed?: boolean;
51
+ topSongs?: Song[];
52
+ }
53
+ interface Album {
54
+ id: number;
55
+ name: string;
56
+ coverUrl: string;
57
+ artists?: ArtistRef[];
58
+ publishTime?: number;
59
+ company?: string;
60
+ description?: string;
61
+ size?: number;
62
+ songs?: Song[];
63
+ }
64
+ interface PlaylistSummary {
65
+ id: number;
66
+ name: string;
67
+ coverUrl: string;
68
+ trackCount?: number;
69
+ playCount?: number;
70
+ creator?: UserRef;
71
+ description?: string;
72
+ updateTime?: number;
73
+ tags?: string[];
74
+ }
75
+ interface SongUrl {
76
+ id: number;
77
+ url: string | null;
78
+ br: number;
79
+ size: number;
80
+ level?: string;
81
+ fee?: number;
82
+ freeTrialInfo?: {
83
+ start: number;
84
+ end: number;
85
+ } | null;
86
+ }
87
+ interface MvRef {
88
+ id: number;
89
+ name: string;
90
+ coverUrl: string;
91
+ playCount?: number;
92
+ duration?: number;
93
+ artistName?: string;
94
+ }
95
+ interface VideoRef {
96
+ id: number;
97
+ name: string;
98
+ coverUrl: string;
99
+ playCount?: number;
100
+ duration?: number;
101
+ creator?: UserRef;
102
+ }
103
+ //#endregion
104
+ //#region src/types/search.d.ts
105
+ type SearchType = 1 | 10 | 100 | 1000 | 1002 | 1004 | 1006 | 1009 | 1014 | 2000;
106
+ interface SearchLyric {
107
+ id: number;
108
+ name: string;
109
+ artists: ArtistRef[];
110
+ }
111
+ interface SearchRadio {
112
+ id: number;
113
+ name: string;
114
+ coverUrl: string;
115
+ djName?: string;
116
+ }
117
+ interface SearchResult {
118
+ songs?: Song[];
119
+ artists?: Artist[];
120
+ albums?: Album[];
121
+ playlists?: PlaylistSummary[];
122
+ users?: UserRef[];
123
+ mvs?: MvRef[];
124
+ videos?: VideoRef[];
125
+ lyrics?: SearchLyric[];
126
+ radios?: SearchRadio[];
127
+ total?: number;
128
+ }
129
+ interface SearchSuggest {
130
+ keywords: string[];
131
+ songs: Song[];
132
+ artists: Artist[];
133
+ albums: Album[];
134
+ }
135
+ interface HotSearchGroup {
136
+ first: string;
137
+ second?: string | number;
138
+ third?: string;
139
+ }
140
+ interface HotSearchItem {
141
+ keyword: string;
142
+ position: number;
143
+ content?: string;
144
+ iconUrl?: string;
145
+ }
146
+ //#endregion
147
+ //#region src/types/params.d.ts
148
+ interface SearchParams {
149
+ keywords: string;
150
+ type?: SearchType;
151
+ limit?: number;
152
+ offset?: number;
153
+ }
154
+ interface SearchSuggestParams {
155
+ keywords?: string;
156
+ mobile?: boolean;
157
+ }
158
+ interface SearchMultimatchParams {
159
+ keywords?: string;
160
+ type?: SearchType;
161
+ }
162
+ interface SongUrlParams {
163
+ id: number | number[];
164
+ br?: number;
165
+ }
166
+ interface CheckMusicParams {
167
+ id: number;
168
+ br?: number;
169
+ }
170
+ interface PlaylistTracksParams {
171
+ id: number;
172
+ limit?: number;
173
+ offset?: number;
174
+ }
175
+ interface TopPlaylistsParams {
176
+ cat?: string;
177
+ order?: "hot" | "new";
178
+ limit?: number;
179
+ offset?: number;
180
+ }
181
+ interface HighQualityPlaylistsParams {
182
+ cat?: string;
183
+ limit?: number;
184
+ before?: number;
185
+ }
186
+ interface ArtistSongsParams {
187
+ id: number;
188
+ order?: "hot" | "time";
189
+ limit?: number;
190
+ offset?: number;
191
+ }
192
+ interface ArtistAlbumsParams {
193
+ id: number;
194
+ limit?: number;
195
+ offset?: number;
196
+ }
197
+ interface ArtistListParams {
198
+ area?: number;
199
+ type?: number;
200
+ initial?: string | number;
201
+ limit?: number;
202
+ offset?: number;
203
+ }
204
+ interface ArtistMvsParams {
205
+ id: number;
206
+ limit?: number;
207
+ offset?: number;
208
+ }
209
+ interface ArtistVideosParams {
210
+ id: number;
211
+ size?: number;
212
+ cursor?: number;
213
+ order?: number;
214
+ }
215
+ interface AlbumSaleBoardParams {
216
+ albumType?: 0 | 1;
217
+ type?: "daily" | "week" | "year" | "total";
218
+ year?: number;
219
+ }
220
+ interface AlbumListParams {
221
+ area?: string;
222
+ type?: string;
223
+ limit?: number;
224
+ offset?: number;
225
+ }
226
+ //#endregion
227
+ //#region src/types/album.d.ts
228
+ interface AlbumPage {
229
+ total?: number;
230
+ more?: boolean;
231
+ albums: Album[];
232
+ }
233
+ interface AlbumProduct {
234
+ id: number;
235
+ name: string;
236
+ coverUrl: string;
237
+ artistName?: string;
238
+ price?: number;
239
+ publishTime?: number;
240
+ description?: string;
241
+ }
242
+ interface AlbumStats {
243
+ commentCount?: number;
244
+ shareCount?: number;
245
+ subCount?: number;
246
+ likedCount?: number;
247
+ isSub?: boolean;
248
+ }
249
+ interface AlbumSaleBoard {
250
+ albums: Album[];
251
+ updateTime?: number;
252
+ }
253
+ interface AlbumPrivilege {
254
+ id: number;
255
+ maxBrLevel?: string;
256
+ playMaxBrLevel?: string;
257
+ downloadMaxBrLevel?: string;
258
+ pl?: number;
259
+ dl?: number;
260
+ fl?: number;
261
+ st?: number;
262
+ fee?: number;
263
+ }
264
+ //#endregion
265
+ //#region src/apis/album.d.ts
266
+ declare const getAlbum: (id: number, options?: RequestOptions) => Promise<Album>;
267
+ declare const getAlbumProduct: (id: number, options?: RequestOptions) => Promise<AlbumProduct>;
268
+ declare const getAlbumDynamic: (id: number, options?: RequestOptions) => Promise<AlbumStats>;
269
+ declare const getAlbumSaleBoard: (params: AlbumSaleBoardParams, options?: RequestOptions) => Promise<AlbumSaleBoard>;
270
+ declare const getAlbumPrivileges: (id: number, options?: RequestOptions) => Promise<AlbumPrivilege[]>;
271
+ declare const getAlbumList: (params: AlbumListParams, options?: RequestOptions) => Promise<AlbumPage>;
272
+ declare const getNewestAlbums: (options?: RequestOptions) => Promise<Album[]>;
273
+ //#endregion
274
+ //#region src/types/artist.d.ts
275
+ interface ArtistPage {
276
+ total?: number;
277
+ more?: boolean;
278
+ artists: Artist[];
279
+ }
280
+ interface ArtistDescription {
281
+ briefDesc: string;
282
+ sections: {
283
+ title: string;
284
+ text: string;
285
+ }[];
286
+ }
287
+ interface ArtistVideoPage {
288
+ hasMore: boolean;
289
+ videos: VideoRef[];
290
+ }
291
+ //#endregion
292
+ //#region src/apis/artist.d.ts
293
+ declare const getArtist: (id: number, options?: RequestOptions) => Promise<Artist>;
294
+ declare const getArtistDetail: (id: number, options?: RequestOptions) => Promise<Artist>;
295
+ declare const getArtistSongs: (params: ArtistSongsParams, options?: RequestOptions) => Promise<Song[]>;
296
+ declare const getArtistTopSongs: (id: number, options?: RequestOptions) => Promise<Song[]>;
297
+ declare const getArtistAlbums: (params: ArtistAlbumsParams, options?: RequestOptions) => Promise<AlbumPage>;
298
+ declare const getArtistList: (params: ArtistListParams, options?: RequestOptions) => Promise<ArtistPage>;
299
+ declare const getArtistDesc: (id: number, options?: RequestOptions) => Promise<ArtistDescription>;
300
+ declare const getArtistMvs: (params: ArtistMvsParams, options?: RequestOptions) => Promise<MvRef[]>;
301
+ declare const getArtistVideos: (params: ArtistVideosParams, options?: RequestOptions) => Promise<ArtistVideoPage>;
14
302
  //#endregion
15
303
  //#region src/types/PlaylistDetail.d.ts
16
- interface PlaylistDetails {
304
+ interface PlaylistDetail {
17
305
  id: number;
18
306
  name: string;
19
- coverImgId: number;
20
- coverImgUrl: string;
21
- userId: number;
307
+ creatorId: number;
308
+ coverUrl: string;
22
309
  createTime: number;
23
310
  songs: {
24
311
  id: number;
25
312
  addTime: number;
26
313
  }[];
27
314
  }
28
- //#endregion
29
- //#region src/types/SongDetails.d.ts
30
- type SongDetail = {
31
- id: number;
315
+ interface PlaylistStats {
316
+ commentCount?: number;
317
+ shareCount?: number;
318
+ playCount?: number;
319
+ subscribedCount?: number;
320
+ playedCount?: number;
321
+ }
322
+ interface PlaylistTag {
32
323
  name: string;
33
- artists: {
34
- id: number;
324
+ hot: boolean;
325
+ }
326
+ interface PlaylistPage {
327
+ total?: number;
328
+ more?: boolean;
329
+ playlists: PlaylistSummary[];
330
+ }
331
+ interface PlaylistCategory {
332
+ name: string;
333
+ subcategories: {
35
334
  name: string;
335
+ category: number;
36
336
  }[];
37
- album: {
337
+ }
338
+ //#endregion
339
+ //#region src/apis/playlist.d.ts
340
+ declare const getPlaylistDetail: (id: number, options?: RequestOptions) => Promise<PlaylistDetail>;
341
+ declare const getPlaylistTracks: (params: PlaylistTracksParams, options?: RequestOptions) => Promise<Song[]>;
342
+ declare const getPlaylistDetailDynamic: (id: number, options?: RequestOptions) => Promise<PlaylistStats>;
343
+ declare const getHighQualityTags: (options?: RequestOptions) => Promise<PlaylistTag[]>;
344
+ declare const getTopPlaylists: (params: TopPlaylistsParams, options?: RequestOptions) => Promise<PlaylistPage>;
345
+ declare const getHighQualityPlaylists: (params: HighQualityPlaylistsParams, options?: RequestOptions) => Promise<PlaylistPage>;
346
+ declare const getPlaylistCategories: (options?: RequestOptions) => Promise<PlaylistCategory[]>;
347
+ declare const getRelatedPlaylists: (id: number, options?: RequestOptions) => Promise<PlaylistSummary[]>;
348
+ //#endregion
349
+ //#region src/types/Lyric.d.ts
350
+ interface Lyric {
351
+ lines: LyricLine[];
352
+ translator?: {
38
353
  id: number;
39
- name: string;
40
- picUrl: string;
354
+ nickname: string;
41
355
  };
42
- duration: number;
356
+ }
357
+ type LyricLine = {
358
+ time: number;
359
+ text: string;
360
+ translation?: string;
43
361
  };
362
+ interface WordLine {
363
+ time: number;
364
+ duration: number;
365
+ words: {
366
+ time: number;
367
+ duration: number;
368
+ text: string;
369
+ }[];
370
+ }
371
+ interface LyricNew {
372
+ lines: LyricLine[];
373
+ wordLines?: WordLine[];
374
+ romaLines?: LyricLine[];
375
+ }
376
+ //#endregion
377
+ //#region src/types/SongDetails.d.ts
378
+ type SongDetail = Song;
379
+ interface MusicAvailability {
380
+ available: boolean;
381
+ message: string;
382
+ }
383
+ //#endregion
384
+ //#region src/apis/song.d.ts
385
+ declare const getSongsDetail: (ids: number[], options?: RequestOptions) => Promise<SongDetail[]>;
386
+ declare const getSongUrl: (params: SongUrlParams, options?: RequestOptions) => Promise<SongUrl[]>;
387
+ declare const getLyric: (id: number, options?: RequestOptions) => Promise<Lyric>;
388
+ declare const getLyricNew: (id: number, options?: RequestOptions) => Promise<LyricNew>;
389
+ declare const checkMusic: (params: CheckMusicParams, options?: RequestOptions) => Promise<MusicAvailability>;
390
+ declare const getSimilarSongs: (id: number, options?: RequestOptions) => Promise<Song[]>;
391
+ //#endregion
392
+ //#region src/apis/search.d.ts
393
+ declare const search: (params: SearchParams, options?: RequestOptions) => Promise<SearchResult>;
394
+ declare const cloudSearch: (params: SearchParams, options?: RequestOptions) => Promise<SearchResult>;
395
+ declare const getSearchSuggest: (params: SearchSuggestParams, options?: RequestOptions) => Promise<SearchSuggest>;
396
+ declare const getHotSearches: (options?: RequestOptions) => Promise<HotSearchGroup[]>;
397
+ declare const getHotSearchDetail: (options?: RequestOptions) => Promise<HotSearchItem[]>;
398
+ declare const getDefaultSearchKeyword: (options?: RequestOptions) => Promise<string>;
399
+ declare const searchMultimatch: (params: SearchMultimatchParams, options?: RequestOptions) => Promise<SearchResult>;
400
+ //#endregion
401
+ //#region src/errors.d.ts
402
+ declare class NeteaseApiError extends Error {
403
+ readonly code: number;
404
+ readonly uri: string;
405
+ readonly status: number;
406
+ readonly body: unknown;
407
+ constructor(uri: string, code: number, status: number, body: unknown);
408
+ }
44
409
  //#endregion
45
410
  //#region src/index.d.ts
46
- declare const getPlaylistDetail: (id: number) => Promise<PlaylistDetails>;
47
- declare const getLyric: (id: number) => Promise<Lyric>;
48
- declare const getSongsDetail: (ids: number[]) => Promise<SongDetail[]>;
49
411
  declare const _default: {
50
- getPlaylistDetail: (id: number) => Promise<PlaylistDetails>;
51
- getLyric: (id: number) => Promise<Lyric>;
52
- getSongsDetail: (ids: number[]) => Promise<SongDetail[]>;
412
+ search: (params: SearchParams, options?: RequestOptions) => Promise<SearchResult>;
413
+ cloudSearch: (params: SearchParams, options?: RequestOptions) => Promise<SearchResult>;
414
+ getSearchSuggest: (params: SearchSuggestParams, options?: RequestOptions) => Promise<SearchSuggest>;
415
+ getHotSearches: (options?: RequestOptions) => Promise<HotSearchGroup[]>;
416
+ getHotSearchDetail: (options?: RequestOptions) => Promise<HotSearchItem[]>;
417
+ getDefaultSearchKeyword: (options?: RequestOptions) => Promise<string>;
418
+ searchMultimatch: (params: SearchMultimatchParams, options?: RequestOptions) => Promise<SearchResult>;
419
+ getSongsDetail: (ids: number[], options?: RequestOptions) => Promise<SongDetail[]>;
420
+ getSongUrl: (params: SongUrlParams, options?: RequestOptions) => Promise<SongUrl[]>;
421
+ getLyric: (id: number, options?: RequestOptions) => Promise<Lyric>;
422
+ getLyricNew: (id: number, options?: RequestOptions) => Promise<LyricNew>;
423
+ checkMusic: (params: CheckMusicParams, options?: RequestOptions) => Promise<MusicAvailability>;
424
+ getSimilarSongs: (id: number, options?: RequestOptions) => Promise<Song[]>;
425
+ getPlaylistDetail: (id: number, options?: RequestOptions) => Promise<PlaylistDetail>;
426
+ getPlaylistTracks: (params: PlaylistTracksParams, options?: RequestOptions) => Promise<Song[]>;
427
+ getPlaylistDetailDynamic: (id: number, options?: RequestOptions) => Promise<PlaylistStats>;
428
+ getHighQualityTags: (options?: RequestOptions) => Promise<PlaylistTag[]>;
429
+ getTopPlaylists: (params: TopPlaylistsParams, options?: RequestOptions) => Promise<PlaylistPage>;
430
+ getHighQualityPlaylists: (params: HighQualityPlaylistsParams, options?: RequestOptions) => Promise<PlaylistPage>;
431
+ getPlaylistCategories: (options?: RequestOptions) => Promise<PlaylistCategory[]>;
432
+ getRelatedPlaylists: (id: number, options?: RequestOptions) => Promise<PlaylistSummary[]>;
433
+ getArtist: (id: number, options?: RequestOptions) => Promise<Artist>;
434
+ getArtistDetail: (id: number, options?: RequestOptions) => Promise<Artist>;
435
+ getArtistSongs: (params: ArtistSongsParams, options?: RequestOptions) => Promise<Song[]>;
436
+ getArtistTopSongs: (id: number, options?: RequestOptions) => Promise<Song[]>;
437
+ getArtistAlbums: (params: ArtistAlbumsParams, options?: RequestOptions) => Promise<AlbumPage>;
438
+ getArtistList: (params: ArtistListParams, options?: RequestOptions) => Promise<ArtistPage>;
439
+ getArtistDesc: (id: number, options?: RequestOptions) => Promise<ArtistDescription>;
440
+ getArtistMvs: (params: ArtistMvsParams, options?: RequestOptions) => Promise<MvRef[]>;
441
+ getArtistVideos: (params: ArtistVideosParams, options?: RequestOptions) => Promise<ArtistVideoPage>;
442
+ getAlbum: (id: number, options?: RequestOptions) => Promise<Album>;
443
+ getAlbumProduct: (id: number, options?: RequestOptions) => Promise<AlbumProduct>;
444
+ getAlbumDynamic: (id: number, options?: RequestOptions) => Promise<AlbumStats>;
445
+ getAlbumSaleBoard: (params: AlbumSaleBoardParams, options?: RequestOptions) => Promise<AlbumSaleBoard>;
446
+ getAlbumPrivileges: (id: number, options?: RequestOptions) => Promise<AlbumPrivilege[]>;
447
+ getAlbumList: (params: AlbumListParams, options?: RequestOptions) => Promise<AlbumPage>;
448
+ getNewestAlbums: (options?: RequestOptions) => Promise<Album[]>;
53
449
  };
54
450
  //#endregion
55
- export { _default as default, getLyric, getPlaylistDetail, getSongsDetail };
451
+ export { type Album, type AlbumListParams, type AlbumPage, type AlbumPrivilege, type AlbumProduct, type AlbumRef, type AlbumSaleBoard, type AlbumSaleBoardParams, type AlbumStats, type Artist, type ArtistAlbumsParams, type ArtistDescription, type ArtistListParams, type ArtistMvsParams, type ArtistPage, type ArtistRef, type ArtistSongsParams, type ArtistVideoPage, type ArtistVideosParams, type CheckMusicParams, type Crypto, type HighQualityPlaylistsParams, type HotSearchGroup, type HotSearchItem, type Lyric, type LyricLine, type LyricNew, type MusicAvailability, type MvRef, NeteaseApiError, type PlaylistCategory, type PlaylistDetail, type PlaylistPage, type PlaylistStats, type PlaylistSummary, type PlaylistTag, type PlaylistTracksParams, type RequestOptions, type SearchLyric, type SearchMultimatchParams, type SearchParams, type SearchRadio, type SearchResult, type SearchSuggest, type SearchSuggestParams, type SearchType, type Song, type SongDetail, type SongUrl, type SongUrlParams, type TopPlaylistsParams, type UserRef, type VideoRef, type WordLine, checkMusic, cloudSearch, _default as default, getAlbum, getAlbumDynamic, getAlbumList, getAlbumPrivileges, getAlbumProduct, getAlbumSaleBoard, getArtist, getArtistAlbums, getArtistDesc, getArtistDetail, getArtistList, getArtistMvs, getArtistSongs, getArtistTopSongs, getArtistVideos, getDefaultSearchKeyword, getHighQualityPlaylists, getHighQualityTags, getHotSearchDetail, getHotSearches, getLyric, getLyricNew, getNewestAlbums, getPlaylistCategories, getPlaylistDetail, getPlaylistDetailDynamic, getPlaylistTracks, getRelatedPlaylists, getSearchSuggest, getSimilarSongs, getSongUrl, getSongsDetail, getTopPlaylists, request, search, searchMultimatch };