migu-api-enhanced 1.2.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/LICENSE +201 -0
- package/README.md +279 -0
- package/dist/index.cjs +466 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +117 -0
- package/dist/index.d.ts +117 -0
- package/dist/index.js +413 -0
- package/dist/index.js.map +1 -0
- package/package.json +64 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
checkCanListen: () => checkCanListen,
|
|
24
|
+
createClient: () => createClient,
|
|
25
|
+
getAlbumInfo: () => getAlbumInfo,
|
|
26
|
+
getAlbumSong: () => getAlbumSong,
|
|
27
|
+
getComment: () => getComment,
|
|
28
|
+
getOpNum: () => getOpNum,
|
|
29
|
+
getPlaylistInfo: () => getPlaylistInfo,
|
|
30
|
+
getPlaylistSong: () => getPlaylistSong,
|
|
31
|
+
getRankIndex: () => getRankIndex,
|
|
32
|
+
getRankInfo: () => getRankInfo,
|
|
33
|
+
getRecommendPlaylist: () => getRecommendPlaylist,
|
|
34
|
+
getRecommendSong: () => getRecommendSong,
|
|
35
|
+
getResourceInfo: () => getResourceInfo,
|
|
36
|
+
getSearchDefault: () => getSearchDefault,
|
|
37
|
+
getSearchHot: () => getSearchHot,
|
|
38
|
+
getSearchSingerTab: () => getSearchSingerTab,
|
|
39
|
+
getSearchSingerTabList: () => getSearchSingerTabList,
|
|
40
|
+
getSingerAlbum: () => getSingerAlbum,
|
|
41
|
+
getSingerIndex: () => getSingerIndex,
|
|
42
|
+
getSingerSong: () => getSingerSong,
|
|
43
|
+
getUrlH5V24: () => getUrlH5V24,
|
|
44
|
+
getUrlV1: () => getUrlV1,
|
|
45
|
+
getUrlV2: () => getUrlV2,
|
|
46
|
+
getVersion: () => getVersion,
|
|
47
|
+
modules: () => modules_exports,
|
|
48
|
+
searchAlbum: () => searchAlbum,
|
|
49
|
+
searchConcert: () => searchConcert,
|
|
50
|
+
searchRbt: () => searchRbt,
|
|
51
|
+
searchSinger: () => searchSinger,
|
|
52
|
+
searchSong: () => searchSong,
|
|
53
|
+
searchSuggest: () => searchSuggest,
|
|
54
|
+
searchTicket: () => searchTicket,
|
|
55
|
+
searchVideo: () => searchVideo
|
|
56
|
+
});
|
|
57
|
+
module.exports = __toCommonJS(index_exports);
|
|
58
|
+
|
|
59
|
+
// src/modules/index.ts
|
|
60
|
+
var modules_exports = {};
|
|
61
|
+
__export(modules_exports, {
|
|
62
|
+
checkCanListen: () => checkCanListen,
|
|
63
|
+
getAlbumInfo: () => getAlbumInfo,
|
|
64
|
+
getAlbumSong: () => getAlbumSong,
|
|
65
|
+
getComment: () => getComment,
|
|
66
|
+
getOpNum: () => getOpNum,
|
|
67
|
+
getPlaylistInfo: () => getPlaylistInfo,
|
|
68
|
+
getPlaylistSong: () => getPlaylistSong,
|
|
69
|
+
getRankIndex: () => getRankIndex,
|
|
70
|
+
getRankInfo: () => getRankInfo,
|
|
71
|
+
getRecommendPlaylist: () => getRecommendPlaylist,
|
|
72
|
+
getRecommendSong: () => getRecommendSong,
|
|
73
|
+
getResourceInfo: () => getResourceInfo,
|
|
74
|
+
getSearchDefault: () => getSearchDefault,
|
|
75
|
+
getSearchHot: () => getSearchHot,
|
|
76
|
+
getSearchSingerTab: () => getSearchSingerTab,
|
|
77
|
+
getSearchSingerTabList: () => getSearchSingerTabList,
|
|
78
|
+
getSingerAlbum: () => getSingerAlbum,
|
|
79
|
+
getSingerIndex: () => getSingerIndex,
|
|
80
|
+
getSingerSong: () => getSingerSong,
|
|
81
|
+
getUrlH5V24: () => getUrlH5V24,
|
|
82
|
+
getUrlV1: () => getUrlV1,
|
|
83
|
+
getUrlV2: () => getUrlV2,
|
|
84
|
+
getVersion: () => getVersion,
|
|
85
|
+
searchAlbum: () => searchAlbum,
|
|
86
|
+
searchConcert: () => searchConcert,
|
|
87
|
+
searchRbt: () => searchRbt,
|
|
88
|
+
searchSinger: () => searchSinger,
|
|
89
|
+
searchSong: () => searchSong,
|
|
90
|
+
searchSuggest: () => searchSuggest,
|
|
91
|
+
searchTicket: () => searchTicket,
|
|
92
|
+
searchVideo: () => searchVideo
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// src/utils/h5fetch.ts
|
|
96
|
+
var createTimeoutSignal = (ms) => {
|
|
97
|
+
const controller = new AbortController();
|
|
98
|
+
setTimeout(() => controller.abort(), ms);
|
|
99
|
+
return controller.signal;
|
|
100
|
+
};
|
|
101
|
+
var h5fetch = async (url, init) => {
|
|
102
|
+
if (!init) {
|
|
103
|
+
init = {
|
|
104
|
+
method: "GET",
|
|
105
|
+
signal: createTimeoutSignal(5e3)
|
|
106
|
+
};
|
|
107
|
+
} else if (!init.signal) {
|
|
108
|
+
init.signal = createTimeoutSignal(5e3);
|
|
109
|
+
}
|
|
110
|
+
const response = await fetch(url, init);
|
|
111
|
+
if (!response.ok) {
|
|
112
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
113
|
+
}
|
|
114
|
+
return await response.json();
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// src/modules/search.ts
|
|
118
|
+
var searchSong = async (text, page = 1) => {
|
|
119
|
+
return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/song/v1.0?pageNo=${page}&text=${text}`);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// src/modules/search_album.ts
|
|
123
|
+
var searchAlbum = async (text, page = 1, typeOrder = 0) => {
|
|
124
|
+
return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/album/v1.0?pageNo=${page}&text=${text}&typeOrder=${typeOrder}`);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// src/modules/search_singer.ts
|
|
128
|
+
var searchSinger = async (text, page = 1) => {
|
|
129
|
+
return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/singer/v2.0?pageNo=${page}&text=${text}`);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// src/modules/search_concert.ts
|
|
133
|
+
var searchConcert = async (text, page = 1) => {
|
|
134
|
+
return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/concert/v1.0?pageNo=${page}&text=${text}`);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// src/modules/search_hot.ts
|
|
138
|
+
var getSearchHot = async () => {
|
|
139
|
+
return await h5fetch(`https://app.u.nf.migu.cn/bmw/hot-search/search-rank-list/v1.0`);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// src/modules/search_default.ts
|
|
143
|
+
var getSearchDefault = async () => {
|
|
144
|
+
return await h5fetch(`http://app.c.nf.migu.cn/column/search/default-text/v3.0?resourceVersion=2`);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// src/modules/search_video.ts
|
|
148
|
+
var searchVideo = async (text, page = 1, typeOrder = 0) => {
|
|
149
|
+
return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/video/v1.0?pageNo=${page}&text=${text}&typeOrder=${typeOrder}`);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// src/modules/search_suggest.ts
|
|
153
|
+
var searchSuggest = async (text) => {
|
|
154
|
+
return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/suggest/v1.0?text=${text}`);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// src/modules/search_rbt.ts
|
|
158
|
+
var searchRbt = async (text, page = 1) => {
|
|
159
|
+
return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/rbt/v1.0?pageNo=${page}&text=${text}`);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// src/modules/search_ticket.ts
|
|
163
|
+
var searchTicket = async (text, page = 1) => {
|
|
164
|
+
return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/ticket/v1.0?pageNo=${page}&text=${text}`);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// src/modules/search_singerTab.ts
|
|
168
|
+
var getSearchSingerTab = async () => {
|
|
169
|
+
return await h5fetch(`https://app.u.nf.migu.cn/MIGUM3.0/bmw/singer-index/tabs/v2.0`);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// src/modules/search_singerTab_list.ts
|
|
173
|
+
var getSearchSingerTabList = async (tab = "") => {
|
|
174
|
+
return await h5fetch(`https://app.u.nf.migu.cn/MIGUM3.0/bmw/singer-index/list/v1.0?tab=${tab}&templateVersion=3`);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// src/modules/album_info.ts
|
|
178
|
+
var getAlbumInfo = async (albumId) => {
|
|
179
|
+
return await h5fetch(`http://app.c.nf.migu.cn/MIGUM3.0/resource/album/v2.0?albumId=${albumId}`);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// src/modules/album_song.ts
|
|
183
|
+
var getAlbumSong = async (albumId, page = 1) => {
|
|
184
|
+
return await h5fetch(`http://app.c.nf.migu.cn/MIGUM3.0/resource/album/song/v2.0?albumId=${albumId}&pageNo=${page}`);
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// src/modules/playlist_info.ts
|
|
188
|
+
var getPlaylistInfo = async (playlistId) => {
|
|
189
|
+
return await h5fetch(`https://app.c.nf.migu.cn/resource/playlist/v2.0?playlistId=${playlistId}`);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// src/modules/playlist_song.ts
|
|
193
|
+
var getPlaylistSong = async (playlistId, page = 1, size = 20) => {
|
|
194
|
+
return await h5fetch(`https://app.c.nf.migu.cn/MIGUM3.0/resource/playlist/song/v2.0?pageNo=${page}&pageSize=${size}&playlistId=${playlistId}`);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// src/modules/singer_index.ts
|
|
198
|
+
var getSingerIndex = async (singerId) => {
|
|
199
|
+
return await h5fetch(`http://app.c.nf.migu.cn/bmw/singer/index/v1.0?singerId=${singerId}`);
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
// src/modules/singer_song.ts
|
|
203
|
+
var getSingerSong = async (singerId, page = 1) => {
|
|
204
|
+
return await h5fetch(`http://app.c.nf.migu.cn/bmw/singer/song/v1.0?pageNo=${page}&singerId=${singerId}&type=1`);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
// src/modules/singer_album.ts
|
|
208
|
+
var getSingerAlbum = async (singerId) => {
|
|
209
|
+
return await h5fetch(`http://app.c.nf.migu.cn/bmw/singer/album/v1.0?singerId=${singerId}`);
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
// src/modules/rank_index.ts
|
|
213
|
+
var getRankIndex = async () => {
|
|
214
|
+
return await h5fetch(`https://app.c.nf.migu.cn/pc/bmw/rank/rank-index/v1.0`);
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
// src/modules/rank_info.ts
|
|
218
|
+
var getRankInfo = async (rankId, page = 1) => {
|
|
219
|
+
return await h5fetch(`http://app.c.nf.migu.cn/bmw/rank/rank-info/v1.0?pageNo=${page}&rankId=${rankId}`);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
// src/modules/recommend_playlist.ts
|
|
223
|
+
var getRecommendPlaylist = async () => {
|
|
224
|
+
return await h5fetch(`http://app.c.nf.migu.cn/bmw/index-show/recommend-playlist/v3.0`);
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
// src/modules/recommend_song.ts
|
|
228
|
+
var getRecommendSong = async (size = 20, scene = "TODAY_RECOMMEND") => {
|
|
229
|
+
return await h5fetch(`http://app.c.nf.migu.cn/resource-dataloader/recommend-song/v1.0?actionId=1&scene=${scene}&size=${size}`);
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
// src/modules/comment.ts
|
|
233
|
+
var getComment = async (resourceId, resourceType = 2, hotCommentStart = 0, size = 20) => {
|
|
234
|
+
return await h5fetch(`https://app.u.nf.migu.cn/MIGUM3.0/user/comment/stack/v1.0?hotCommentStart=${hotCommentStart}&pageSize=${size}&queryType=1&resourceId=${resourceId}&resourceType=${resourceType}`);
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
// src/modules/resourceinfo.ts
|
|
238
|
+
var getResourceInfo = async (resourceId, resourceType = 2) => {
|
|
239
|
+
return await h5fetch(`https://app.u.nf.migu.cn//MIGUM2.0/v1.0/content/resourceinfo.do?resourceId=${resourceId}&resourceType=${resourceType}`);
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
// src/modules/can-listen.ts
|
|
243
|
+
var checkCanListen = async (body) => {
|
|
244
|
+
return await h5fetch(
|
|
245
|
+
`https://app.c.nf.migu.cn/strategy/pc/can-listen/v1.0`,
|
|
246
|
+
{
|
|
247
|
+
method: "post",
|
|
248
|
+
headers: {
|
|
249
|
+
"Content-Type": "application/json"
|
|
250
|
+
},
|
|
251
|
+
body: JSON.stringify(body)
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
// src/modules/opNum.ts
|
|
257
|
+
var getOpNum = async (ids) => {
|
|
258
|
+
return await h5fetch(`https://app.c.nf.migu.cn/opnum/query-optype-v1.0?opType=play&resourceType=2021&ids=${ids}`);
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
// src/modules/url_v1.ts
|
|
262
|
+
var getUrlV1 = async (contentId, copyrightId, resourceType = "2") => {
|
|
263
|
+
return await h5fetch(
|
|
264
|
+
`https://app.c.nf.migu.cn/MIGUM3.0/strategy/pc/listen/v1.0?contentId=${contentId}©rightId=${copyrightId}&resourceType=${resourceType}&toneFlag=PQ`,
|
|
265
|
+
{
|
|
266
|
+
headers: {
|
|
267
|
+
"Channel": "014X031"
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
// src/modules/url_v2.ts
|
|
274
|
+
var getUrlV2 = async (contentId, copyrightId, resourceType = "2") => {
|
|
275
|
+
const deviceId = getDeviceId();
|
|
276
|
+
const timestamp = Date.now();
|
|
277
|
+
const headers = {
|
|
278
|
+
"Accept": "application/json, text/plain, */*",
|
|
279
|
+
"test": "00",
|
|
280
|
+
"channel": "014X031",
|
|
281
|
+
"subchannel": "014X031",
|
|
282
|
+
"logId": "cfrom=&appId=h5",
|
|
283
|
+
"uid": "",
|
|
284
|
+
"pacmtoken": "",
|
|
285
|
+
"appId": "h5",
|
|
286
|
+
"platform": "H5",
|
|
287
|
+
"deviceId": deviceId,
|
|
288
|
+
"ua": "Android_migu",
|
|
289
|
+
"version": "6.8.8",
|
|
290
|
+
"activityId": "MUSIC-WWW",
|
|
291
|
+
"birth": "h5page",
|
|
292
|
+
"signature": "1",
|
|
293
|
+
"timestamp": timestamp.toString(),
|
|
294
|
+
"Content-Type": "application/json;charset=UTF-8",
|
|
295
|
+
"referer": "https://music.migu.cn/",
|
|
296
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Edg/148.0.0.0"
|
|
297
|
+
};
|
|
298
|
+
const res = await fetch(
|
|
299
|
+
`https://app.c.nf.migu.cn/strategy/pc/listen/v2.0?contentId=${contentId}©rightId=${copyrightId}&scene=&netType=01&resourceType=${resourceType}&toneFlag=PQ`,
|
|
300
|
+
{
|
|
301
|
+
headers
|
|
302
|
+
}
|
|
303
|
+
);
|
|
304
|
+
const blob = await res.blob();
|
|
305
|
+
return await decryptData(blob);
|
|
306
|
+
};
|
|
307
|
+
var SECURE = "Jk8qzuePiJ1qE3mDYhLQ3T73DtDoAhLP";
|
|
308
|
+
var aw = 171;
|
|
309
|
+
var iw = 205;
|
|
310
|
+
var ow = 1;
|
|
311
|
+
function getDeviceId() {
|
|
312
|
+
const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
|
313
|
+
const a = `${random.substring(0, 8)}-${random.substring(8, 12)}-${random.substring(12, 16)}-${random.substring(16, 20)}-${random.substring(20)}`;
|
|
314
|
+
return a.toUpperCase();
|
|
315
|
+
}
|
|
316
|
+
function textEncode(e) {
|
|
317
|
+
return new TextEncoder().encode(e);
|
|
318
|
+
}
|
|
319
|
+
function textDecode(e) {
|
|
320
|
+
return new TextDecoder("utf-8").decode(e);
|
|
321
|
+
}
|
|
322
|
+
var blobToArrayBuffer = async (blob) => {
|
|
323
|
+
return blob.arrayBuffer();
|
|
324
|
+
};
|
|
325
|
+
function decryptBlob(e, r) {
|
|
326
|
+
if (r.length == 0)
|
|
327
|
+
return null;
|
|
328
|
+
var n = e.length;
|
|
329
|
+
if (n < 4 || !(e[0] == aw && e[1] == iw) || e[2] != ow)
|
|
330
|
+
return null;
|
|
331
|
+
for (var t = e[3], a = textEncode(r), i = a.length, o = new Uint8Array(n - 4), s = 0, c = 4; c < n; c++, s++)
|
|
332
|
+
o[s] = e[c] + t - a[s % i];
|
|
333
|
+
return o;
|
|
334
|
+
}
|
|
335
|
+
async function decryptData(blob) {
|
|
336
|
+
return await blobToArrayBuffer(blob).then((buf) => {
|
|
337
|
+
let l = buf, a = SECURE, u = decryptBlob(new Uint8Array(l), a), p = u ? textDecode(u) : null;
|
|
338
|
+
try {
|
|
339
|
+
const data = p ? JSON.parse(p) : null;
|
|
340
|
+
return data;
|
|
341
|
+
} catch (e) {
|
|
342
|
+
return null;
|
|
343
|
+
}
|
|
344
|
+
;
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// src/modules/url_h5v2.4.ts
|
|
349
|
+
var getUrlH5V24 = async (contentId, copyrightId, resourceType = "2") => {
|
|
350
|
+
const headers = {
|
|
351
|
+
"birth": "h5page",
|
|
352
|
+
"channel": "014X031",
|
|
353
|
+
"Referer": "https://y.migu.cn/"
|
|
354
|
+
};
|
|
355
|
+
const res = await fetch(
|
|
356
|
+
`https://c.musicapp.migu.cn/strategy/listen-url/h5/v2.4?contentId=${contentId}©rightId=${copyrightId}&resourceType=${resourceType}&netType=01&toneFlag=PQ&scene=&lowerQualityContentId=${contentId}`,
|
|
357
|
+
{
|
|
358
|
+
headers
|
|
359
|
+
}
|
|
360
|
+
);
|
|
361
|
+
const blob = await res.blob();
|
|
362
|
+
return await decryptData2(blob);
|
|
363
|
+
};
|
|
364
|
+
var SECURE2 = ["Jk8qzuePiJ1qE3mDYhLQ3T73DtDoAhLP"];
|
|
365
|
+
var blobToArrayBuffer2 = async (blob) => {
|
|
366
|
+
return await blob.arrayBuffer();
|
|
367
|
+
};
|
|
368
|
+
function strToUtf8Bytes(e) {
|
|
369
|
+
return new TextEncoder().encode(e);
|
|
370
|
+
}
|
|
371
|
+
function utf8Bytes2str(e) {
|
|
372
|
+
var t = [], n = true, r = false, o = void 0;
|
|
373
|
+
try {
|
|
374
|
+
for (var a, i = e[Symbol.iterator](); !(n = (a = i.next()).done); n = true) {
|
|
375
|
+
var s = a.value;
|
|
376
|
+
s < 16 ? t.push(String.fromCharCode(s)) : (t.push("%"), t.push(s.toString(16)));
|
|
377
|
+
}
|
|
378
|
+
} catch (e2) {
|
|
379
|
+
r = true, o = e2;
|
|
380
|
+
} finally {
|
|
381
|
+
try {
|
|
382
|
+
!n && i.return && i.return();
|
|
383
|
+
} finally {
|
|
384
|
+
if (r)
|
|
385
|
+
throw o;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return decodeURIComponent(t.join(""));
|
|
389
|
+
}
|
|
390
|
+
function decode(e, t) {
|
|
391
|
+
if (0 == t.length)
|
|
392
|
+
return null;
|
|
393
|
+
var n = e.length;
|
|
394
|
+
if (n < 4)
|
|
395
|
+
return null;
|
|
396
|
+
if (171 != e[0] || 205 != e[1])
|
|
397
|
+
return null;
|
|
398
|
+
if (1 != e[2])
|
|
399
|
+
return null;
|
|
400
|
+
for (var r = e[3], o = strToUtf8Bytes(t), a = o.length, i = new Uint8Array(n - 4), s = 0, c = 4; c < n; c++, s++)
|
|
401
|
+
i[s] = e[c] + r - o[s % a];
|
|
402
|
+
return i;
|
|
403
|
+
}
|
|
404
|
+
var decryptData2 = async (blob) => {
|
|
405
|
+
const ab = await blobToArrayBuffer2(blob);
|
|
406
|
+
const r = decode(new Uint8Array(ab), SECURE2[0]);
|
|
407
|
+
const d = utf8Bytes2str(r);
|
|
408
|
+
const data = JSON.parse(d);
|
|
409
|
+
return data;
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
// src/modules/version.ts
|
|
413
|
+
var getVersion = async (channel = "0146921", version = "8.4.0", ua = "Android_migu") => {
|
|
414
|
+
return await h5fetch(
|
|
415
|
+
`http://app.c.nf.migu.cn/MIGUM2.0/resource/client/version/v1.0`,
|
|
416
|
+
{
|
|
417
|
+
headers: {
|
|
418
|
+
"channel": channel,
|
|
419
|
+
"ua": ua,
|
|
420
|
+
"version": version
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
);
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
// src/index.ts
|
|
427
|
+
function createClient() {
|
|
428
|
+
return modules_exports;
|
|
429
|
+
}
|
|
430
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
431
|
+
0 && (module.exports = {
|
|
432
|
+
checkCanListen,
|
|
433
|
+
createClient,
|
|
434
|
+
getAlbumInfo,
|
|
435
|
+
getAlbumSong,
|
|
436
|
+
getComment,
|
|
437
|
+
getOpNum,
|
|
438
|
+
getPlaylistInfo,
|
|
439
|
+
getPlaylistSong,
|
|
440
|
+
getRankIndex,
|
|
441
|
+
getRankInfo,
|
|
442
|
+
getRecommendPlaylist,
|
|
443
|
+
getRecommendSong,
|
|
444
|
+
getResourceInfo,
|
|
445
|
+
getSearchDefault,
|
|
446
|
+
getSearchHot,
|
|
447
|
+
getSearchSingerTab,
|
|
448
|
+
getSearchSingerTabList,
|
|
449
|
+
getSingerAlbum,
|
|
450
|
+
getSingerIndex,
|
|
451
|
+
getSingerSong,
|
|
452
|
+
getUrlH5V24,
|
|
453
|
+
getUrlV1,
|
|
454
|
+
getUrlV2,
|
|
455
|
+
getVersion,
|
|
456
|
+
modules,
|
|
457
|
+
searchAlbum,
|
|
458
|
+
searchConcert,
|
|
459
|
+
searchRbt,
|
|
460
|
+
searchSinger,
|
|
461
|
+
searchSong,
|
|
462
|
+
searchSuggest,
|
|
463
|
+
searchTicket,
|
|
464
|
+
searchVideo
|
|
465
|
+
});
|
|
466
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/modules/index.ts","../src/utils/h5fetch.ts","../src/modules/search.ts","../src/modules/search_album.ts","../src/modules/search_singer.ts","../src/modules/search_concert.ts","../src/modules/search_hot.ts","../src/modules/search_default.ts","../src/modules/search_video.ts","../src/modules/search_suggest.ts","../src/modules/search_rbt.ts","../src/modules/search_ticket.ts","../src/modules/search_singerTab.ts","../src/modules/search_singerTab_list.ts","../src/modules/album_info.ts","../src/modules/album_song.ts","../src/modules/playlist_info.ts","../src/modules/playlist_song.ts","../src/modules/singer_index.ts","../src/modules/singer_song.ts","../src/modules/singer_album.ts","../src/modules/rank_index.ts","../src/modules/rank_info.ts","../src/modules/recommend_playlist.ts","../src/modules/recommend_song.ts","../src/modules/comment.ts","../src/modules/resourceinfo.ts","../src/modules/can-listen.ts","../src/modules/opNum.ts","../src/modules/url_v1.ts","../src/modules/url_v2.ts","../src/modules/url_h5v2.4.ts","../src/modules/version.ts"],"sourcesContent":["/**\n * migu-api-enhanced 包入口\n * 直接复用 modules 导出,提供 createClient 工厂\n */\n\n// ============================================================\n// 直接导出 modules 所有函数\n// ============================================================\nexport * from './modules';\n\n// ============================================================\n// 命名空间导出\n// ============================================================\nexport * as modules from './modules';\n\n// ============================================================\n// 工厂函数\n// ============================================================\nimport * as api from './modules';\n\n/**\n * 创建一个咪咕 API 客户端实例\n * 返回对象包含所有 API 方法(直接复用 modules 函数)\n * @returns 包含所有 API 方法的对象\n */\nexport function createClient(): typeof api {\n return api;\n}\n\n/** 客户端类型 */\nexport type MiguClient = ReturnType<typeof createClient>;","/**\n * modules 子目录统一入口\n * 汇总导出所有 API 函数\n */\nexport { searchSong } from './search';\nexport { searchAlbum } from './search_album';\nexport { searchSinger } from './search_singer';\nexport { searchConcert } from './search_concert';\nexport { getSearchHot } from './search_hot';\nexport { getSearchDefault } from './search_default';\nexport { searchVideo } from './search_video';\nexport { searchSuggest } from './search_suggest';\nexport { searchRbt } from './search_rbt';\nexport { searchTicket } from './search_ticket';\nexport { getSearchSingerTab } from './search_singerTab';\nexport { getSearchSingerTabList } from './search_singerTab_list';\nexport { getAlbumInfo } from './album_info';\nexport { getAlbumSong } from './album_song';\nexport { getPlaylistInfo } from './playlist_info';\nexport { getPlaylistSong } from './playlist_song';\nexport { getSingerIndex } from './singer_index';\nexport { getSingerSong } from './singer_song';\nexport { getSingerAlbum } from './singer_album';\nexport { getRankIndex } from './rank_index';\nexport { getRankInfo } from './rank_info';\nexport { getRecommendPlaylist } from './recommend_playlist';\nexport { getRecommendSong } from './recommend_song';\nexport { getComment } from './comment';\nexport { getResourceInfo } from './resourceinfo';\nexport { checkCanListen } from './can-listen';\nexport { getOpNum } from './opNum';\nexport { getUrlV1 } from './url_v1';\nexport { getUrlV2 } from './url_v2';\nexport { getUrlH5V24 } from './url_h5v2.4';\nexport { getVersion } from './version';","/**\r\n * 创建带超时的 AbortSignal\r\n * 兼容不支持 AbortSignal.timeout 的环境(如 EdgeOne)\r\n * @param ms - 超时毫秒数\r\n * @returns 可用于 fetch 第二个参数 init.signal 的 AbortSignal\r\n */\r\nexport const createTimeoutSignal = (ms: number): AbortSignal => {\r\n const controller = new AbortController();\r\n setTimeout(() => controller.abort(), ms);\r\n return controller.signal;\r\n};\r\n\r\n/**\r\n * 通用 GET 请求封装,自动注入 5 秒超时\r\n * @param url - 完整请求 URL\r\n * @param init - 可选 fetch init 选项(若未传 signal,则默认注入 5 秒超时)\r\n * @returns 解析后的 JSON 数据\r\n */\r\nexport const h5fetch = async (url: string, init?: RequestInit) => {\r\n if (!init) {\r\n init = {\r\n method: 'GET',\r\n signal: createTimeoutSignal(5000)\r\n };\r\n } else if (!init.signal) {\r\n init.signal = createTimeoutSignal(5000);\r\n }\r\n\r\n const response = await fetch(url, init);\r\n if (!response.ok) {\r\n throw new Error(`HTTP error! status: ${response.status}`);\r\n }\r\n\r\n return await response.json();\r\n};","import { h5fetch } from '../utils/h5fetch';\r\n\r\nexport const searchSong = async (text: string, page: number = 1) => {\r\n return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/song/v1.0?pageNo=${page}&text=${text}`);\r\n};\r\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const searchAlbum = async (text: string, page: number = 1, typeOrder: number = 0) => {\n return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/album/v1.0?pageNo=${page}&text=${text}&typeOrder=${typeOrder}`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const searchSinger = async (text: string, page: number = 1) => {\n return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/singer/v2.0?pageNo=${page}&text=${text}`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const searchConcert = async (text: string, page: number = 1) => {\n return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/concert/v1.0?pageNo=${page}&text=${text}`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getSearchHot = async () => {\n return await h5fetch(`https://app.u.nf.migu.cn/bmw/hot-search/search-rank-list/v1.0`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getSearchDefault = async () => {\n return await h5fetch(`http://app.c.nf.migu.cn/column/search/default-text/v3.0?resourceVersion=2`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const searchVideo = async (text: string, page: number = 1, typeOrder: number = 0) => {\n return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/video/v1.0?pageNo=${page}&text=${text}&typeOrder=${typeOrder}`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const searchSuggest = async (text: string) => {\n return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/suggest/v1.0?text=${text}`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const searchRbt = async (text: string, page: number = 1) => {\n return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/rbt/v1.0?pageNo=${page}&text=${text}`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const searchTicket = async (text: string, page: number = 1) => {\n return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/ticket/v1.0?pageNo=${page}&text=${text}`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getSearchSingerTab = async () => {\n return await h5fetch(`https://app.u.nf.migu.cn/MIGUM3.0/bmw/singer-index/tabs/v2.0`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getSearchSingerTabList = async (tab: string = '') => {\n return await h5fetch(`https://app.u.nf.migu.cn/MIGUM3.0/bmw/singer-index/list/v1.0?tab=${tab}&templateVersion=3`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getAlbumInfo = async (albumId: string) => {\n return await h5fetch(`http://app.c.nf.migu.cn/MIGUM3.0/resource/album/v2.0?albumId=${albumId}`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getAlbumSong = async (albumId: string, page: number = 1) => {\n return await h5fetch(`http://app.c.nf.migu.cn/MIGUM3.0/resource/album/song/v2.0?albumId=${albumId}&pageNo=${page}`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getPlaylistInfo = async (playlistId: string) => {\n return await h5fetch(`https://app.c.nf.migu.cn/resource/playlist/v2.0?playlistId=${playlistId}`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getPlaylistSong = async (playlistId: string, page: number = 1, size: number = 20) => {\n return await h5fetch(`https://app.c.nf.migu.cn/MIGUM3.0/resource/playlist/song/v2.0?pageNo=${page}&pageSize=${size}&playlistId=${playlistId}`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getSingerIndex = async (singerId: string) => {\n return await h5fetch(`http://app.c.nf.migu.cn/bmw/singer/index/v1.0?singerId=${singerId}`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getSingerSong = async (singerId: string, page: number = 1) => {\n return await h5fetch(`http://app.c.nf.migu.cn/bmw/singer/song/v1.0?pageNo=${page}&singerId=${singerId}&type=1`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getSingerAlbum = async (singerId: string) => {\n return await h5fetch(`http://app.c.nf.migu.cn/bmw/singer/album/v1.0?singerId=${singerId}`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getRankIndex = async () => {\n return await h5fetch(`https://app.c.nf.migu.cn/pc/bmw/rank/rank-index/v1.0`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getRankInfo = async (rankId: string, page: number = 1) => {\n return await h5fetch(`http://app.c.nf.migu.cn/bmw/rank/rank-info/v1.0?pageNo=${page}&rankId=${rankId}`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getRecommendPlaylist = async () => {\n return await h5fetch(`http://app.c.nf.migu.cn/bmw/index-show/recommend-playlist/v3.0`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getRecommendSong = async (size: number = 20, scene: string = 'TODAY_RECOMMEND') => {\n return await h5fetch(`http://app.c.nf.migu.cn/resource-dataloader/recommend-song/v1.0?actionId=1&scene=${scene}&size=${size}`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getComment = async (resourceId: string, resourceType: number = 2, hotCommentStart: number = 0, size: number = 20) => {\n return await h5fetch(`https://app.u.nf.migu.cn/MIGUM3.0/user/comment/stack/v1.0?hotCommentStart=${hotCommentStart}&pageSize=${size}&queryType=1&resourceId=${resourceId}&resourceType=${resourceType}`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getResourceInfo = async (resourceId: string, resourceType: number = 2) => {\n return await h5fetch(`https://app.u.nf.migu.cn//MIGUM2.0/v1.0/content/resourceinfo.do?resourceId=${resourceId}&resourceType=${resourceType}`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const checkCanListen = async (body: any) => {\n return await h5fetch(\n `https://app.c.nf.migu.cn/strategy/pc/can-listen/v1.0`,\n {\n method: 'post',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(body)\n }\n );\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getOpNum = async (ids: string) => {\n return await h5fetch(`https://app.c.nf.migu.cn/opnum/query-optype-v1.0?opType=play&resourceType=2021&ids=${ids}`);\n};\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getUrlV1 = async (contentId: string, copyrightId: string, resourceType: string = '2') => {\n return await h5fetch(\n `https://app.c.nf.migu.cn/MIGUM3.0/strategy/pc/listen/v1.0?contentId=${contentId}©rightId=${copyrightId}&resourceType=${resourceType}&toneFlag=PQ`,\n {\n headers: {\n \"Channel\": \"014X031\"\n }\n }\n );\n};\n","export const getUrlV2 = async (contentId: string, copyrightId: string, resourceType: string = '2') => {\n const deviceId = getDeviceId();\n const timestamp = Date.now();\n\n const headers = {\n \"Accept\": \"application/json, text/plain, */*\",\n \"test\": \"00\",\n \"channel\": \"014X031\",\n \"subchannel\": \"014X031\",\n \"logId\": \"cfrom=&appId=h5\",\n \"uid\": \"\",\n \"pacmtoken\": \"\",\n \"appId\": \"h5\",\n \"platform\": \"H5\",\n \"deviceId\": deviceId,\n \"ua\": \"Android_migu\",\n \"version\": \"6.8.8\",\n \"activityId\": \"MUSIC-WWW\",\n \"birth\": \"h5page\",\n \"signature\": \"1\",\n \"timestamp\": timestamp.toString(),\n \"Content-Type\": \"application/json;charset=UTF-8\",\n \"referer\": \"https://music.migu.cn/\",\n \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Edg/148.0.0.0\"\n };\n\n const res = await fetch(\n `https://app.c.nf.migu.cn/strategy/pc/listen/v2.0?contentId=${contentId}©rightId=${copyrightId}&scene=&netType=01&resourceType=${resourceType}&toneFlag=PQ`,\n {\n headers: headers\n }\n );\n const blob = await res.blob();\n\n return await decryptData(blob);\n};\n\nconst SECURE = \"Jk8qzuePiJ1qE3mDYhLQ3T73DtDoAhLP\"\nconst aw = 171,iw = 205,ow = 1;\n\nfunction getDeviceId(): string {\n const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join('');\n const a = `${random.substring(0, 8)}-${random.substring(8, 12)}-${random.substring(12, 16)}-${random.substring(16, 20)}-${random.substring(20)}`;\n return a.toUpperCase();\n}\n\nfunction textEncode(e: string) {\n return new TextEncoder().encode(e)\n}\nfunction textDecode(e: ArrayBufferView) {\n return new TextDecoder('utf-8').decode(e)\n}\n\nconst blobToArrayBuffer = async(blob: Blob) => { return blob.arrayBuffer(); }\nfunction decryptBlob(e: Uint8Array, r: string) {\n if (r.length == 0)\n return null;\n var n = e.length;\n if (n < 4 || !(e[0] == aw && e[1] == iw) || e[2] != ow)\n return null;\n for (var t = e[3], a = textEncode(r), i = a.length, o = new Uint8Array(n - 4), s = 0, c = 4; c < n; c++,\n s++)\n o[s] = e[c] + t - a[s % i];\n return o\n}\n\nasync function decryptData(blob: Blob) {\n return await blobToArrayBuffer(blob).then(buf => {\n let l = buf,\n a = SECURE,\n u = decryptBlob(new Uint8Array(l), a),\n p = u ? textDecode(u) : null;\n\n try{\n const data = p ? JSON.parse(p) : null;\n return data\n }catch(e) {\n return null;\n };\n })\n}\n","export const getUrlH5V24 = async (contentId: string, copyrightId: string, resourceType: string = '2') => {\n const headers = {\n \"birth\": \"h5page\",\n \"channel\": \"014X031\",\n \"Referer\": \"https://y.migu.cn/\",\n }\n\n const res = await fetch(\n `https://c.musicapp.migu.cn/strategy/listen-url/h5/v2.4?contentId=${contentId}©rightId=${copyrightId}&resourceType=${resourceType}&netType=01&toneFlag=PQ&scene=&lowerQualityContentId=${contentId}`,\n {\n headers: headers\n }\n );\n const blob = await res.blob();\n\n return await decryptData(blob);\n};\n\nconst SECURE = [\"Jk8qzuePiJ1qE3mDYhLQ3T73DtDoAhLP\"];\n\nconst blobToArrayBuffer = async(blob: Blob) => {\n return await blob.arrayBuffer();\n}\n\nfunction strToUtf8Bytes(e: string) {\n return new TextEncoder().encode(e)\n}\nfunction utf8Bytes2str(e: Uint8Array) {\n var t = []\n , n = !0\n , r = !1\n , o = undefined;\n try {\n\t\t//@ts-ignore\n for (var a, i = e[Symbol.iterator](); !(n = (a = i.next()).done); n = !0) {\n var s = a.value;\n s < 16 ? t.push(String.fromCharCode(s)) : (t.push(\"%\"),\n t.push(s.toString(16)))\n }\n } catch (e) {\n r = !0,\n o = e\n } finally {\n try {\n\t\t\t//@ts-ignore\n !n && i.return && i.return()\n } finally {\n if (r)\n throw o\n }\n }\n return decodeURIComponent(t.join(\"\"))\n}\nfunction decode(e: Uint8Array, t: string) {\n if (0 == t.length)\n return null;\n var n = e.length;\n if (n < 4)\n return null;\n if (171 != e[0] || 205 != e[1])\n return null;\n if (1 != e[2])\n return null;\n for (var r = e[3], o = strToUtf8Bytes(t), a = o.length, i = new Uint8Array(n - 4), s = 0, c = 4; c < n; c++,\n s++)\n i[s] = e[c] + r - o[s % a];\n return i\n}\n\nconst decryptData = async (blob: Blob) => {\n const ab = await blobToArrayBuffer(blob);\n\n const r = decode(new Uint8Array(ab), SECURE[0]);\n \n const d = utf8Bytes2str(r as Uint8Array);\n\n const data = JSON.parse(d);\n return data;\n}\n\n","import { h5fetch } from '../utils/h5fetch';\n\nexport const getVersion = async (channel: string = '0146921', version: string = '8.4.0', ua: string = 'Android_migu') => {\n return await h5fetch(\n `http://app.c.nf.migu.cn/MIGUM2.0/resource/client/version/v1.0`,\n {\n headers: {\n \"channel\": channel,\n \"ua\": ua,\n \"version\": version\n }\n }\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMO,IAAM,sBAAsB,CAAC,OAA4B;AAC5D,QAAM,aAAa,IAAI,gBAAgB;AACvC,aAAW,MAAM,WAAW,MAAM,GAAG,EAAE;AACvC,SAAO,WAAW;AACtB;AAQO,IAAM,UAAU,OAAO,KAAa,SAAuB;AAC9D,MAAI,CAAC,MAAM;AACP,WAAO;AAAA,MACH,QAAQ;AAAA,MACR,QAAQ,oBAAoB,GAAI;AAAA,IACpC;AAAA,EACJ,WAAW,CAAC,KAAK,QAAQ;AACrB,SAA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A,MACf;AAAA,IACJ;AAAA,EACJ;AACJ;;;AjCYO,SAAS,eAA2B;AACvC,SAAO;AACX;","names":["decryptData","SECURE","blobToArrayBuffer","e"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
declare const searchSong: (text: string, page?: number) => Promise<any>;
|
|
2
|
+
|
|
3
|
+
declare const searchAlbum: (text: string, page?: number, typeOrder?: number) => Promise<any>;
|
|
4
|
+
|
|
5
|
+
declare const searchSinger: (text: string, page?: number) => Promise<any>;
|
|
6
|
+
|
|
7
|
+
declare const searchConcert: (text: string, page?: number) => Promise<any>;
|
|
8
|
+
|
|
9
|
+
declare const getSearchHot: () => Promise<any>;
|
|
10
|
+
|
|
11
|
+
declare const getSearchDefault: () => Promise<any>;
|
|
12
|
+
|
|
13
|
+
declare const searchVideo: (text: string, page?: number, typeOrder?: number) => Promise<any>;
|
|
14
|
+
|
|
15
|
+
declare const searchSuggest: (text: string) => Promise<any>;
|
|
16
|
+
|
|
17
|
+
declare const searchRbt: (text: string, page?: number) => Promise<any>;
|
|
18
|
+
|
|
19
|
+
declare const searchTicket: (text: string, page?: number) => Promise<any>;
|
|
20
|
+
|
|
21
|
+
declare const getSearchSingerTab: () => Promise<any>;
|
|
22
|
+
|
|
23
|
+
declare const getSearchSingerTabList: (tab?: string) => Promise<any>;
|
|
24
|
+
|
|
25
|
+
declare const getAlbumInfo: (albumId: string) => Promise<any>;
|
|
26
|
+
|
|
27
|
+
declare const getAlbumSong: (albumId: string, page?: number) => Promise<any>;
|
|
28
|
+
|
|
29
|
+
declare const getPlaylistInfo: (playlistId: string) => Promise<any>;
|
|
30
|
+
|
|
31
|
+
declare const getPlaylistSong: (playlistId: string, page?: number, size?: number) => Promise<any>;
|
|
32
|
+
|
|
33
|
+
declare const getSingerIndex: (singerId: string) => Promise<any>;
|
|
34
|
+
|
|
35
|
+
declare const getSingerSong: (singerId: string, page?: number) => Promise<any>;
|
|
36
|
+
|
|
37
|
+
declare const getSingerAlbum: (singerId: string) => Promise<any>;
|
|
38
|
+
|
|
39
|
+
declare const getRankIndex: () => Promise<any>;
|
|
40
|
+
|
|
41
|
+
declare const getRankInfo: (rankId: string, page?: number) => Promise<any>;
|
|
42
|
+
|
|
43
|
+
declare const getRecommendPlaylist: () => Promise<any>;
|
|
44
|
+
|
|
45
|
+
declare const getRecommendSong: (size?: number, scene?: string) => Promise<any>;
|
|
46
|
+
|
|
47
|
+
declare const getComment: (resourceId: string, resourceType?: number, hotCommentStart?: number, size?: number) => Promise<any>;
|
|
48
|
+
|
|
49
|
+
declare const getResourceInfo: (resourceId: string, resourceType?: number) => Promise<any>;
|
|
50
|
+
|
|
51
|
+
declare const checkCanListen: (body: any) => Promise<any>;
|
|
52
|
+
|
|
53
|
+
declare const getOpNum: (ids: string) => Promise<any>;
|
|
54
|
+
|
|
55
|
+
declare const getUrlV1: (contentId: string, copyrightId: string, resourceType?: string) => Promise<any>;
|
|
56
|
+
|
|
57
|
+
declare const getUrlV2: (contentId: string, copyrightId: string, resourceType?: string) => Promise<any>;
|
|
58
|
+
|
|
59
|
+
declare const getUrlH5V24: (contentId: string, copyrightId: string, resourceType?: string) => Promise<any>;
|
|
60
|
+
|
|
61
|
+
declare const getVersion: (channel?: string, version?: string, ua?: string) => Promise<any>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* modules 子目录统一入口
|
|
65
|
+
* 汇总导出所有 API 函数
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
declare const api_checkCanListen: typeof checkCanListen;
|
|
69
|
+
declare const api_getAlbumInfo: typeof getAlbumInfo;
|
|
70
|
+
declare const api_getAlbumSong: typeof getAlbumSong;
|
|
71
|
+
declare const api_getComment: typeof getComment;
|
|
72
|
+
declare const api_getOpNum: typeof getOpNum;
|
|
73
|
+
declare const api_getPlaylistInfo: typeof getPlaylistInfo;
|
|
74
|
+
declare const api_getPlaylistSong: typeof getPlaylistSong;
|
|
75
|
+
declare const api_getRankIndex: typeof getRankIndex;
|
|
76
|
+
declare const api_getRankInfo: typeof getRankInfo;
|
|
77
|
+
declare const api_getRecommendPlaylist: typeof getRecommendPlaylist;
|
|
78
|
+
declare const api_getRecommendSong: typeof getRecommendSong;
|
|
79
|
+
declare const api_getResourceInfo: typeof getResourceInfo;
|
|
80
|
+
declare const api_getSearchDefault: typeof getSearchDefault;
|
|
81
|
+
declare const api_getSearchHot: typeof getSearchHot;
|
|
82
|
+
declare const api_getSearchSingerTab: typeof getSearchSingerTab;
|
|
83
|
+
declare const api_getSearchSingerTabList: typeof getSearchSingerTabList;
|
|
84
|
+
declare const api_getSingerAlbum: typeof getSingerAlbum;
|
|
85
|
+
declare const api_getSingerIndex: typeof getSingerIndex;
|
|
86
|
+
declare const api_getSingerSong: typeof getSingerSong;
|
|
87
|
+
declare const api_getUrlH5V24: typeof getUrlH5V24;
|
|
88
|
+
declare const api_getUrlV1: typeof getUrlV1;
|
|
89
|
+
declare const api_getUrlV2: typeof getUrlV2;
|
|
90
|
+
declare const api_getVersion: typeof getVersion;
|
|
91
|
+
declare const api_searchAlbum: typeof searchAlbum;
|
|
92
|
+
declare const api_searchConcert: typeof searchConcert;
|
|
93
|
+
declare const api_searchRbt: typeof searchRbt;
|
|
94
|
+
declare const api_searchSinger: typeof searchSinger;
|
|
95
|
+
declare const api_searchSong: typeof searchSong;
|
|
96
|
+
declare const api_searchSuggest: typeof searchSuggest;
|
|
97
|
+
declare const api_searchTicket: typeof searchTicket;
|
|
98
|
+
declare const api_searchVideo: typeof searchVideo;
|
|
99
|
+
declare namespace api {
|
|
100
|
+
export { api_checkCanListen as checkCanListen, api_getAlbumInfo as getAlbumInfo, api_getAlbumSong as getAlbumSong, api_getComment as getComment, api_getOpNum as getOpNum, api_getPlaylistInfo as getPlaylistInfo, api_getPlaylistSong as getPlaylistSong, api_getRankIndex as getRankIndex, api_getRankInfo as getRankInfo, api_getRecommendPlaylist as getRecommendPlaylist, api_getRecommendSong as getRecommendSong, api_getResourceInfo as getResourceInfo, api_getSearchDefault as getSearchDefault, api_getSearchHot as getSearchHot, api_getSearchSingerTab as getSearchSingerTab, api_getSearchSingerTabList as getSearchSingerTabList, api_getSingerAlbum as getSingerAlbum, api_getSingerIndex as getSingerIndex, api_getSingerSong as getSingerSong, api_getUrlH5V24 as getUrlH5V24, api_getUrlV1 as getUrlV1, api_getUrlV2 as getUrlV2, api_getVersion as getVersion, api_searchAlbum as searchAlbum, api_searchConcert as searchConcert, api_searchRbt as searchRbt, api_searchSinger as searchSinger, api_searchSong as searchSong, api_searchSuggest as searchSuggest, api_searchTicket as searchTicket, api_searchVideo as searchVideo };
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* migu-api-enhanced 包入口
|
|
105
|
+
* 直接复用 modules 导出,提供 createClient 工厂
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* 创建一个咪咕 API 客户端实例
|
|
110
|
+
* 返回对象包含所有 API 方法(直接复用 modules 函数)
|
|
111
|
+
* @returns 包含所有 API 方法的对象
|
|
112
|
+
*/
|
|
113
|
+
declare function createClient(): typeof api;
|
|
114
|
+
/** 客户端类型 */
|
|
115
|
+
type MiguClient = ReturnType<typeof createClient>;
|
|
116
|
+
|
|
117
|
+
export { type MiguClient, checkCanListen, createClient, getAlbumInfo, getAlbumSong, getComment, getOpNum, getPlaylistInfo, getPlaylistSong, getRankIndex, getRankInfo, getRecommendPlaylist, getRecommendSong, getResourceInfo, getSearchDefault, getSearchHot, getSearchSingerTab, getSearchSingerTabList, getSingerAlbum, getSingerIndex, getSingerSong, getUrlH5V24, getUrlV1, getUrlV2, getVersion, api as modules, searchAlbum, searchConcert, searchRbt, searchSinger, searchSong, searchSuggest, searchTicket, searchVideo };
|