@khang07/zing-mp3-api 1.0.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,132 @@
1
+ function createArtistRef(data) {
2
+ return {
3
+ alias: data.alias,
4
+ name: data.name,
5
+ thumbnail: {
6
+ w240: data.thumbnail,
7
+ w600: data.thumbnailM
8
+ },
9
+ ...(typeof data.totalFollow === 'number' ? {
10
+ followCount: data.totalFollow
11
+ } : {})
12
+ };
13
+ }
14
+ function createSearchArtist(data) {
15
+ return {
16
+ alias: data.alias,
17
+ name: data.name,
18
+ thumbnail: {
19
+ w240: data.thumbnail,
20
+ w600: data.thumbnailM
21
+ },
22
+ followCount: data.totalFollow
23
+ };
24
+ }
25
+ function createArtist(data) {
26
+ return {
27
+ alias: data.alias,
28
+ birthday: data.birthday,
29
+ realname: data.realname,
30
+ thumbnail: {
31
+ w240: data.thumbnail,
32
+ w600: data.thumbnailM
33
+ },
34
+ followCount: data.totalFollow,
35
+ name: data.name,
36
+ national: data.national,
37
+ biography: data.biography
38
+ };
39
+ }
40
+ function createAlbum(data) {
41
+ return {
42
+ id: data.encodeId,
43
+ name: data.title,
44
+ isOffical: data.isoffical,
45
+ releaseDate: data.releaseDate,
46
+ releasedAt: data.releasedAt,
47
+ artists: data.artists.map(createArtistRef),
48
+ thumbnail: {
49
+ w165: data.thumbnail
50
+ }
51
+ };
52
+ }
53
+ function createMedia(data) {
54
+ return {
55
+ id: data.encodeId,
56
+ name: data.title,
57
+ alias: data.alias,
58
+ isOffical: data.isOffical,
59
+ username: data.username,
60
+ artists: data.artists.map(createArtistRef),
61
+ isWorldWide: data.isWorldWide,
62
+ thumbnail: {
63
+ w94: data.thumbnail,
64
+ w240: data.thumbnailM
65
+ },
66
+ duration: data.duration,
67
+ isPrivate: data.isPrivate,
68
+ releaseDate: data.releaseDate,
69
+ album: createAlbum(data.album),
70
+ hasLyric: !!data.hasLyric
71
+ };
72
+ }
73
+ function createSearchMedia(data) {
74
+ return {
75
+ id: data.encodeId,
76
+ name: data.title,
77
+ alias: data.alias,
78
+ isOffical: data.isOffical,
79
+ username: data.username,
80
+ artists: data.artists.map(createArtistRef),
81
+ isWorldWide: data.isWorldWide,
82
+ thumbnail: {
83
+ w94: data.thumbnail,
84
+ w240: data.thumbnailM
85
+ },
86
+ duration: data.duration,
87
+ hasLyric: !!data.hasLyric
88
+ };
89
+ }
90
+ function createPlayList(data) {
91
+ return {
92
+ id: data.encodeId,
93
+ name: data.title,
94
+ thumbnail: {
95
+ w165: data.thumbnail,
96
+ w320: data.thumbnailM
97
+ },
98
+ isOffical: data.isoffical,
99
+ releaseDate: data.releaseDate,
100
+ releasedAt: data.releasedAt,
101
+ artists: data.artists.map(createArtistRef),
102
+ isPrivate: data.isPrivate,
103
+ isSingle: data.isSingle,
104
+ description: data.description,
105
+ alias: data.aliasTitle,
106
+ updatedAt: data.contentLastUpdate,
107
+ likeCount: data.like,
108
+ listenCount: data.listen,
109
+ mediaCount: data.song.total,
110
+ duration: data.song.totalDuration,
111
+ media: data.song.items.map(createMedia)
112
+ };
113
+ }
114
+ function createSearchPlayList(data) {
115
+ return {
116
+ id: data.encodeId,
117
+ name: data.title,
118
+ thumbnail: {
119
+ w165: data.thumbnail,
120
+ w320: data.thumbnailM
121
+ },
122
+ isOffical: data.isoffical,
123
+ releaseDate: data.releaseDate,
124
+ releasedAt: data.releasedAt,
125
+ artists: data.artists.map(createArtistRef),
126
+ isPrivate: data.isPrivate,
127
+ isSingle: data.isSingle,
128
+ alias: data.aliasTitle
129
+ };
130
+ }
131
+ export { createArtist, createMedia, createPlayList, createSearchMedia, createSearchPlayList, createSearchArtist };
132
+ //# sourceMappingURL=refined.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refined.js","sourceRoot":"source/","sources":["utils/refined.ts"],"names":[],"mappings":"AAsBA,SAAS,eAAe,CAAC,IAAmB;IACxC,OAAO;QACH,KAAK,EAAE,IAAI,CAAC,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QAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAC1C,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,KAAK,EAAE,IAAI,CAAC,UAAU;KACzB,CAAA;AACL,CAAC;AAED,OAAO,EACH,YAAY,EACZ,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EACrB,CAAA"}
@@ -1,35 +1,44 @@
1
- import { Readable } from 'node:stream';
2
-
3
- declare const client: ZingClient;
4
- export default client;
5
-
6
- export declare interface ClientOptions {
7
- maxRate?: [Download?: number, HighWaterMark?: number];
8
- }
9
-
10
- declare interface RequiredClientOptions {
11
- maxRate: [Download: number, HighWaterMark: number];
12
- }
13
-
14
- export declare type SearchCategory = 'artist' | 'music' | 'playlist' | 'video';
15
-
16
- export declare class ZingClient {
17
- static readonly BASE_URL: string;
18
- static readonly VERSION_URL_V1: string;
19
- static readonly VERSION_URL_V2: string;
20
- static readonly SECRET_KEY_V1: string;
21
- static readonly SECRET_KEY_V2: string;
22
- static readonly API_KEY_V1: string;
23
- static readonly API_KEY_V2: string;
24
- private readonly jar;
25
- private readonly instance;
26
- get ctime(): string;
27
- maxRate: RequiredClientOptions['maxRate'];
28
- constructor(options?: ClientOptions);
29
- video(videoID: string): Promise<Readable>;
30
- videoSyncLike(videoID: string): Readable;
31
- music(musicID: string): Promise<Readable>;
32
- musicSyncLike(musicID: string): Readable;
33
- }
34
-
35
- export { }
1
+ import { URL } from 'node:url';
2
+ import { Cookies } from './utils/cookies.js';
3
+ import type { Readable } from 'node:stream';
4
+ import type { ClientOptions } from './types/index.js';
5
+ import type { Artist, Media, SearchMedia, PlayList, SearchPlayList, SearchArtist } from './types/response.js';
6
+ export type { Cookies, ClientOptions, PlayList, Artist, Media, SearchMedia, SearchPlayList, SearchArtist };
7
+ declare class Client {
8
+ static readonly BASE_URL: string;
9
+ static readonly VERSION_URL_V1: string;
10
+ static readonly VERSION_URL_V2: string;
11
+ static readonly SECRET_KEY_V1: string;
12
+ static readonly SECRET_KEY_V2: string;
13
+ static readonly API_KEY_V1: string;
14
+ static readonly API_KEY_V2: string;
15
+ static readonly API_VIDEO_PATH: string;
16
+ static readonly API_MUSIC_PATH: string;
17
+ static readonly EXTRA_API_MUSIC_PATH: string;
18
+ static readonly API_SEARCH_PATH: string;
19
+ static readonly API_PLAYLIST_PATH: string;
20
+ static readonly API_MEDIA_DETAILS_PATH: string;
21
+ static readonly API_ARTIST_PATH: string;
22
+ static getIDFromURL(url: string): string;
23
+ private readonly ctime;
24
+ private readonly instance;
25
+ private readonly maxLoad;
26
+ private readonly maxHighWaterMark;
27
+ private readonly userAgent;
28
+ private readonly jar;
29
+ constructor(options?: ClientOptions);
30
+ private ensureCookies;
31
+ video(videoID: string | URL): Promise<Readable>;
32
+ videoSync(videoID: string | URL): Readable;
33
+ music(musicID: string | URL): Promise<Readable>;
34
+ musicSync(musicID: string | URL): Readable;
35
+ playlist(playlistID: string | URL): Promise<PlayList>;
36
+ artist(aliasID: string | URL): Promise<Artist>;
37
+ mediaDetails(mediaID: string | URL): Promise<Media>;
38
+ searchMusic(query: string): Promise<Media[]>;
39
+ searchVideo(query: string): Promise<SearchMedia[]>;
40
+ searchList(query: string): Promise<SearchPlayList[]>;
41
+ searchArtist(query: string): Promise<SearchArtist[]>;
42
+ }
43
+ declare const client: Client;
44
+ export { client as default, Client };
@@ -0,0 +1,9 @@
1
+ import type { Cookies } from '../utils/cookies.js';
2
+ type SearchCategory = 'music' | 'video' | 'artist' | 'playlist';
3
+ interface ClientOptions {
4
+ maxLoad?: number;
5
+ maxHighWaterMark?: number;
6
+ userAgent?: string;
7
+ jar?: Cookies;
8
+ }
9
+ export type { ClientOptions, SearchCategory };
@@ -0,0 +1,89 @@
1
+ type RawThumbnail = {
2
+ thumbnail: string;
3
+ thumbnailM: string;
4
+ };
5
+ type RawMusicQuality = '128' | '320';
6
+ type RawVideoQuality = '360p' | '720p';
7
+ type RawMusicStreaming = Partial<Record<'128', string>>;
8
+ type RawVideoStreaming = Partial<Record<RawVideoQuality, string>>;
9
+ interface ResponseData<Data> {
10
+ err: number;
11
+ data: Data;
12
+ }
13
+ interface RawMusic extends Partial<Record<RawMusicQuality, string>> {
14
+ streaming?: {
15
+ default?: RawMusicStreaming;
16
+ };
17
+ }
18
+ interface RawVideo {
19
+ streaming?: {
20
+ hls?: RawVideoStreaming;
21
+ };
22
+ }
23
+ interface RawArtistBase extends RawThumbnail {
24
+ alias: string;
25
+ name: string;
26
+ }
27
+ interface RawSearchArtist extends RawArtistBase {
28
+ totalFollow: number;
29
+ }
30
+ interface RawArtist extends RawArtistBase {
31
+ birthday: string;
32
+ biography: string;
33
+ national: string;
34
+ realname: string;
35
+ totalFollow: number;
36
+ }
37
+ type RawArtistItem = RawArtistBase & {
38
+ totalFollow?: number;
39
+ };
40
+ interface RawAlbum {
41
+ encodeId: string;
42
+ title: string;
43
+ thumbnail: string;
44
+ isoffical: boolean;
45
+ releaseDate: string;
46
+ releasedAt: number;
47
+ artists: RawArtistItem[];
48
+ }
49
+ interface RawMedia extends RawThumbnail {
50
+ encodeId: string;
51
+ title: string;
52
+ alias: string;
53
+ username: string;
54
+ artists: RawArtistItem[];
55
+ duration: number;
56
+ releaseDate: number;
57
+ album: RawAlbum;
58
+ hasLyric?: boolean;
59
+ isOffical: boolean;
60
+ isPrivate: boolean;
61
+ isWorldWide: boolean;
62
+ }
63
+ type RawSearchMedia = Omit<RawMedia, 'album'>;
64
+ interface RawPlayListSong {
65
+ items: RawMedia[];
66
+ total: number;
67
+ totalDuration: number;
68
+ }
69
+ interface RawPlayList extends RawThumbnail {
70
+ encodeId: string;
71
+ title: string;
72
+ aliasTitle: string;
73
+ artists: RawArtistItem[];
74
+ contentLastUpdate: number;
75
+ description: string;
76
+ isoffical: boolean;
77
+ isPrivate: boolean;
78
+ isSingle: boolean;
79
+ like: number;
80
+ listen: number;
81
+ releaseDate: string;
82
+ releasedAt: number;
83
+ song: RawPlayListSong;
84
+ }
85
+ type RawSearchPlayList = Omit<RawPlayList, 'song' | 'listen' | 'like' | 'description' | 'contentLastUpdate'>;
86
+ interface RawSearch<Data> {
87
+ items: Data[];
88
+ }
89
+ export type { ResponseData, RawAlbum, RawArtist, RawArtistBase, RawArtistItem, RawMedia, RawSearch, RawMusic, RawMusicQuality, RawMusicStreaming, RawPlayList, RawPlayListSong, RawSearchMedia, RawThumbnail, RawVideo, RawVideoQuality, RawVideoStreaming, RawSearchPlayList, RawSearchArtist };
@@ -0,0 +1,70 @@
1
+ type CoverArtist = {
2
+ w240: string;
3
+ w600: string;
4
+ };
5
+ type CoverMedia = {
6
+ w94: string;
7
+ w240: string;
8
+ };
9
+ type CoverPlayList = {
10
+ w165: string;
11
+ w320: string;
12
+ };
13
+ interface Named {
14
+ id: string;
15
+ name: string;
16
+ }
17
+ interface ArtistRef {
18
+ alias: string;
19
+ followCount?: number;
20
+ name: string;
21
+ thumbnail: CoverArtist;
22
+ }
23
+ type SearchArtist = Required<ArtistRef>;
24
+ interface Artist extends ArtistRef {
25
+ biography: string;
26
+ birthday: string;
27
+ followCount: number;
28
+ national: string;
29
+ realname: string;
30
+ }
31
+ interface Album extends Named {
32
+ artists: ArtistRef[];
33
+ isOffical: boolean;
34
+ releaseDate: string;
35
+ releasedAt: number;
36
+ thumbnail: Pick<CoverPlayList, 'w165'>;
37
+ }
38
+ interface Media extends Named {
39
+ album: Album;
40
+ alias: string;
41
+ artists: ArtistRef[];
42
+ duration: number;
43
+ hasLyric: boolean;
44
+ isOffical: boolean;
45
+ isPrivate: boolean;
46
+ isWorldWide: boolean;
47
+ releaseDate: number;
48
+ thumbnail: CoverMedia;
49
+ username: string;
50
+ }
51
+ type SearchMedia = Omit<Media, 'album' | 'isPrivate' | 'releaseDate'>;
52
+ interface PlayList extends Named {
53
+ alias: string;
54
+ artists: ArtistRef[];
55
+ description: string;
56
+ duration: number;
57
+ isOffical: boolean;
58
+ isPrivate: boolean;
59
+ isSingle: boolean;
60
+ likeCount: number;
61
+ listenCount: number;
62
+ media: Media[];
63
+ mediaCount: number;
64
+ releaseDate: string;
65
+ releasedAt: number;
66
+ thumbnail: CoverPlayList;
67
+ updatedAt: number;
68
+ }
69
+ type SearchPlayList = Omit<PlayList, 'updatedAt' | 'mediaCount' | 'listenCount' | 'likeCount' | 'duration' | 'description' | 'media'>;
70
+ export type { Album, Artist, ArtistRef, CoverArtist, CoverMedia, CoverPlayList, Media, SearchMedia, PlayList, SearchPlayList, SearchArtist };
@@ -0,0 +1,9 @@
1
+ import type { RawArtist, RawMedia, RawPlayList, RawSearchMedia, RawSearchPlayList, RawSearchArtist } from '../types/raw.js';
2
+ import type { Artist, Media, PlayList, SearchMedia, SearchPlayList, SearchArtist } from '../types/response.js';
3
+ declare function createSearchArtist(data: RawSearchArtist): SearchArtist;
4
+ declare function createArtist(data: RawArtist): Artist;
5
+ declare function createMedia(data: RawMedia): Media;
6
+ declare function createSearchMedia(data: RawSearchMedia): SearchMedia;
7
+ declare function createPlayList(data: RawPlayList): PlayList;
8
+ declare function createSearchPlayList(data: RawSearchPlayList): SearchPlayList;
9
+ export { createArtist, createMedia, createPlayList, createSearchMedia, createSearchPlayList, createSearchArtist };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khang07/zing-mp3-api",
3
- "version": "1.0.1",
3
+ "version": "1.3.2",
4
4
  "author": "GiaKhang <ngkhang9a5lqc11@gmail.com>",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,6 +15,21 @@
15
15
  "types": "./dist/types/index.d.ts",
16
16
  "import": "./dist/esm/index.js",
17
17
  "require": "./dist/cjs/index.cjs"
18
+ },
19
+ "./utils/cookies": {
20
+ "types": "./dist/types/utils/cookies.d.ts",
21
+ "import": "./dist/esm/utils/cookies.js",
22
+ "require": "./dist/cjs/utils/cookies.cjs"
23
+ },
24
+ "./utils/encrypt": {
25
+ "types": "./dist/types/utils/encrypt.d.ts",
26
+ "import": "./dist/esm/utils/encrypt.js",
27
+ "require": "./dist/cjs/utils/encrypt.cjs"
28
+ },
29
+ "./utils/lapse": {
30
+ "types": "./dist/types/utils/lapse.d.ts",
31
+ "import": "./dist/esm/utils/lapse.js",
32
+ "require": "./dist/cjs/utils/lapse.cjs"
18
33
  }
19
34
  },
20
35
  "bugs": {
@@ -33,12 +48,11 @@
33
48
  "scripts": {
34
49
  "build:esm": "tsc -p tsconfig.json",
35
50
  "build:cjs": "rollup -c",
36
- "build:types": "api-extractor run --local",
37
- "build": "rm -rf dist && bun run build:esm && bun run build:cjs && bun run build:types && rm -fr dist/esm/types dist/cjs/types"
51
+ "test": "mocha"
38
52
  },
39
53
  "devDependencies": {
40
- "@microsoft/api-extractor": "^7.58.1",
41
54
  "@types/node": "^25.5.2",
55
+ "mocha": "^11.7.5",
42
56
  "rollup": "^4.60.1",
43
57
  "typescript": "^6.0.2"
44
58
  },
@@ -1,23 +0,0 @@
1
- import { Readable } from 'node:stream';
2
- import type { ClientOptions, RequiredClientOptions, SearchCategory } from './types/index.js';
3
- export type { ClientOptions, SearchCategory };
4
- declare class ZingClient {
5
- static readonly BASE_URL: string;
6
- static readonly VERSION_URL_V1: string;
7
- static readonly VERSION_URL_V2: string;
8
- static readonly SECRET_KEY_V1: string;
9
- static readonly SECRET_KEY_V2: string;
10
- static readonly API_KEY_V1: string;
11
- static readonly API_KEY_V2: string;
12
- private readonly jar;
13
- private readonly instance;
14
- get ctime(): string;
15
- maxRate: RequiredClientOptions['maxRate'];
16
- constructor(options?: ClientOptions);
17
- video(videoID: string): Promise<Readable>;
18
- videoSyncLike(videoID: string): Readable;
19
- music(musicID: string): Promise<Readable>;
20
- musicSyncLike(musicID: string): Readable;
21
- }
22
- declare const client: ZingClient;
23
- export { client as default, ZingClient };
@@ -1,24 +0,0 @@
1
- interface UriStreaming {
2
- err: number;
3
- msg: string;
4
- data: {
5
- 128?: string;
6
- streaming?: {
7
- default?: {
8
- 128?: string;
9
- };
10
- };
11
- };
12
- }
13
- interface UriVideo {
14
- err: number;
15
- msg: string;
16
- data: {
17
- streaming: {
18
- hls: {
19
- '360p': string;
20
- };
21
- };
22
- };
23
- }
24
- export type { UriStreaming, UriVideo };
@@ -1,8 +0,0 @@
1
- type SearchCategory = 'artist' | 'music' | 'playlist' | 'video';
2
- interface ClientOptions {
3
- maxRate?: [Download?: number, HighWaterMark?: number];
4
- }
5
- interface RequiredClientOptions {
6
- maxRate: [Download: number, HighWaterMark: number];
7
- }
8
- export type { ClientOptions, RequiredClientOptions, SearchCategory };
@@ -1,11 +0,0 @@
1
- // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
- // It should be published with your NPM package. It should not be tracked by Git.
3
- {
4
- "tsdocVersion": "0.12",
5
- "toolPackages": [
6
- {
7
- "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.58.1"
9
- }
10
- ]
11
- }
File without changes
File without changes
File without changes
File without changes