migu-api-enhanced 2.27.0 → 2.27.1

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,2493 @@
1
+ // src/utils/h5fetch.ts
2
+ import axios from "axios";
3
+
4
+ // src/utils/setCookie.ts
5
+ var getCookieValue = (cookies, key) => {
6
+ for (const item of cookies) {
7
+ const prefix = `${key}=`;
8
+ if (item.includes(prefix)) {
9
+ const mainPart = item.split(";")[0];
10
+ return mainPart.split("=")[1] || "";
11
+ }
12
+ }
13
+ return "";
14
+ };
15
+ var getSetCookieValueFromObject = (headers, key) => {
16
+ const setCookieHeader = headers["set-cookie"];
17
+ if (!setCookieHeader) {
18
+ return "";
19
+ }
20
+ const cookies = Array.isArray(setCookieHeader) ? setCookieHeader : setCookieHeader.split(",").map((c) => c.trim());
21
+ return getCookieValue(cookies, key);
22
+ };
23
+
24
+ // src/utils/h5fetch.ts
25
+ var _fetch = async (url, init) => {
26
+ const method = (init?.method || "GET").toUpperCase();
27
+ const headersRaw = init?.headers;
28
+ let headers = {};
29
+ if (headersRaw) {
30
+ if (headersRaw instanceof Headers) {
31
+ headersRaw.forEach((value, key) => {
32
+ headers[key] = value;
33
+ });
34
+ } else if (Array.isArray(headersRaw)) {
35
+ headersRaw.forEach(([key, value]) => {
36
+ headers[key] = value;
37
+ });
38
+ } else {
39
+ headers = headersRaw;
40
+ }
41
+ }
42
+ const axiosConfig = {
43
+ url,
44
+ method,
45
+ headers,
46
+ params: init?.params,
47
+ maxRedirects: init?.maxRedirects,
48
+ data: init?.body
49
+ };
50
+ if (init?.signal) {
51
+ axiosConfig.signal = init.signal;
52
+ }
53
+ return await axios(axiosConfig);
54
+ };
55
+ var h5fetch = async (url, init) => {
56
+ const response = await _fetch(url, init);
57
+ return response.data;
58
+ };
59
+ var ckfetch = async (url, init) => {
60
+ const cookieKeys = init?.cookie ? Object.keys(init.cookie) : [];
61
+ const cookieHeader = init?.cookie ? Object.entries(init.cookie).map(([k, v]) => `${k}=${v}`).join("; ") : "";
62
+ const newHeaders = {};
63
+ if (init?.headers) {
64
+ if (init.headers instanceof Headers) {
65
+ init.headers.forEach((value, key) => {
66
+ newHeaders[key] = value;
67
+ });
68
+ } else if (Array.isArray(init.headers)) {
69
+ init.headers.forEach(([key, value]) => {
70
+ newHeaders[key] = value;
71
+ });
72
+ } else {
73
+ Object.assign(newHeaders, init.headers);
74
+ }
75
+ }
76
+ if (cookieHeader) newHeaders["Cookie"] = cookieHeader;
77
+ const response = await _fetch(url, { ...init, headers: newHeaders });
78
+ const cookies = {};
79
+ for (const key of cookieKeys) {
80
+ const value = getSetCookieValueFromObject(response.headers, key);
81
+ if (value) {
82
+ cookies[key] = value;
83
+ }
84
+ }
85
+ return {
86
+ data: response.data,
87
+ cookies
88
+ };
89
+ };
90
+
91
+ // src/modules/search.ts
92
+ var searchSong = async (text, page = 1) => {
93
+ return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/song/v1.0?pageNo=${page}&text=${text}`);
94
+ };
95
+
96
+ // src/modules/search_playlist.ts
97
+ var searchPlaylist = async (text, page = 1, typeOrder = 0) => {
98
+ return await h5fetch(`https://app.c.nf.migu.cn/bmw/search/music-list/v1.0?pageNo=${page}&text=${text}&typeOrder=${typeOrder}`);
99
+ };
100
+
101
+ // src/modules/search_album.ts
102
+ var searchAlbum = async (text, page = 1, typeOrder = 0) => {
103
+ return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/album/v1.0?pageNo=${page}&text=${text}&typeOrder=${typeOrder}`);
104
+ };
105
+
106
+ // src/modules/search_singer.ts
107
+ var searchSinger = async (text, page = 1) => {
108
+ return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/singer/v2.0?pageNo=${page}&text=${text}`);
109
+ };
110
+
111
+ // src/modules/search_concert.ts
112
+ var searchConcert = async (text, page = 1) => {
113
+ return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/concert/v1.0?pageNo=${page}&text=${text}`);
114
+ };
115
+
116
+ // src/modules/search_hot.ts
117
+ var getSearchHot = async () => {
118
+ return await h5fetch(`https://app.u.nf.migu.cn/bmw/hot-search/search-rank-list/v1.0`);
119
+ };
120
+
121
+ // src/modules/search_default.ts
122
+ var getSearchDefault = async () => {
123
+ return await h5fetch(`http://app.c.nf.migu.cn/column/search/default-text/v3.0?resourceVersion=2`);
124
+ };
125
+
126
+ // src/modules/search_mv.ts
127
+ var searchMv = async (text, page = 1, typeOrder = 0) => {
128
+ return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/video/v1.0?pageNo=${page}&text=${text}&typeOrder=${typeOrder}`);
129
+ };
130
+
131
+ // src/modules/search_suggest.ts
132
+ var searchSuggest = async (text) => {
133
+ return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/suggest/v1.0?text=${text}`);
134
+ };
135
+
136
+ // src/modules/search_rbt.ts
137
+ var searchRbt = async (text, page = 1) => {
138
+ return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/rbt/v1.0?pageNo=${page}&text=${text}`);
139
+ };
140
+
141
+ // src/modules/search_ticket.ts
142
+ var searchTicket = async (text, page = 1) => {
143
+ return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/ticket/v1.0?pageNo=${page}&text=${text}`);
144
+ };
145
+
146
+ // src/modules/search_singerTab.ts
147
+ var getSearchSingerTab = async () => {
148
+ return await h5fetch(`https://app.u.nf.migu.cn/MIGUM3.0/bmw/singer-index/tabs/v2.0`);
149
+ };
150
+
151
+ // src/modules/search_singerTab_list.ts
152
+ var getSearchSingerTabList = async (tab = "") => {
153
+ return await h5fetch(`https://app.u.nf.migu.cn/MIGUM3.0/bmw/singer-index/list/v1.0?tab=${tab}&templateVersion=3`);
154
+ };
155
+
156
+ // src/modules/album_info.ts
157
+ var getAlbumInfo = async (albumId) => {
158
+ return await h5fetch(`http://app.c.nf.migu.cn/MIGUM3.0/resource/album/v2.0?albumId=${albumId}`);
159
+ };
160
+
161
+ // src/modules/album_song.ts
162
+ var getAlbumSong = async (albumId, page = 1) => {
163
+ return await h5fetch(`http://app.c.nf.migu.cn/MIGUM3.0/resource/album/song/v2.0?albumId=${albumId}&pageNo=${page}`);
164
+ };
165
+
166
+ // src/modules/playlist_info.ts
167
+ var getPlaylistInfo = async (playlistId) => {
168
+ return await h5fetch(`https://app.c.nf.migu.cn/resource/playlist/v2.0?playlistId=${playlistId}`);
169
+ };
170
+
171
+ // src/modules/playlist_song.ts
172
+ var getPlaylistSong = async (playlistId, page = 1, size = 20) => {
173
+ return await h5fetch(`https://app.c.nf.migu.cn/MIGUM3.0/resource/playlist/song/v2.0?pageNo=${page}&pageSize=${size}&playlistId=${playlistId}`);
174
+ };
175
+
176
+ // src/modules/singer_index.ts
177
+ var getSingerIndex = async (singerId) => {
178
+ return await h5fetch(`http://app.c.nf.migu.cn/bmw/singer/index/v1.0?singerId=${singerId}`);
179
+ };
180
+
181
+ // src/modules/singer_song.ts
182
+ var getSingerSong = async (singerId, page = 1) => {
183
+ return await h5fetch(`http://app.c.nf.migu.cn/bmw/singer/song/v1.0?pageNo=${page}&singerId=${singerId}&type=1`);
184
+ };
185
+
186
+ // src/modules/singer_album.ts
187
+ var getSingerAlbum = async (singerId, page = 1) => {
188
+ const res = await h5fetch(`http://app.c.nf.migu.cn/bmw/singer/album/v1.0?singerId=${singerId}&pageNo=${page}`);
189
+ res?.data?.header?.nextPageUrl ? res.data.header.hasNext = true : res.data.header.hasNext = false;
190
+ return res;
191
+ };
192
+
193
+ // src/modules/rank_index.ts
194
+ var getRankIndex = async () => {
195
+ return await h5fetch(`https://app.c.nf.migu.cn/pc/bmw/rank/rank-index/v1.0`);
196
+ };
197
+
198
+ // src/modules/rank_info.ts
199
+ var getRankInfo = async (rankId, page = 1) => {
200
+ return await h5fetch(`http://app.c.nf.migu.cn/bmw/rank/rank-info/v1.0?pageNo=${page}&rankId=${rankId}`);
201
+ };
202
+
203
+ // src/modules/recommend_playlist.ts
204
+ var getRecommendPlaylist = async () => {
205
+ return await h5fetch(`http://app.c.nf.migu.cn/bmw/index-show/recommend-playlist/v3.0`);
206
+ };
207
+
208
+ // src/utils/deviceID.ts
209
+ function getDeviceId(a, b) {
210
+ var c, d = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""), e2 = [];
211
+ if (b = b || d.length, a)
212
+ for (c = 0; a > c; c++)
213
+ e2[c] = d[0 | Math.random() * b];
214
+ else {
215
+ var f;
216
+ for (e2[8] = e2[13] = e2[18] = e2[23] = "-", e2[14] = "4", c = 0; 36 > c; c++)
217
+ e2[c] || (f = 0 | 16 * Math.random(), e2[c] = d[19 == c ? 3 & f | 8 : f]);
218
+ }
219
+ return e2.join("");
220
+ }
221
+
222
+ // src/modules/recommend_song.ts
223
+ var getSceneRecommend = async (scene = "TODAY_RECOMMEND", size = 10) => {
224
+ let params = "";
225
+ if (scene === "PRIVATE_FM") {
226
+ params = "scene=PRIVATE_FM&algorithm=v1&action=1";
227
+ } else if (scene === "TODAY_RECOMMEND") {
228
+ params = `scene=TODAY_RECOMMEND&action=1&size=${size}`;
229
+ } else {
230
+ return { error: "scene\u53C2\u6570\u9519\u8BEF PRIVATE_FM \u6216 TODAY_RECOMMEND" };
231
+ }
232
+ return await h5fetch(
233
+ `https://app.c.nf.migu.cn/pc/resource-dataloader/recommend-song/v1.0?${params}`,
234
+ {
235
+ headers: {
236
+ "deviceId": getDeviceId()
237
+ }
238
+ }
239
+ );
240
+ };
241
+
242
+ // src/modules/recommend_radio.ts
243
+ var getRadioRecommend = async (type = 1) => {
244
+ if (type !== 1 && type !== 2) {
245
+ return { error: "type must be 1 or 2" };
246
+ }
247
+ return await h5fetch(
248
+ `https://app.c.nf.migu.cn/pc/column/music-radio/recommend/song/v2.0?remain=0&actionId=1&type=${type}`,
249
+ {
250
+ method: "GET",
251
+ headers: {
252
+ "Referer": "https://music.migu.cn/",
253
+ "channel": "014X031",
254
+ "deviceId": getDeviceId(),
255
+ "recommendstatus": "1"
256
+ }
257
+ }
258
+ );
259
+ };
260
+
261
+ // src/modules/comment.ts
262
+ var getComment = async (resourceId, resourceType = 2, size = 20, hotCommentStart = 0) => {
263
+ return await h5fetch(`https://u.musicapp.migu.cn/MIGUM3.0/user/comment/stack/v1.0?resourceId=${resourceId}&resourceType=${resourceType}&pageSize=${size}&hotCommentStart=${hotCommentStart}&platformType=1&commentId=0&queryType=1`);
264
+ };
265
+
266
+ // src/modules/resourceinfo.ts
267
+ var getResourceInfo = async (resourceIds = "", copyrightIds = "", resourceType = 2) => {
268
+ resourceIds = resourceIds.replace(/,/g, "|");
269
+ copyrightIds = copyrightIds.replace(/,/g, "|");
270
+ return await h5fetch(`https://app.u.nf.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?resourceId=${resourceIds}&copyrightId=${copyrightIds}&resourceType=${resourceType}`);
271
+ };
272
+
273
+ // src/modules/can-listen.ts
274
+ var checkCanListen = async (contentIds) => {
275
+ return await h5fetch(
276
+ `https://app.c.nf.migu.cn/strategy/pc/can-listen/v1.0`,
277
+ {
278
+ method: "post",
279
+ headers: {
280
+ "Content-Type": "application/json",
281
+ "channel": "014X031"
282
+ // music.migu.cn
283
+ },
284
+ body: JSON.stringify({
285
+ "contentIds": contentIds
286
+ })
287
+ }
288
+ );
289
+ };
290
+
291
+ // src/modules/opNum.ts
292
+ var getOpNum = async (ids) => {
293
+ return await h5fetch(`https://app.c.nf.migu.cn/opnum/query-optype-v1.0?opType=play&resourceType=2021&ids=${ids}`);
294
+ };
295
+
296
+ // src/utils/quality.ts
297
+ var qualityList = [
298
+ "LQ",
299
+ "PQ",
300
+ "HQ",
301
+ "SQ",
302
+ "ZQ24",
303
+ "ZQ32",
304
+ "Z3D",
305
+ "3D60"
306
+ ];
307
+ var e = encodeURI;
308
+ var toneUrl = {
309
+ "LQ": e("\u5168\u66F2\u8BD5\u542C/Mp3_64_22_16"),
310
+ "PQ": e("\u6807\u6E05\u9AD8\u6E05/MP3_128_16_Stero"),
311
+ "HQ": e("\u6807\u6E05\u9AD8\u6E05/MP3_320_16_Stero"),
312
+ "SQ": e("\u6B4C\u66F2\u4E0B\u8F7D/flac"),
313
+ "ZQ24": e("\u6B4C\u66F2\u4E0B\u8F7D/flac_24bit"),
314
+ "ZQ32": e("\u6B4C\u66F2\u4E0B\u8F7D/wav_32bit"),
315
+ "Z3D": e("\u6B4C\u66F2\u4E0B\u8F7D/wav_3d"),
316
+ "3D60": e("\u6B4C\u66F2\u4E0B\u8F7D/wav_3d_60s")
317
+ //3D 60s 试听
318
+ };
319
+ var toneUrlList = Object.entries(toneUrl);
320
+ var toneFormat = {
321
+ "LQ": ".mp3",
322
+ "PQ": ".mp3",
323
+ "HQ": ".mp3",
324
+ "SQ": ".flac",
325
+ "ZQ24": ".flac",
326
+ "ZQ32": ".wav",
327
+ "Z3D": ".wav",
328
+ "3D60": ".wav"
329
+ };
330
+ function isQuality(quality) {
331
+ return qualityList.includes(quality);
332
+ }
333
+ function getQuality(url) {
334
+ let tone = "";
335
+ if (!tone) {
336
+ for (let i = 0; i < toneUrlList.length; i++) {
337
+ const [key, value] = toneUrlList[i];
338
+ if (url.includes(value)) {
339
+ tone = key;
340
+ break;
341
+ }
342
+ }
343
+ }
344
+ return tone;
345
+ }
346
+ function changeQuality(url, quality, originalQuality, splitQuery = true) {
347
+ const originalTone = isQuality(originalQuality) ? originalQuality : getQuality(url);
348
+ if (splitQuery) {
349
+ url = url.split("?")[0];
350
+ }
351
+ if (!isQuality(quality) || !isQuality(originalTone)) {
352
+ return url;
353
+ } else {
354
+ return url.replace(toneUrl[originalTone], toneUrl[quality]).replace(toneFormat[originalTone], toneFormat[quality]);
355
+ }
356
+ }
357
+
358
+ // src/modules/url_v1.ts
359
+ var getUrlV1 = async (contentId, copyrightId, toneFlag = "PQ", resourceType = "2") => {
360
+ const data = await h5fetch(
361
+ `https://app.c.nf.migu.cn/MIGUM3.0/strategy/pc/listen/v1.0?contentId=${contentId}&copyrightId=${copyrightId}&resourceType=${resourceType}&toneFlag=PQ`,
362
+ {
363
+ headers: {
364
+ "Channel": "014X031"
365
+ }
366
+ }
367
+ );
368
+ data.data.oriUrl = data.data.url || "";
369
+ data.data.url = changeQuality(data.data.url || "", toneFlag, "PQ", true);
370
+ return data;
371
+ };
372
+
373
+ // src/modules/url_v2.ts
374
+ import axios2 from "axios";
375
+ var getUrlV2 = async (contentId, copyrightId, toneFlag = "PQ", pacmtoken = "") => {
376
+ const deviceId = getDeviceId();
377
+ const timestamp = Date.now();
378
+ const headers = {
379
+ "channel": "014X031",
380
+ "subchannel": "014X031",
381
+ "pacmtoken": pacmtoken,
382
+ "deviceId": deviceId,
383
+ "ua": "Android_migu",
384
+ "version": "6.8.8",
385
+ "activityId": "MUSIC-WWW",
386
+ "birth": "h5page",
387
+ "signature": "1",
388
+ "timestamp": timestamp.toString(),
389
+ "referer": "https://music.migu.cn/"
390
+ };
391
+ const res = await axios2.get(
392
+ `https://app.c.nf.migu.cn/strategy/pc/listen/v2.0?contentId=${contentId}&copyrightId=${copyrightId}&scene=&netType=01&resourceType=2&toneFlag=${toneFlag}`,
393
+ {
394
+ headers,
395
+ responseType: "arraybuffer"
396
+ }
397
+ );
398
+ return await decryptData(res.data);
399
+ };
400
+ var SECURE = "Jk8qzuePiJ1qE3mDYhLQ3T73DtDoAhLP";
401
+ var aw = 171;
402
+ var iw = 205;
403
+ var ow = 1;
404
+ function textEncode(e2) {
405
+ return new TextEncoder().encode(e2);
406
+ }
407
+ function textDecode(e2) {
408
+ return new TextDecoder("utf-8").decode(e2);
409
+ }
410
+ function decryptBlob(e2, r) {
411
+ if (r.length == 0)
412
+ return null;
413
+ var n = e2.length;
414
+ if (n < 4 || !(e2[0] == aw && e2[1] == iw) || e2[2] != ow)
415
+ return null;
416
+ for (var t = e2[3], a = textEncode(r), i = a.length, o = new Uint8Array(n - 4), s = 0, c = 4; c < n; c++, s++)
417
+ o[s] = e2[c] + t - a[s % i];
418
+ return o;
419
+ }
420
+ function decryptData(buf) {
421
+ let l = buf, a = SECURE, u = decryptBlob(new Uint8Array(l), a), p = u ? textDecode(u) : null;
422
+ try {
423
+ const data = p ? JSON.parse(p) : null;
424
+ return data;
425
+ } catch (e2) {
426
+ return null;
427
+ }
428
+ ;
429
+ }
430
+
431
+ // src/modules/url_h5v2.4.ts
432
+ import axios3 from "axios";
433
+ var getUrlH5V24 = async (contentId, copyrightId, toneFlag = "PQ") => {
434
+ const headers = {
435
+ "birth": "h5page",
436
+ "channel": "014X031",
437
+ "Referer": "https://y.migu.cn/",
438
+ "location-data": "30.6698676660,104.1229614820",
439
+ "location-info": ""
440
+ };
441
+ const res = await axios3.get(
442
+ `https://c.musicapp.migu.cn/strategy/listen-url/h5/v2.4?contentId=${contentId}&copyrightId=${copyrightId}&resourceType=2&netType=01&toneFlag=PQ&scene=&lowerQualityContentId=${contentId}`,
443
+ {
444
+ headers,
445
+ responseType: "arraybuffer"
446
+ }
447
+ );
448
+ const data = await decryptData2(res.data);
449
+ if (data?.data?.url === "") {
450
+ return { success: false, error: "URL \u4E3A\u7A7A" };
451
+ }
452
+ data.data.oriUrl = data.data.url || "";
453
+ data.data.url = changeQuality(data.data.url || "", toneFlag, "PQ", true);
454
+ return data;
455
+ };
456
+ var SECURE2 = ["Jk8qzuePiJ1qE3mDYhLQ3T73DtDoAhLP"];
457
+ function strToUtf8Bytes(e2) {
458
+ return new TextEncoder().encode(e2);
459
+ }
460
+ function utf8Bytes2str(bytes) {
461
+ const result = [];
462
+ for (const byte of bytes) {
463
+ if (byte < 16) {
464
+ result.push(String.fromCharCode(byte));
465
+ } else {
466
+ result.push("%");
467
+ result.push(byte.toString(16));
468
+ }
469
+ }
470
+ return decodeURIComponent(result.join(""));
471
+ }
472
+ function decode(e2, t) {
473
+ if (0 == t.length)
474
+ return null;
475
+ var n = e2.length;
476
+ if (n < 4)
477
+ return null;
478
+ if (171 != e2[0] || 205 != e2[1])
479
+ return null;
480
+ if (1 != e2[2])
481
+ return null;
482
+ for (var r = e2[3], o = strToUtf8Bytes(t), a = o.length, i = new Uint8Array(n - 4), s = 0, c = 4; c < n; c++, s++)
483
+ i[s] = e2[c] + r - o[s % a];
484
+ return i;
485
+ }
486
+ var decryptData2 = (ab) => {
487
+ const r = decode(new Uint8Array(ab), SECURE2[0]);
488
+ const d = utf8Bytes2str(r);
489
+ return JSON.parse(d);
490
+ };
491
+
492
+ // src/modules/version.ts
493
+ var getVersion = async () => {
494
+ return await h5fetch(
495
+ `http://app.c.nf.migu.cn/column/client/version/v1.0`,
496
+ {
497
+ headers: {
498
+ "ua": "Android_migu",
499
+ "version": "0.0.1"
500
+ }
501
+ }
502
+ );
503
+ };
504
+
505
+ // src/modules/mv_info.ts
506
+ var getMvInfo = async (mvContentIds) => {
507
+ mvContentIds = mvContentIds.replace(/,/g, "|");
508
+ return await h5fetch(`https://c.musicapp.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?resourceId=${mvContentIds}&resourceType=D&needSimple=01`);
509
+ };
510
+
511
+ // src/modules/mv_hls.ts
512
+ var getMvHls = async (mvContentId, mvCopyrightId, url, size, format = "050012", needHttps = true) => {
513
+ url = encodeURIComponent(url);
514
+ return await h5fetch(
515
+ `https://c.musicapp.migu.cn/MIGUM2.0/v1.0/content/mvplayinfo.do?format=${format}&mvContentId=${mvContentId}&mvCopyrightId=${mvCopyrightId}&needHttps=${needHttps}&size=${size}&url=${url}`,
516
+ {
517
+ method: "GET",
518
+ headers: {
519
+ "Channel": "014021I"
520
+ }
521
+ }
522
+ );
523
+ };
524
+
525
+ // src/modules/login_np.ts
526
+ import axios4 from "axios";
527
+
528
+ // src/utils/rsalib.ts
529
+ import crypto from "crypto";
530
+ function hexToBase64Url(hex) {
531
+ const buffer = Buffer.from(hex, "hex");
532
+ return buffer.toString("base64url");
533
+ }
534
+ var RSAKey = class {
535
+ publicKey = null;
536
+ setPublic(modulus, exponent) {
537
+ try {
538
+ const jwkKey = {
539
+ kty: "RSA",
540
+ n: hexToBase64Url(modulus),
541
+ e: hexToBase64Url(exponent)
542
+ };
543
+ this.publicKey = crypto.createPublicKey({
544
+ key: jwkKey,
545
+ format: "jwk"
546
+ });
547
+ } catch (error) {
548
+ console.error("Failed to create public key:", error);
549
+ this.publicKey = null;
550
+ }
551
+ }
552
+ encrypt(text) {
553
+ if (!this.publicKey) {
554
+ console.error("Public key not set");
555
+ return null;
556
+ }
557
+ try {
558
+ const buffer = Buffer.from(text, "utf-8");
559
+ const encrypted = crypto.publicEncrypt(
560
+ {
561
+ key: this.publicKey,
562
+ padding: crypto.constants.RSA_PKCS1_PADDING
563
+ },
564
+ buffer
565
+ );
566
+ return encrypted.toString("hex");
567
+ } catch (error) {
568
+ console.error("RSA encryption failed:", error);
569
+ return null;
570
+ }
571
+ }
572
+ };
573
+
574
+ // src/utils/publicKey.ts
575
+ var getPublicKey = async () => {
576
+ const data = await h5fetch(
577
+ "https://passport.migu.cn/password/publickey",
578
+ {
579
+ method: "POST"
580
+ }
581
+ );
582
+ const publicExponent = data.result.publicExponent;
583
+ const modulus = data.result.modulus;
584
+ return { publicExponent, modulus };
585
+ };
586
+
587
+ // src/utils/URLParams.ts
588
+ function URLParams($) {
589
+ const form = new URLSearchParams();
590
+ for (const [key, value] of Object.entries($)) {
591
+ form.append(key, String(value));
592
+ }
593
+ return form.toString();
594
+ }
595
+
596
+ // src/modules/login_np.ts
597
+ function randomString() {
598
+ const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
599
+ return random.toLowerCase();
600
+ }
601
+ var loginNP = {
602
+ /**
603
+ * 账号密码登录
604
+ * @param username 用户名
605
+ * @param password 密码
606
+ * @returns 登录成功后的 pacmtoken
607
+ */
608
+ async authn(username, password) {
609
+ var $ = {
610
+ "isAsync": true,
611
+ "enpassword": "",
612
+ "captcha": "",
613
+ "appType": "0",
614
+ "loginID": "",
615
+ "relayState": "",
616
+ "sourceID": "220029",
617
+ "imgcodeType": "1",
618
+ "fingerPrint": "",
619
+ "fingerPrintDetail": ""
620
+ };
621
+ const p = await getPublicKey();
622
+ const { publicExponent, modulus } = p || {};
623
+ if (!modulus || !publicExponent) {
624
+ return { error: "\u83B7\u53D6\u516C\u94A5\u5931\u8D25" };
625
+ }
626
+ var rsa = new RSAKey();
627
+ rsa.setPublic(modulus, publicExponent);
628
+ const rsa_pwd = rsa.encrypt(password);
629
+ const rsa_username = rsa.encrypt(username);
630
+ const fakeFingerprint = randomString();
631
+ $.fingerPrint = fakeFingerprint;
632
+ $.fingerPrintDetail = fakeFingerprint;
633
+ $.enpassword = rsa_pwd || "";
634
+ $.loginID = rsa_username || "";
635
+ const form = URLParams($);
636
+ const res = await axios4.post(
637
+ `https://passport.migu.cn/authn`,
638
+ form,
639
+ {
640
+ headers: {
641
+ "Host": "passport.migu.cn",
642
+ "Content-Type": "application/x-www-form-urlencoded",
643
+ "Referer": "https://passport.migu.cn/login",
644
+ "Origin": "https://passport.migu.cn"
645
+ }
646
+ }
647
+ );
648
+ return res.data;
649
+ }
650
+ };
651
+
652
+ // src/modules/passport_checkToken.ts
653
+ var checkToken = async (token = "") => {
654
+ return await h5fetch(
655
+ `https://c.musicapp.migu.cn/mgateway/api/checkPacMtoken`,
656
+ {
657
+ headers: {
658
+ "pacmtoken": token
659
+ }
660
+ }
661
+ );
662
+ };
663
+
664
+ // src/modules/passport_pacmToken.ts
665
+ var getPacmToken = async (token = "", type = "2", sourceId = "220029", activityId = "MUSIC-WWW") => {
666
+ const { data, cookies } = await ckfetch(
667
+ `https://c.musicapp.migu.cn/user/h5/token-validate/v3.0?token=${token}&type=${type}&sourceId=${sourceId}&activityId=${activityId}`,
668
+ {
669
+ cookie: { idmpauth: "true@passport.migu.cn" },
670
+ headers: {
671
+ "Origin": "https://music.migu.cn",
672
+ "Pragma": "no-cache",
673
+ "Referer": "https://music.migu.cn/"
674
+ }
675
+ }
676
+ );
677
+ const pacmToken = cookies.pacmtoken || "";
678
+ return { pacmToken, body: data };
679
+ };
680
+
681
+ // src/modules/ticket.ts
682
+ var getTicketInfo = async (page = 1, size = 20) => {
683
+ return await h5fetch(`https://app.c.nf.migu.cn/MIGUM3.0/v1.0/ticket/home/ticket?pageNum=${page}&pageCount=${size}`);
684
+ };
685
+
686
+ // src/modules/user_badge.ts
687
+ var getUserBadge = async (pacmtoken) => {
688
+ const { data, cookies } = await ckfetch("https://app.c.nf.migu.cn/pc/open/api/member/icon/v1.0", {
689
+ cookie: { pacmtoken },
690
+ headers: {
691
+ "Referer": "https://music.migu.cn/",
692
+ "channel": "014X031",
693
+ "timestamp": Date.now().toString()
694
+ }
695
+ });
696
+ return { data, newPacmToken: cookies.pacmtoken || "" };
697
+ };
698
+
699
+ // src/modules/user_queryInfo.ts
700
+ var queryUserInfo = async (pacmtoken) => {
701
+ const { data, cookies } = await ckfetch("https://app.c.nf.migu.cn/pc/user/h5/queryUserInfo/v1.0", {
702
+ cookie: { pacmtoken },
703
+ headers: {
704
+ "channel": "014X031",
705
+ "Referer": "https://music.migu.cn/"
706
+ }
707
+ });
708
+ return { data, newPacmToken: cookies.pacmtoken || "" };
709
+ };
710
+
711
+ // src/modules/user_homePage.ts
712
+ var getUserHomePage = async (pacmtoken) => {
713
+ const { data, cookies } = await ckfetch("https://app.c.nf.migu.cn/pc/user/home-page/v2.0", {
714
+ cookie: { pacmtoken }
715
+ });
716
+ return { data, newPacmToken: cookies.pacmtoken || "" };
717
+ };
718
+
719
+ // src/modules/user_recom_today.ts
720
+ var getTodayRecommend = async (pacmtoken) => {
721
+ const { data, cookies } = await ckfetch("https://app.c.nf.migu.cn/pc/v1.0/template/todayRecommendList/release?actionId=1&index=1&templateVersion=5", {
722
+ cookie: { pacmtoken }
723
+ });
724
+ return { data, newPacmToken: cookies.pacmtoken || "" };
725
+ };
726
+
727
+ // src/modules/login_sim.ts
728
+ import axios5 from "axios";
729
+ function randomString2() {
730
+ const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
731
+ return random.toLowerCase();
732
+ }
733
+ var loginSim = {
734
+ async simSend(phone) {
735
+ var $;
736
+ $ = {
737
+ "isAsync": true,
738
+ "sim": "1",
739
+ "encMsisdn": "",
740
+ "appType": "0",
741
+ "relayState": "",
742
+ "sourceID": "220029",
743
+ "fingerPrint": "",
744
+ "fingerPrintDetail": ""
745
+ };
746
+ const p = await getPublicKey();
747
+ const { publicExponent, modulus } = p || {};
748
+ if (!modulus || !publicExponent) {
749
+ return { error: "\u83B7\u53D6\u516C\u94A5\u5931\u8D25" };
750
+ }
751
+ const rsa = new RSAKey();
752
+ rsa.setPublic(modulus, publicExponent);
753
+ const encPhone = rsa.encrypt(phone);
754
+ const fakeFingerprint = randomString2();
755
+ $.fingerPrint = fakeFingerprint;
756
+ $.fingerPrintDetail = fakeFingerprint;
757
+ $.encMsisdn = encPhone || "";
758
+ const form = URLParams($);
759
+ const send = await axios5.post(
760
+ `https://passport.migu.cn/api/simauth/send`,
761
+ form,
762
+ {
763
+ headers: {
764
+ "Host": "passport.migu.cn",
765
+ "Content-Type": "application/x-www-form-urlencoded",
766
+ "Referer": "https://passport.migu.cn/login",
767
+ "Origin": "https://passport.migu.cn"
768
+ }
769
+ }
770
+ );
771
+ const sendbody = send.data;
772
+ if (!sendbody && sendbody.status != "2000") {
773
+ return { error: sendbody };
774
+ }
775
+ const sim_sessionid = sendbody.result.sim_sessionid || "";
776
+ if (!sim_sessionid) return { error: "sim_sessionid e" };
777
+ return { sim_sessionid };
778
+ },
779
+ async simQuery(sim_sessionid) {
780
+ const $ = {
781
+ "isAsync": true,
782
+ "sim_sessionid": sim_sessionid,
783
+ "sourceID": "220029"
784
+ };
785
+ const form = URLParams($);
786
+ const query = await axios5.post(
787
+ `https://passport.migu.cn/api/simauth/query`,
788
+ form,
789
+ {
790
+ method: "POST",
791
+ headers: {
792
+ "Host": "passport.migu.cn",
793
+ "Content-Type": "application/x-www-form-urlencoded",
794
+ "Referer": "https://passport.migu.cn/login",
795
+ "Origin": "https://passport.migu.cn"
796
+ }
797
+ }
798
+ );
799
+ const querybody = query.data;
800
+ if (querybody.status == "4071") {
801
+ return { error: "waiting", body: querybody };
802
+ } else if (querybody.status == "2000") {
803
+ const token = querybody?.result?.token || "";
804
+ const status = querybody?.status || "";
805
+ return { token, status };
806
+ } else {
807
+ return { error: querybody.status, body: querybody };
808
+ }
809
+ }
810
+ };
811
+
812
+ // src/modules/user_collect_list.ts
813
+ var getUserCollectList = async (pacmtoken, page = 1, size = 20) => {
814
+ const { data, cookies } = await ckfetch(`https://app.c.nf.migu.cn/user/h5/user/collection/v1.0?pageNo=${page}&type=1&OPType=03&pageSize=${size}&resourceType=2021`, {
815
+ cookie: { pacmtoken }
816
+ });
817
+ return { data, newPacmToken: cookies.pacmtoken || "" };
818
+ };
819
+
820
+ // src/modules/user_myList.ts
821
+ var getUserMyList = async (pacmtoken, queryType = 0, page = 1, size = 20) => {
822
+ const { data, cookies } = await ckfetch(`https://app.c.nf.migu.cn/user/h5/my-music-list/v1.0?queryType=${queryType}&pageNo=${page}&pageSize=${size}`, {
823
+ cookie: { pacmtoken }
824
+ });
825
+ return { data, newPacmToken: cookies.pacmtoken || "" };
826
+ };
827
+
828
+ // src/modules/singer_similar.ts
829
+ var getSingerSimilar = async (singerId) => {
830
+ return await h5fetch(`https://app.c.nf.migu.cn/bmw/recommend-singer/similar/v1.0?singerId=${singerId}`);
831
+ };
832
+
833
+ // src/modules/recommend_similarSong.ts
834
+ var getSimilarSongRecommend = async (contentId = "") => {
835
+ return await h5fetch(
836
+ `https://app.c.nf.migu.cn/bmw/recommend-song/similar/v1.0?contentId=${contentId}`,
837
+ {
838
+ method: "GET",
839
+ headers: {
840
+ "deviceId": getDeviceId(),
841
+ "recommendstatus": "1"
842
+ }
843
+ }
844
+ );
845
+ };
846
+
847
+ // src/modules/login_oneclick.ts
848
+ import axios6 from "axios";
849
+ import crypto2 from "crypto";
850
+ var nav = {
851
+ "platform": "iPhone",
852
+ "userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Mobile/15E148 Safari/604.1",
853
+ "appVersion": "5.0 (iPhone; CPU iPhone OS 17_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Mobile/15E148 Safari/604.1",
854
+ "cookieEnabled": true,
855
+ "empty": null,
856
+ "hardwareConcurrency": 6,
857
+ "language": "zh-CN",
858
+ "plugins": "",
859
+ "availWidth": 390,
860
+ "availHeight": 844,
861
+ "colorDepth": 24,
862
+ "timezoneOffset": -480
863
+ };
864
+ var YDRZ = {
865
+ "optparams": {
866
+ "uuid": "",
867
+ "msgId": "",
868
+ "traceId": "",
869
+ "businessType": "10",
870
+ "appId": "",
871
+ "timestamp": yTime(),
872
+ "isimge": false,
873
+ "expandParams": "",
874
+ "userInformations": "",
875
+ "CMRequestApi": ""
876
+ },
877
+ randomString(len, range = 32) {
878
+ var i, bite = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""), list = [];
879
+ for (i = 0; i < len; i++)
880
+ list[i] = bite[0 | Math.random() * range];
881
+ return list.join("");
882
+ },
883
+ randomRange(min, max) {
884
+ return Math.floor(Math.random() * (min - max) + max);
885
+ },
886
+ getUA() {
887
+ const ua = nav.userAgent, l = [
888
+ nav.platform,
889
+ ua,
890
+ nav.appVersion,
891
+ nav.cookieEnabled,
892
+ void 0,
893
+ nav.hardwareConcurrency,
894
+ nav.language,
895
+ nav.plugins,
896
+ nav.availWidth,
897
+ nav.availHeight,
898
+ nav.colorDepth,
899
+ nav.timezoneOffset
900
+ ], key = l.join("@@"), finalUA = ua.length > 100 ? ua.substring(0, 100) : ua;
901
+ return nav.platform + "@@" + finalUA + "@@" + md5(key);
902
+ },
903
+ uaE(str) {
904
+ var b, c, d, r4, r1, r2, r3, result = "", bite = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", i = 0;
905
+ for (; i < str.length; )
906
+ r4 = (b = str.charCodeAt(i++)) >> 2, r1 = (3 & b) << 4 | (c = str.charCodeAt(i++)) >> 4, r2 = (15 & c) << 2 | (d = str.charCodeAt(i++)) >> 6, r3 = 63 & d, isNaN(c) ? r2 = r3 = 64 : isNaN(d) && (r3 = 64), result = result + bite.charAt(r4) + bite.charAt(r1) + bite.charAt(r2) + bite.charAt(r3);
907
+ return result;
908
+ },
909
+ getUserInfo() {
910
+ return encodeURIComponent(this.uaE(this.getUA()));
911
+ },
912
+ getSign(appID, version) {
913
+ const optparams = this.optparams;
914
+ optparams.uuid = this.randomString(32, 32);
915
+ optparams.msgId = this.randomString(32, 32);
916
+ this.optparams = optparams;
917
+ return appID + optparams.msgId + optparams.timestamp + optparams.uuid + version;
918
+ },
919
+ async getTokenInfo(data) {
920
+ const optparams = this.optparams;
921
+ const requestData = {
922
+ "version": data.version,
923
+ "appId": data.appId,
924
+ "openType": data.openType,
925
+ "expandParams": data.expandParams,
926
+ "isTest": data.isTest,
927
+ "sign": data.sign,
928
+ "getNetworkType": data.getNetworkType,
929
+ "getMsisdnMask": data.getMsisdnMask,
930
+ "traceId": optparams.uuid,
931
+ "msgId": optparams.msgId,
932
+ "timestamp": optparams.timestamp,
933
+ "uuid": optparams.uuid,
934
+ "businessType": optparams.businessType,
935
+ "userInformations": this.getUserInfo()
936
+ };
937
+ const res = await axios6.post(
938
+ "https://verify.cmpassport.com/h5/getPreMobile",
939
+ requestData,
940
+ {
941
+ headers: {
942
+ "Referer": "https://passport.migu.cn/",
943
+ "Origin": "https://passport.migu.cn"
944
+ }
945
+ }
946
+ );
947
+ if (!res.data) return;
948
+ const json = res.data, token = json?.token || "";
949
+ if (!token) return;
950
+ return token;
951
+ }
952
+ };
953
+ function yTime() {
954
+ const date = /* @__PURE__ */ new Date(), a = [
955
+ date.getFullYear(),
956
+ date.getMonth() + 1,
957
+ date.getDate(),
958
+ date.getHours(),
959
+ date.getMinutes(),
960
+ date.getSeconds(),
961
+ date.getMilliseconds()
962
+ ];
963
+ const f = a.map((t) => {
964
+ return t.toString().padStart(2, "0");
965
+ });
966
+ f[6] = f[6].toString().padStart(3, "0");
967
+ return f.join("");
968
+ }
969
+ function md5(s) {
970
+ return crypto2.createHash("md5").update(s, "utf-8").digest("hex");
971
+ }
972
+ var genInternetSign = async () => {
973
+ const time = yTime(), e2 = time, c = "220029", msgId = getDeviceId(), d = msgId;
974
+ const preSign = YDRZ.getSign("300012033963", "1.2"), b = preSign;
975
+ let key = "interfacename=genInternetSign&sourceid=" + c + "&systemtime=" + e2 + "&msgid=" + d + "&preSign=" + b;
976
+ key = encodeURIComponent(key);
977
+ const signature = md5(key);
978
+ const url = `https://passport.migu.cn/api/genInternetSign?preSign=${preSign}&msgid=${msgId}&systemtime=${time}&sourceid=220029&signature=${signature}`;
979
+ const res = await axios6.get(url);
980
+ const data = res.data;
981
+ if (!data || data.status !== 2e3) return void 0;
982
+ const rsaSign = data.result?.rsaSign || "";
983
+ return rsaSign;
984
+ };
985
+ var getSTToken = async (uniToken) => {
986
+ const $ = {
987
+ "sourceID": "220029",
988
+ "appType": 0,
989
+ "relayState": "",
990
+ "token": uniToken,
991
+ "userInformation": YDRZ.getUserInfo(),
992
+ "isFirst": 1
993
+ };
994
+ const form = URLParams($);
995
+ const res = await axios6.post(
996
+ "https://passport.migu.cn/authn/uniTokenValidate",
997
+ {
998
+ headers: {
999
+ "content-type": "application/x-www-form-urlencoded; charset=UTF-8"
1000
+ }
1001
+ }
1002
+ );
1003
+ if (!res.data) return { error: "fetch uni e" };
1004
+ const json = res.data, status = json.status?.toString() || "", token = json.result?.token || "", msisdn = json.result?.msisdn || "";
1005
+ if (status !== "2000") return { error: "status e" };
1006
+ return { token, msisdn, status };
1007
+ };
1008
+ var authn = async () => {
1009
+ const rsaSign = await genInternetSign();
1010
+ if (!rsaSign) return { error: "genInternetSign failed" };
1011
+ const uniToken = await YDRZ.getTokenInfo({
1012
+ version: "1.2",
1013
+ appId: "300012033963",
1014
+ sign: rsaSign,
1015
+ openType: "1",
1016
+ expandParams: "",
1017
+ isTest: false,
1018
+ getNetworkType: "",
1019
+ getMsisdnMask: ""
1020
+ });
1021
+ if (!uniToken) return { error: "getTokenInfo failed" };
1022
+ const result = await getSTToken(uniToken);
1023
+ if ("error" in result) return result;
1024
+ const { token, msisdn, status } = result;
1025
+ if (!token) return { error: "no token" };
1026
+ if (!msisdn) return { error: "no msisdn" };
1027
+ return { token, msisdn, status };
1028
+ };
1029
+ var loginOneClick = {
1030
+ genInternetSign,
1031
+ getSTToken,
1032
+ authn
1033
+ };
1034
+
1035
+ // src/modules/login_phone.ts
1036
+ import axios7 from "axios";
1037
+ function randomString3() {
1038
+ const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
1039
+ return random.toLowerCase();
1040
+ }
1041
+ var loginPhone = {
1042
+ //获取验证码
1043
+ async getMsgCode(phone) {
1044
+ var $ = {
1045
+ "isAsync": true,
1046
+ "msisdn": "",
1047
+ "captcha": "",
1048
+ "sourceID": "220029",
1049
+ "imgcodeType": "2",
1050
+ "fingerPrint": "",
1051
+ "fingerPrintDetail": "",
1052
+ "_": ""
1053
+ };
1054
+ const result = await getPublicKey();
1055
+ const { publicExponent = "", modulus = "" } = result;
1056
+ var c = new RSAKey();
1057
+ c.setPublic(modulus, publicExponent);
1058
+ $.msisdn = c.encrypt(phone) || "";
1059
+ if (!$.msisdn) return { error: "encrypt error" };
1060
+ const fakeFingerprint = randomString3();
1061
+ $.fingerPrint = fakeFingerprint;
1062
+ $.fingerPrintDetail = fakeFingerprint;
1063
+ $._ = (/* @__PURE__ */ new Date()).getTime().toString();
1064
+ const query = URLParams($);
1065
+ const res = await axios7.get(
1066
+ `https://passport.migu.cn/login/dynamicpassword?${query}`,
1067
+ {
1068
+ headers: {
1069
+ "Host": "passport.migu.cn",
1070
+ "Referer": "https://passport.migu.cn/login",
1071
+ "Origin": "https://passport.migu.cn"
1072
+ }
1073
+ }
1074
+ );
1075
+ const data = res.data;
1076
+ return data;
1077
+ },
1078
+ //登陆
1079
+ async authn(phone, msgCode) {
1080
+ var $ = {
1081
+ "isAsync": true,
1082
+ "msisdn": "",
1083
+ "dynamicPassword": "",
1084
+ "captcha": "",
1085
+ "appType": "",
1086
+ "securityCode": "7619",
1087
+ "sourceID": "220029",
1088
+ "imgcodeType": "2",
1089
+ "fingerPrint": "",
1090
+ "fingerPrintDetail": ""
1091
+ };
1092
+ const result = await getPublicKey();
1093
+ const { publicExponent = "", modulus = "" } = result;
1094
+ var c = new RSAKey();
1095
+ c.setPublic(modulus, publicExponent);
1096
+ $.msisdn = c.encrypt(phone) || "";
1097
+ $.dynamicPassword = c.encrypt(msgCode) || "";
1098
+ if (!$.msisdn || !$.dynamicPassword) return { error: "encrypt error" };
1099
+ const fakeFingerprint = randomString3();
1100
+ $.fingerPrint = fakeFingerprint;
1101
+ $.fingerPrintDetail = fakeFingerprint;
1102
+ const form = URLParams($);
1103
+ const res = await axios7.post(
1104
+ `https://passport.migu.cn/authn/dynamicpassword`,
1105
+ form,
1106
+ {
1107
+ headers: {
1108
+ "Host": "passport.migu.cn",
1109
+ "Content-Type": "application/x-www-form-urlencoded",
1110
+ "Referer": "https://passport.migu.cn/login",
1111
+ "Origin": "https://passport.migu.cn"
1112
+ }
1113
+ }
1114
+ );
1115
+ const data = res.data;
1116
+ return data;
1117
+ }
1118
+ };
1119
+
1120
+ // src/modules/mv_recommend.ts
1121
+ var getMVRecommend = async (mvContentId, page = 1) => {
1122
+ return await h5fetch(`https://c.musicapp.migu.cn/MIGUM3.0/v3.0/content/recommend-mv?resourceId=${mvContentId}&pageNumber=${page}&resourceType=D`);
1123
+ };
1124
+
1125
+ // src/modules/playlist_square_page.ts
1126
+ var getSquarePage = async () => {
1127
+ return await h5fetch(`https://app.c.nf.migu.cn/pc/bmw/page-data/playlist-square-recommend/v1.0?templateVersion=2`);
1128
+ };
1129
+
1130
+ // src/modules/search_lrc.ts
1131
+ var searchLrc = async (text, page = 1) => {
1132
+ return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/lrc/v1.0?pageNo=${page}&text=${text}`);
1133
+ };
1134
+
1135
+ // src/modules/ninan.ts
1136
+ var getNinanSong = async () => await h5fetch(`https://c.musicapp.migu.cn/MIGUM2.0/column/ninan/song-list/v1.0`);
1137
+ var getNinanByDate = async (date) => await h5fetch(`https://c.musicapp.migu.cn/MIGUM2.0/v2.0/content/getNinanByDate.do?columnTitle=${date}`);
1138
+ var signNinan = async (pacmtoken) => {
1139
+ const { data, cookies } = await ckfetch("http://c.musicapp.migu.cn/MIGUM2.0/v2.0/user/sign-reward", {
1140
+ cookie: { pacmtoken },
1141
+ headers: {
1142
+ "location-data": "30.6698676660,104.1229614820",
1143
+ "channel": "0146921"
1144
+ }
1145
+ });
1146
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1147
+ };
1148
+ var getNinanSignInfo = async (pacmtoken) => {
1149
+ const { data, cookies } = await ckfetch("http://u.musicapp.migu.cn/MIGUM3.0/user/sign-center/v1.0", {
1150
+ cookie: { pacmtoken },
1151
+ headers: {
1152
+ "channel": "014021I"
1153
+ }
1154
+ });
1155
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1156
+ };
1157
+
1158
+ // src/modules/recommend_radio_all.ts
1159
+ var getRadioRecommendAll = async (pacmtoken = "") => {
1160
+ const { data, cookies } = await ckfetch(`https://app.c.nf.migu.cn/pc/bmw/page-data/music-radio/v1.0?templateVersion=1`, {
1161
+ cookie: pacmtoken ? { pacmtoken } : void 0
1162
+ });
1163
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1164
+ };
1165
+
1166
+ // src/modules/svideo_info.ts
1167
+ var getSVideoInfo = async (contentIds) => {
1168
+ const contentIdList = contentIds.split(",");
1169
+ contentIdList.map((item) => {
1170
+ return "6000," + item;
1171
+ }).join("|");
1172
+ return await h5fetch(`https://app.c.nf.migu.cn/resource/video-info/by-id/v1.0?requestParams=${contentIdList}`);
1173
+ };
1174
+
1175
+ // src/modules/svideo_search.ts
1176
+ var searchSVideo = async (text, page = 1) => {
1177
+ return await h5fetch(
1178
+ `https://app.c.nf.migu.cn/bmw/hot-search/search/videos/v1.0?pageIndex=${page}&text=${text}`,
1179
+ {
1180
+ headers: {
1181
+ "deviceid": getDeviceId()
1182
+ }
1183
+ }
1184
+ );
1185
+ };
1186
+
1187
+ // src/modules/svideo_searchSuggest.ts
1188
+ var getSVideoSearchSuggest = async (text) => {
1189
+ return await h5fetch(`https://app.c.nf.migu.cn/resource-dataloader/search-suggest/search/v1.0?text=${text}`);
1190
+ };
1191
+
1192
+ // src/modules/svideo_url.ts
1193
+ var getSVideoUrl = async (contentIds, formatType = "HQ") => {
1194
+ contentIds = contentIds.replace(/,/g, "|");
1195
+ return await h5fetch(`https://app.c.nf.migu.cn/strategy/short-video/play/v1.0?contentIds=${contentIds}&formatType=${formatType}`);
1196
+ };
1197
+
1198
+ // src/modules/svideo_userContent.ts
1199
+ var getSVideoUserContent = async (videoUserId, nextPageId = "") => {
1200
+ return await h5fetch(`https://app.c.nf.migu.cn/user/i/user-content-list/v1.0?nextPageId=${nextPageId}&videoUserId=${videoUserId}`);
1201
+ };
1202
+
1203
+ // src/modules/vrbt_opNum.ts
1204
+ var getVrbtOpNum = async (contentIds) => {
1205
+ return await h5fetch(`https://app.c.nf.migu.cn/resource/vrbt/opnum/v1.0?resourceType=M&contentIds=${contentIds}`);
1206
+ };
1207
+
1208
+ // src/modules/vrbt_url.ts
1209
+ var getVrbtUrl = async (contentIds) => {
1210
+ contentIds = contentIds.replace(/,/g, "|");
1211
+ return await h5fetch(
1212
+ `https://app.c.nf.migu.cn/strategy/vrbt/play/v1.0?contentIds=${contentIds}`,
1213
+ {
1214
+ headers: {
1215
+ "channel": "014X031"
1216
+ }
1217
+ }
1218
+ );
1219
+ };
1220
+
1221
+ // src/modules/lyric.ts
1222
+ import axios8 from "axios";
1223
+
1224
+ // src/utils/decryptMrc.ts
1225
+ var DELTA = 2654435769n;
1226
+ var MIN_LENGTH = 32;
1227
+ var SPECIAL_CHAR = 48;
1228
+ function toLong(num) {
1229
+ const MAX = 9223372036854775807n;
1230
+ const MIN = -9223372036854775808n;
1231
+ if (num > MAX) return toLong(num - (1n << 64n));
1232
+ if (num < MIN) return toLong(num + (1n << 64n));
1233
+ return num;
1234
+ }
1235
+ function ToByteArray(data) {
1236
+ const arrayList = [];
1237
+ for (const j2 of data) {
1238
+ const bArrLong2bytes = long2bytes(j2);
1239
+ for (let i = 0; i < 8; i++) {
1240
+ arrayList.push(bArrLong2bytes[i]);
1241
+ }
1242
+ }
1243
+ while (arrayList[arrayList.length - 1] === SPECIAL_CHAR) {
1244
+ arrayList.pop();
1245
+ }
1246
+ return Buffer.from(arrayList);
1247
+ }
1248
+ function long2bytes(num) {
1249
+ const byteBufferOrder = Buffer.alloc(8);
1250
+ byteBufferOrder.writeBigInt64LE(num, 0);
1251
+ return byteBufferOrder;
1252
+ }
1253
+ function PadRight(source, length) {
1254
+ let result = source;
1255
+ while (result.length < length) {
1256
+ result += "0";
1257
+ }
1258
+ return result;
1259
+ }
1260
+ function ToLongArray(data) {
1261
+ const length = Math.floor(data.length / 16);
1262
+ const jArr = new Array(length);
1263
+ for (let i = 0; i < length; i++) {
1264
+ jArr[i] = toLong(BigInt("0x" + data.substring(i * 16, i * 16 + 16)));
1265
+ }
1266
+ return jArr;
1267
+ }
1268
+ function bytes2long(buf, index) {
1269
+ return buf.readBigInt64LE(index);
1270
+ }
1271
+ function ToLongArray2(data_) {
1272
+ const bArr = Buffer.alloc(data_.length * 2);
1273
+ for (let i = 0; i < data_.length; i++) {
1274
+ bArr[i * 2] = data_[i];
1275
+ bArr[i * 2 + 1] = 0;
1276
+ }
1277
+ const length = (bArr.length % 8 === 0 ? 0 : 1) + Math.floor(bArr.length / 8);
1278
+ const jArr = new Array(length);
1279
+ for (let i2 = 0; i2 < length - 1; i2++) {
1280
+ jArr[i2] = bytes2long(bArr, i2 * 8);
1281
+ }
1282
+ const bArr2 = Buffer.alloc(8);
1283
+ let i3 = 0;
1284
+ for (let i4 = (length - 1) * 8; i4 < bArr.length; i4++) {
1285
+ bArr2[i3] = bArr[i4];
1286
+ i3++;
1287
+ }
1288
+ jArr[length - 1] = bytes2long(bArr2, 0);
1289
+ return jArr;
1290
+ }
1291
+ function TEADecrypt(data, key) {
1292
+ const length = data.length;
1293
+ if (length >= 1) {
1294
+ let j3 = data[0];
1295
+ let j4 = toLong(
1296
+ (6n + BigInt(Math.floor(52 / length))) * DELTA
1297
+ );
1298
+ while (true) {
1299
+ const j5 = j4;
1300
+ if (j5 === 0n) {
1301
+ break;
1302
+ }
1303
+ const j6 = toLong(3n & j5 >> 2n);
1304
+ let j7 = length;
1305
+ while (true) {
1306
+ j7--;
1307
+ if (j7 > 0) {
1308
+ const j8 = data[j7 - 1];
1309
+ const i = j7;
1310
+ j3 = toLong(
1311
+ data[i] - toLong(
1312
+ toLong(
1313
+ toLong(j3 ^ j5) + toLong(j8 ^ key[Number(toLong(3n & BigInt(j7) ^ j6))])
1314
+ ) ^ toLong(
1315
+ toLong(
1316
+ toLong(j8 >> 5n) ^ toLong(j3 << 2n)
1317
+ ) + toLong(
1318
+ toLong(j3 >> 3n) ^ toLong(j8 << 4n)
1319
+ )
1320
+ )
1321
+ )
1322
+ );
1323
+ data[i] = j3;
1324
+ } else {
1325
+ break;
1326
+ }
1327
+ }
1328
+ const j9 = data[length - 1];
1329
+ j3 = toLong(
1330
+ data[0] - toLong(
1331
+ toLong(
1332
+ toLong(key[Number(toLong(BigInt(j7) & 3n ^ j6))] ^ j9) + toLong(j3 ^ j5)
1333
+ ) ^ toLong(
1334
+ toLong(
1335
+ toLong(j9 >> 5n) ^ toLong(j3 << 2n)
1336
+ ) + toLong(
1337
+ toLong(j3 >> 3n) ^ toLong(j9 << 4n)
1338
+ )
1339
+ )
1340
+ )
1341
+ );
1342
+ data[0] = j3;
1343
+ j4 = toLong(j5 - DELTA);
1344
+ }
1345
+ }
1346
+ return data;
1347
+ }
1348
+ function decryptMrc(data) {
1349
+ if (data == null || data.length < MIN_LENGTH) return data;
1350
+ const decrypted = TEADecrypt(
1351
+ ToLongArray(data),
1352
+ ToLongArray2(Buffer.from(PadRight("karakal@123Qcomyidongtiantianhaoting", MIN_LENGTH), "utf8"))
1353
+ );
1354
+ return ToByteArray(decrypted).toString("utf16le");
1355
+ }
1356
+ function toWordTime(times) {
1357
+ const type = times.startsWith("(") ? 1 : times.startsWith("[") ? 2 : 0;
1358
+ times = times.replace(/[()\[\]]/g, "").trim();
1359
+ const time = Number(times.split(",")[0]);
1360
+ const mm = Math.floor(time / 6e4).toString().padStart(2, "0");
1361
+ const ss = Math.floor(time / 1e3 % 60).toString().padStart(2, "0");
1362
+ const ms = Math.floor(time % 1e3).toString().padStart(3, "0");
1363
+ if (type === 1) {
1364
+ return `[${mm}:${ss}.${ms}]`;
1365
+ } else {
1366
+ return times;
1367
+ }
1368
+ }
1369
+ function formatMrc(data) {
1370
+ const line = data.split("\n");
1371
+ const formattedData = line.reduce((prev, cur, index) => {
1372
+ cur = cur.trim();
1373
+ if (cur === "") return prev;
1374
+ if (!"1234567890".split("").includes(String(cur[1]))) {
1375
+ prev.push(cur);
1376
+ return prev;
1377
+ }
1378
+ cur = cur.replace(/\[[^\]]*\]/g, "");
1379
+ let nextIndex = 0, partStart = 0;
1380
+ let lineStr = "";
1381
+ while (true) {
1382
+ if (nextIndex === -1) break;
1383
+ const leftPos = cur.indexOf("(", nextIndex);
1384
+ if (leftPos === -1) break;
1385
+ const rightPos = cur.indexOf(")", leftPos);
1386
+ if (rightPos === -1) break;
1387
+ const time = cur.substring(leftPos, rightPos + 1);
1388
+ const word = cur.substring(partStart, leftPos);
1389
+ if (!!word && !!time) {
1390
+ partStart = rightPos + 1;
1391
+ nextIndex = rightPos + 1;
1392
+ } else {
1393
+ break;
1394
+ }
1395
+ lineStr += `${toWordTime(time)}${word}`;
1396
+ }
1397
+ prev.push(lineStr + "\n");
1398
+ return prev;
1399
+ }, []);
1400
+ return formattedData.join("");
1401
+ }
1402
+
1403
+ // src/modules/lyric.ts
1404
+ var getLyric = async (contentId, type = "lrc") => {
1405
+ if (contentId === "") return { error: "contentId is empty!", success: false };
1406
+ const types = type.split(",");
1407
+ if (types.length === 0) return { error: "types is empty!", success: false };
1408
+ const res = await axios8.get(`https://app.u.nf.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?resourceId=${contentId}&resourceType=2`);
1409
+ const code = res.data.code.toString() || "";
1410
+ const data = res.data.resource[0] || {};
1411
+ if (code !== "000000") return {
1412
+ success: false,
1413
+ status: res.status,
1414
+ error: res.data.info || res.data
1415
+ };
1416
+ if (data.length === 0) return { error: "data.length = 0 !", success: false, data };
1417
+ let lrc, lrcUrl, mrc, mrcUrl, trc, trcUrl;
1418
+ if (types.includes("lrc")) {
1419
+ lrcUrl = data.lrcUrl || "";
1420
+ if (lrcUrl !== "") {
1421
+ const lrcRes = await axios8.get(lrcUrl);
1422
+ if (lrcRes.status === 200) {
1423
+ lrc = lrcRes.data || "";
1424
+ }
1425
+ }
1426
+ }
1427
+ if (types.includes("trc")) {
1428
+ trcUrl = data.trcUrl || "";
1429
+ if (trcUrl !== "") {
1430
+ const trcRes = await axios8.get(trcUrl);
1431
+ if (trcRes.status === 200) {
1432
+ trc = trcRes.data || "";
1433
+ }
1434
+ }
1435
+ }
1436
+ if (types.includes("mrc")) {
1437
+ mrcUrl = data.mrcUrl || "";
1438
+ if (mrcUrl !== "") {
1439
+ const mrcRes = await axios8.get(mrcUrl);
1440
+ if (mrcRes.status === 200) {
1441
+ mrc = formatMrc(decryptMrc(mrcRes.data || ""));
1442
+ }
1443
+ }
1444
+ }
1445
+ return {
1446
+ success: true,
1447
+ lrc,
1448
+ lrcUrl,
1449
+ mrc,
1450
+ mrcUrl,
1451
+ trc,
1452
+ trcUrl
1453
+ };
1454
+ };
1455
+
1456
+ // src/modules/user_collect_add.ts
1457
+ var addUserCollect = async (pacmtoken, type, contentId, title, userId) => {
1458
+ let jsonParams = {};
1459
+ if (type === "playlist") {
1460
+ jsonParams = {
1461
+ outOPType: "03",
1462
+ outResourceType: "2021",
1463
+ outResourceId: contentId,
1464
+ outResourceName: encodeURIComponent(title || "")
1465
+ };
1466
+ } else if (type === "comment") {
1467
+ jsonParams = {
1468
+ outOPType: "08",
1469
+ outResourceType: "3002",
1470
+ outOwner: userId,
1471
+ outResourceId: contentId,
1472
+ outResourceName: "%E8%AF%84%E8%AE%BA"
1473
+ //=评论
1474
+ };
1475
+ } else if (type === "album") {
1476
+ jsonParams = {
1477
+ outOPType: "03",
1478
+ outResourceType: "2003",
1479
+ outResourceId: contentId,
1480
+ outResourceName: encodeURIComponent(title || "")
1481
+ };
1482
+ } else {
1483
+ return { success: false, err: "\u672A\u77E5type\u7C7B\u578B -playlist\u6216comment\u6216album" };
1484
+ }
1485
+ const { data, cookies } = await ckfetch(
1486
+ `https://app.u.nf.migu.cn/MIGUM2.0/v1.0/user/add_collection.do`,
1487
+ { params: jsonParams, cookie: { pacmtoken } }
1488
+ );
1489
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1490
+ };
1491
+
1492
+ // src/modules/user_collect_remove.ts
1493
+ var removeUserCollect = async (pacmtoken, type, contentId, userId) => {
1494
+ let jsonParams = {};
1495
+ if (type === "playlist") {
1496
+ jsonParams = {
1497
+ OPType: "03",
1498
+ resourceType: "2021",
1499
+ resourceId: contentId
1500
+ };
1501
+ } else if (type === "comment") {
1502
+ jsonParams = {
1503
+ OPType: "08",
1504
+ resourceType: "3002",
1505
+ outOwner: userId,
1506
+ resourceId: contentId
1507
+ };
1508
+ } else if (type === "album") {
1509
+ jsonParams = {
1510
+ OPType: "03",
1511
+ resourceType: "2003",
1512
+ resourceId: contentId
1513
+ };
1514
+ } else {
1515
+ return { success: false, err: "\u672A\u77E5type\u7C7B\u578B -playlist,comment\u6216album" };
1516
+ }
1517
+ const { data, cookies } = await ckfetch(
1518
+ `https://app.u.nf.migu.cn/MIGUM2.0/v1.0/user/del_collection.do`,
1519
+ { params: jsonParams, cookie: { pacmtoken } }
1520
+ );
1521
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1522
+ };
1523
+
1524
+ // src/modules/user_like.ts
1525
+ var likeSong = async (pacmtoken, contentIds) => {
1526
+ const contentIdsList = contentIds.split(",");
1527
+ const { data, cookies } = await ckfetch(`https://app.c.nf.migu.cn/pc/user/api/add-music-list-song/v1.0`, {
1528
+ method: "POST",
1529
+ cookie: { pacmtoken },
1530
+ body: JSON.stringify({
1531
+ contentIds: contentIdsList
1532
+ }),
1533
+ headers: {
1534
+ "Content-Type": "application/json"
1535
+ }
1536
+ });
1537
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1538
+ };
1539
+
1540
+ // src/modules/user_dislike.ts
1541
+ var dislikeSong = async (pacmtoken, contentId) => {
1542
+ const body = {
1543
+ "channel": "23",
1544
+ "contentId": contentId,
1545
+ "songflag": "2"
1546
+ };
1547
+ const { data, cookies } = await ckfetch(`https://app.c.nf.migu.cn/pc/user/h5-import-musiclist/v1.0`, {
1548
+ method: "POST",
1549
+ cookie: { pacmtoken },
1550
+ body: JSON.stringify(body),
1551
+ headers: {
1552
+ "Content-Type": "application/json"
1553
+ }
1554
+ });
1555
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1556
+ };
1557
+
1558
+ // src/modules/user_myList_edit.ts
1559
+ var editUserMyList = async (pacmtoken, title, playlistId) => {
1560
+ const body = {
1561
+ "title": title,
1562
+ "channel": "23",
1563
+ "id": playlistId,
1564
+ "songflag": "0"
1565
+ };
1566
+ const { data, cookies } = await ckfetch(`https://app.c.nf.migu.cn/pc/user/h5-import-musiclist/v1.0`, {
1567
+ method: "POST",
1568
+ cookie: { pacmtoken },
1569
+ body: JSON.stringify(body),
1570
+ headers: {
1571
+ "Content-Type": "application/json"
1572
+ }
1573
+ });
1574
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1575
+ };
1576
+
1577
+ // src/modules/user_myList_add.ts
1578
+ var addUserMyList = async (pacmtoken, title) => {
1579
+ const body = {
1580
+ "title": title,
1581
+ "channel": "23",
1582
+ "type": "self_build"
1583
+ };
1584
+ const { data, cookies } = await ckfetch(`https://app.c.nf.migu.cn/pc/open/api/music-list/add/v2.0`, {
1585
+ method: "POST",
1586
+ cookie: { pacmtoken },
1587
+ body: JSON.stringify(body),
1588
+ headers: {
1589
+ "Content-Type": "application/json"
1590
+ }
1591
+ });
1592
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1593
+ };
1594
+
1595
+ // src/modules/user_myList_remove.ts
1596
+ var removeUserMyList = async (pacmtoken, playlistId) => {
1597
+ const { data, cookies } = await ckfetch(`https://app.c.nf.migu.cn/pc/v1.0/user/deleteMusicList.do?channel=23&id=${playlistId}`, {
1598
+ cookie: { pacmtoken }
1599
+ });
1600
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1601
+ };
1602
+
1603
+ // src/modules/radio_song.ts
1604
+ var getRadioSong = async (radioId, page = 1) => {
1605
+ return await h5fetch(`https://app.c.nf.migu.cn/pc/column/music-radio/scene/song/v3.0?remain=0&pageNo=${page}&actionId=1&radioId=${radioId}`);
1606
+ };
1607
+
1608
+ // src/modules/column_newCD.ts
1609
+ var getNewCDList = async () => {
1610
+ return await h5fetch(`https://app.c.nf.migu.cn/pc/v1.0/template/get-new-cd-list-header`);
1611
+ };
1612
+
1613
+ // src/modules/column_newSong.ts
1614
+ var getNewSongList = async () => {
1615
+ return await h5fetch(`https://app.c.nf.migu.cn/pc/v1.0/template/get-new-music-list-header`);
1616
+ };
1617
+
1618
+ // src/modules/column_info.ts
1619
+ var getColumnInfo = async (columnId) => {
1620
+ return await h5fetch(`https://app.c.nf.migu.cn/column/column-info/h5/v2.0?columnId=${columnId}`);
1621
+ };
1622
+
1623
+ // src/modules/user_myList_add_song.ts
1624
+ var addSongToMyList = async (pacmtoken, playlistId, contentIds) => {
1625
+ const body = {
1626
+ "id": playlistId,
1627
+ "contentIds": contentIds.split(",")
1628
+ };
1629
+ const { data, cookies } = await ckfetch(`https://app.c.nf.migu.cn/pc/user/api/add-music-list-song/v1.0`, {
1630
+ method: "POST",
1631
+ cookie: { pacmtoken },
1632
+ body: JSON.stringify(body),
1633
+ headers: {
1634
+ "Content-Type": "application/json"
1635
+ }
1636
+ });
1637
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1638
+ };
1639
+
1640
+ // src/modules/user_myList_remove_song.ts
1641
+ var removeSongFromMyList = async (pacmtoken, playlistId, contentId) => {
1642
+ const body = {
1643
+ "channel": "23",
1644
+ "songflag": "2",
1645
+ "contentId": contentId,
1646
+ "id": playlistId
1647
+ };
1648
+ const { data, cookies } = await ckfetch(`https://app.c.nf.migu.cn/pc/user/h5-import-musiclist/v1.0`, {
1649
+ method: "POST",
1650
+ cookie: { pacmtoken },
1651
+ body: JSON.stringify(body),
1652
+ headers: {
1653
+ "Content-Type": "application/json"
1654
+ }
1655
+ });
1656
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1657
+ };
1658
+
1659
+ // src/modules/svideo_userInfo.ts
1660
+ var getSVideoUserInfo = async (type, uid = "", videoUserId = "") => {
1661
+ let url = "https://app.c.nf.migu.cn/resource/video-user";
1662
+ if (type === "uid") {
1663
+ url += `/by-uid/v1.0?uid=${uid}`;
1664
+ } else if (type === "videoUserId") {
1665
+ url += `/by-id/v1.0?videoUserId=${videoUserId}`;
1666
+ } else {
1667
+ return { error: "Invalid parameter type", success: false };
1668
+ }
1669
+ return h5fetch(url);
1670
+ };
1671
+
1672
+ // src/modules/concert_info.ts
1673
+ var getConcertInfo = async (concertId) => {
1674
+ return await h5fetch(`http://c.musicapp.migu.cn/MIGUM2.0/v2.0/content/queryConcertSummary.do?columnId=${concertId}`);
1675
+ };
1676
+
1677
+ // src/modules/concert_url.ts
1678
+ var getConcertUrl = async (concertId, liveId, rateLevel = 1) => {
1679
+ return await h5fetch(
1680
+ `http://c.musicapp.migu.cn/MIGUM2.0/v2.1/danmaku/liveServerHosts.do?concertId=${concertId}&liveId=${liveId}&liveType=1&rateLevel=${rateLevel}`,
1681
+ {
1682
+ headers: {
1683
+ "channel": "0146921"
1684
+ //android client
1685
+ }
1686
+ }
1687
+ );
1688
+ };
1689
+
1690
+ // src/modules/concert_detail.ts
1691
+ var getConcertDetail = async (concertId) => {
1692
+ return await h5fetch(`https://app.c.nf.migu.cn/MIGUM3.0/v1.0/template/concert-detail/release?columnId=${concertId}&templateVersion=10`);
1693
+ };
1694
+
1695
+ // src/modules/concert_comment.ts
1696
+ var getConcertComment = async (concertId, page = 1, size = 20) => {
1697
+ return await h5fetch(`http://b.musicapp.migu.cn/MIGUM2.0/v1.0/danmaku/danmakuHisListPage.do?page=${page}&pageSize=${size}&resourceId=${concertId}`);
1698
+ };
1699
+
1700
+ // src/modules/playlist_match.ts
1701
+ var matchPlaylist = async (url) => {
1702
+ url = encodeURIComponent(url);
1703
+ return await h5fetch(`http://c.musicapp.migu.cn/v1.0/content/get-import-songList?url=${url}`);
1704
+ };
1705
+
1706
+ // src/modules/url_redirect.ts
1707
+ import axios9 from "axios";
1708
+ var getRedirectUrl = async (contentId, toneFlag = "PQ", copyrightId, isVip = true) => {
1709
+ if (isVip && (!copyrightId || copyrightId === "0")) return "";
1710
+ return await axios9.head(
1711
+ isVip ? `https://c.musicapp.migu.cn/strategy/listen-song/v2.3` : `https://app.pd.nf.migu.cn/MIGUM2.0/v1.0/content/sub/listenSong.do`,
1712
+ {
1713
+ maxRedirects: 0,
1714
+ params: {
1715
+ "toneFlag": "PQ",
1716
+ "copyrightId": copyrightId || "0",
1717
+ "contentId": contentId,
1718
+ "resourceType": "2",
1719
+ "channel": "0146921"
1720
+ },
1721
+ headers: { "User-Agent": "okhttp/3.14.9" }
1722
+ // !==null
1723
+ }
1724
+ ).catch((err) => err.response).then((res) => res?.headers?.location?.split("?")[0] ?? "").then((url) => changeQuality(url, toneFlag, "PQ"));
1725
+ };
1726
+
1727
+ // src/modules/concert_mv.ts
1728
+ var getConcertRecommendMv = async (concertId) => {
1729
+ return await h5fetch(`https://app.c.nf.migu.cn/v1.0/liveshow/query-mv-detail?concertId=${concertId}`);
1730
+ };
1731
+
1732
+ // src/modules/mv_song.ts
1733
+ var getMvBySong = async (songId) => {
1734
+ return await h5fetch(
1735
+ `https://app.c.nf.migu.cn/MIGUM2.0/strategy/mv-player/video/v1.0?songId=${songId}`,
1736
+ {
1737
+ headers: {
1738
+ "channel": "0146921"
1739
+ }
1740
+ }
1741
+ );
1742
+ };
1743
+
1744
+ // src/modules/user_isFollow.ts
1745
+ var isFollowAuthor = async (pacmtoken, authorIds, authorType = "singer") => {
1746
+ const authorList = authorIds.split(",");
1747
+ if (authorList.length === 0 || authorType === "" || authorList.length > 100) {
1748
+ return { success: false, data: { error: "\u4F5C\u8005id\u5217\u8868\u4E0D\u80FD\u4E3A\u7A7A\uFF0C\u4E14\u6700\u591A100\u4E2A" }, newPacmToken: "" };
1749
+ }
1750
+ const authors = authorList.map(function(authorId) {
1751
+ return {
1752
+ "authorId": authorId,
1753
+ "authorType": authorType
1754
+ };
1755
+ });
1756
+ const { data, cookies } = await ckfetch(
1757
+ `https://app.u.nf.migu.cn/user/i/social/is-follow-subscribe/v1.0`,
1758
+ {
1759
+ method: "POST",
1760
+ cookie: { pacmtoken },
1761
+ headers: { "Content-Type": "application/json" },
1762
+ body: JSON.stringify({
1763
+ "actionType": 2,
1764
+ authors
1765
+ })
1766
+ }
1767
+ );
1768
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1769
+ };
1770
+
1771
+ // src/modules/playlist_vip.ts
1772
+ var getVipPlaylist = async (size = 10) => {
1773
+ return await h5fetch(`http://app.c.nf.migu.cn/bmw/vip-exclusive/auditions-list/v1.0?pageSize=${size}`);
1774
+ };
1775
+
1776
+ // src/modules/user_header.ts
1777
+ var getUserHeader = async (userId) => {
1778
+ return await h5fetch(
1779
+ `https://app.c.nf.migu.cn/user/api/my-page-header/v1.0`,
1780
+ { params: { userId } }
1781
+ );
1782
+ };
1783
+
1784
+ // src/modules/user_songPage.ts
1785
+ var getUserSongPage = async (userId, videoUserId) => {
1786
+ if (!userId && !videoUserId) {
1787
+ return { data: { error: "userId or videoUserId is required" } };
1788
+ }
1789
+ return await h5fetch(
1790
+ `https://app.c.nf.migu.cn/user/api/my-page-music/v1.0`,
1791
+ {
1792
+ params: { userId, videoUserId },
1793
+ headers: { "channel": "0146931" }
1794
+ }
1795
+ );
1796
+ };
1797
+
1798
+ // src/modules/page_view.ts
1799
+ var getPageInfo = async (pageId, sceneId) => {
1800
+ if (!pageId && !sceneId) {
1801
+ return { success: false, data: { error: "pageId or sceneId is required" } };
1802
+ }
1803
+ if (pageId && sceneId) {
1804
+ return { success: false, data: { error: "choose pageId or sceneId to get page info" } };
1805
+ }
1806
+ const base = "https://app.c.nf.migu.cn/bmw";
1807
+ if (pageId) return await h5fetch(`${base}/page-info/v1.0?pageId=${pageId}`);
1808
+ if (sceneId) return await h5fetch(`${base}/page/view/v1.0?columnId=${sceneId}`);
1809
+ };
1810
+
1811
+ // src/modules/page_tab.ts
1812
+ var getPageTab = async () => {
1813
+ return await h5fetch(`https://app.c.nf.migu.cn/bmw/music/nav-bar/v1.0`);
1814
+ };
1815
+
1816
+ // src/modules/svideo_recommend.ts
1817
+ var getSVideoRecommend = async (pacmtoken) => {
1818
+ const { data, cookies } = await ckfetch("https://app.c.nf.migu.cn/resource-dataloader/recommend-video/v2.0", {
1819
+ method: "GET",
1820
+ cookie: { pacmtoken },
1821
+ params: {
1822
+ currentScreen: 1,
1823
+ scene: "home_selected"
1824
+ },
1825
+ headers: { "Content-Type": "application/json" }
1826
+ });
1827
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1828
+ };
1829
+
1830
+ // src/modules/follow_following_vra.ts
1831
+ var getFollowingVra = async (userId, page = 1) => {
1832
+ return await h5fetch(
1833
+ `https://app.c.nf.migu.cn/bmw/page-data/vrbt/follow-videouserlist/v2.0`,
1834
+ { params: {
1835
+ offset: page - 1,
1836
+ templateVersion: 1,
1837
+ uid: userId
1838
+ } }
1839
+ );
1840
+ };
1841
+
1842
+ // src/modules/follow_follower.ts
1843
+ var getFollowerList = async (params) => {
1844
+ if (params.type === "music") return await h5fetch(
1845
+ `https://app.c.nf.migu.cn/MIGUM2.0/v1.0/user/follower.do`,
1846
+ { params: {
1847
+ pageNo: params.page || 1,
1848
+ pageSize: params.size || 20,
1849
+ userId: params.userId
1850
+ } }
1851
+ );
1852
+ if (params.type === "vrbt") {
1853
+ if (!params.userId && !params.videoUserId) return {
1854
+ success: false,
1855
+ error: "userId or videoUserId is required"
1856
+ };
1857
+ return await h5fetch(
1858
+ `https://app.c.nf.migu.cn/user/i/social/fans-list/v1.0`,
1859
+ { params: {
1860
+ userId: params.userId,
1861
+ videoUserId: params.videoUserId
1862
+ } }
1863
+ );
1864
+ }
1865
+ };
1866
+
1867
+ // src/modules/follow_following.ts
1868
+ var getFollowingList = async (userId, type, page = 1, size = 20) => {
1869
+ if (!userId) return { success: false, error: "userId is required" };
1870
+ if (type !== "user" && type !== "singer") return { success: false, error: "type is invalid" };
1871
+ return await h5fetch(
1872
+ `https://app.c.nf.migu.cn/MIGUM2.0/v1.0/user/followingSingers.do`,
1873
+ { params: {
1874
+ "pageNo": page,
1875
+ "pageSize": size,
1876
+ "userId": userId,
1877
+ "userType": type === "singer" ? "1" : "2"
1878
+ } }
1879
+ );
1880
+ };
1881
+
1882
+ // src/modules/follow_add.ts
1883
+ var addFollower = async (pacmtoken, singerId) => {
1884
+ const { data, cookies } = await ckfetch(
1885
+ `https://app.u.nf.migu.cn/user/social/api/add-follow/v1.0`,
1886
+ {
1887
+ params: {
1888
+ "followId": singerId,
1889
+ "type": "1"
1890
+ },
1891
+ cookie: { pacmtoken }
1892
+ }
1893
+ );
1894
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1895
+ };
1896
+
1897
+ // src/modules/follow_remove.ts
1898
+ var removeFollower = async (pacmtoken, singerId) => {
1899
+ const { data, cookies } = await ckfetch(
1900
+ `https://app.u.nf.migu.cn/user/social/api/delete-follow/v1.0?followId=${singerId}`,
1901
+ { cookie: { pacmtoken } }
1902
+ );
1903
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1904
+ };
1905
+
1906
+ // src/modules/passport_logout.ts
1907
+ var logout = async (pacmtoken) => {
1908
+ const { data } = await ckfetch(`https://c.musicapp.migu.cn/mgateway/api/clearPacMtoken`, {
1909
+ cookie: { pacmtoken }
1910
+ });
1911
+ return data;
1912
+ };
1913
+
1914
+ // src/modules/share_video.ts
1915
+ var shareVideo = async (resourceType, contentId, userId) => {
1916
+ return await h5fetch(
1917
+ `https://app.c.nf.migu.cn/resource/share-info/v2.0`,
1918
+ { params: {
1919
+ "appId": "music",
1920
+ contentId,
1921
+ shareType: resourceType,
1922
+ uid: userId || void 0
1923
+ } }
1924
+ );
1925
+ };
1926
+
1927
+ // src/modules/share_common.ts
1928
+ var shareCommon = async (resourceType, contentId, contentName, targetUserName, copyrightId) => {
1929
+ return await h5fetch(
1930
+ `https://app.c.nf.migu.cn/MIGUM2.0/v1.0/content/shareInfo.do`,
1931
+ { params: {
1932
+ "appId": "music",
1933
+ resourceType,
1934
+ contentId,
1935
+ contentName,
1936
+ targetUserName,
1937
+ copyrightId: copyrightId || void 0,
1938
+ specialType: ["2003", "5"].includes(resourceType) ? "2" : void 0
1939
+ } }
1940
+ );
1941
+ };
1942
+
1943
+ // src/modules/user_audioBook.ts
1944
+ var getUserAudioBook = async (pacmtoken, recentListenNum = 10, recommendNum = 5) => {
1945
+ const { data, cookies } = await ckfetch("https://pd.musicapp.migu.cn/bmw/audio-book/my-audio-book/v1.0", {
1946
+ cookie: { pacmtoken },
1947
+ headers: { "isMock": "00" },
1948
+ params: {
1949
+ "recentListenCount": recentListenNum,
1950
+ "recommendCount": recommendNum
1951
+ }
1952
+ });
1953
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1954
+ };
1955
+
1956
+ // src/modules/user_listenRank.ts
1957
+ var getListenRank = async (pacmtoken, type) => {
1958
+ const { data, cookies } = await ckfetch(`https://app.c.nf.migu.cn/MIGUM3.0/bmw/listen-song/ranking/v1.0`, {
1959
+ method: "POST",
1960
+ cookie: { pacmtoken },
1961
+ body: JSON.stringify({ "type": type === "year" ? 2 : 1 }),
1962
+ headers: { "Content-Type": "application/json" }
1963
+ });
1964
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1965
+ };
1966
+
1967
+ // src/modules/cloud_url.ts
1968
+ var getCloudUrl = async (pacmtoken, contentId, toneFlag = "PQ") => {
1969
+ const { data, cookies } = await ckfetch("https://app.c.nf.migu.cn/MIGUM3.0/strategy/cloud/listen-url/v1.0", {
1970
+ cookie: { pacmtoken },
1971
+ headers: { "channel": "0146931", "version": "7.41.13" },
1972
+ params: {
1973
+ contentId,
1974
+ "formatType": toneFlag,
1975
+ "type": "0"
1976
+ }
1977
+ });
1978
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1979
+ };
1980
+
1981
+ // src/modules/url_dl_v1.ts
1982
+ var getDLUrlV1 = async (songId, toneFlag = "PQ") => {
1983
+ return await h5fetch(
1984
+ `https://app.c.nf.migu.cn/MIGUM2.0/strategy/download-url/by-songid/v1.0`,
1985
+ {
1986
+ headers: { "channel": "0146931", "version": "7.41.13" },
1987
+ params: {
1988
+ "formatType": toneFlag,
1989
+ songId
1990
+ }
1991
+ }
1992
+ );
1993
+ };
1994
+
1995
+ // src/modules/url_m2.ts
1996
+ var getUrlM2 = async (contentId, toneFlag = "PQ", copyrightId, songId, albumId) => {
1997
+ const data = await h5fetch(
1998
+ `https://app.c.nf.migu.cn/MIGUM2.0/v2.1/content/listen-url`,
1999
+ {
2000
+ params: {
2001
+ "netType": "01",
2002
+ "resourceType": "2",
2003
+ contentId,
2004
+ "toneFlag": "PQ",
2005
+ // PQ 默认返回,覆盖处理
2006
+ "copyrightId": copyrightId || void 0,
2007
+ "albumId": albumId || void 0,
2008
+ "songId": songId || void 0
2009
+ },
2010
+ headers: { "channel": "0146832", "version": "7.41.13" }
2011
+ }
2012
+ );
2013
+ if (data?.data?.url === "") {
2014
+ return { success: false, error: "URL \u4E3A\u7A7A" };
2015
+ }
2016
+ data.data.oriUrl = data.data.url || "";
2017
+ data.data.url = changeQuality(data.data.url || "", toneFlag, "PQ", true);
2018
+ if (data?.data?.songItem?.z3dCode) {
2019
+ const a = "ftp://218.200.160.122:21/", b = "https://freetyst.nf.migu.cn/";
2020
+ const z3dCode = data.data.songItem.z3dCode;
2021
+ z3dCode.url = encodeURI(z3dCode?.url?.replace(a, b) || "");
2022
+ z3dCode.iosUrl = encodeURI(z3dCode?.iosUrl?.replace(a, b) || "");
2023
+ z3dCode.androidUrl = encodeURI(z3dCode?.androidUrl?.replace(a, b) || "");
2024
+ z3dCode.h5Url = encodeURI(z3dCode?.h5Url?.replace(a, b) || "");
2025
+ data.data.songItem.z3dCode = z3dCode;
2026
+ }
2027
+ return data;
2028
+ };
2029
+
2030
+ // src/modules/user_emoji_action.ts
2031
+ var emojiAction = async (pacmtoken, contentId, emojiId, action) => {
2032
+ if (action !== "add" && action !== "cancel") {
2033
+ return { data: { success: false, error: "action\u5FC5\u987B\u662Fadd\u6216cancel" }, newPacmToken: "" };
2034
+ }
2035
+ const { data, cookies } = await ckfetch(`https://app.c.nf.migu.cn/user/api/resource-react-emoji/add-cancel/v1.0`, {
2036
+ method: "POST",
2037
+ cookie: { pacmtoken },
2038
+ body: JSON.stringify({
2039
+ "resourceId": contentId,
2040
+ "resourceType": "2",
2041
+ "emojiId": emojiId,
2042
+ "operType": action
2043
+ }),
2044
+ headers: { "Content-Type": "application/json" }
2045
+ });
2046
+ return { data, newPacmToken: cookies.pacmtoken || "" };
2047
+ };
2048
+
2049
+ // src/modules/user_emoji_num.ts
2050
+ var getEmojiNum = async (pacmtoken, contentIds) => {
2051
+ const contentIdList = contentIds.split(",");
2052
+ if (contentIdList.length === 0 || contentIdList.length > 100) {
2053
+ return { data: { success: false, error: "contentIdList\u957F\u5EA6\u5FC5\u987B\u57281-100\u4E4B\u95F4" }, newPacmToken: "" };
2054
+ }
2055
+ const resourceModuleQueryParam = contentIdList.map((id) => ({
2056
+ "emojiNum": 6,
2057
+ "resourceId": id,
2058
+ "resourceType": "2"
2059
+ }));
2060
+ const { data, cookies } = await ckfetch(`https://app.c.nf.migu.cn/user/api/resource-module/query/v1.0`, {
2061
+ method: "POST",
2062
+ cookie: pacmtoken ? { pacmtoken } : void 0,
2063
+ body: JSON.stringify({ resourceModuleQueryParam }),
2064
+ headers: { "Content-Type": "application/json" }
2065
+ });
2066
+ return { data, newPacmToken: pacmtoken ? cookies.pacmtoken || "" : void 0 };
2067
+ };
2068
+
2069
+ // src/modules/user_heartthrob.ts
2070
+ var getUserHeartthrob = async (pacmtoken, songId) => {
2071
+ if (!pacmtoken) return { data: { success: false, code: "290001", info: "\u8BF7\u5148\u767B\u5F55" }, newPacmToken: "" };
2072
+ const { data, cookies } = await ckfetch("https://app.c.nf.migu.cn/MIGUM3.0/resource-dataloader/recommend-song-listen/v1.0", {
2073
+ cookie: { pacmtoken },
2074
+ params: { "songId": songId }
2075
+ });
2076
+ return { data, newPacmToken: cookies.pacmtoken || "" };
2077
+ };
2078
+
2079
+ // src/modules/cloud_delete.ts
2080
+ var deleteCloudMusic = async (pacmtoken, contentIds) => {
2081
+ const contentList = contentIds.split(",");
2082
+ if (contentList.length === 0 || contentList.length > 100) {
2083
+ return { data: { success: false, error: "contentIds is empty or more than 100" }, newPacmToken: void 0 };
2084
+ }
2085
+ const deleteSongInfos = contentList.map((item) => ({
2086
+ "contentId": item,
2087
+ "type": "0"
2088
+ }));
2089
+ const { data, cookies } = await ckfetch("https://app.c.nf.migu.cn/user/cloud/music/local/v1.0", {
2090
+ method: "DELETE",
2091
+ body: JSON.stringify(deleteSongInfos),
2092
+ cookie: { pacmtoken },
2093
+ headers: { "channel": "0146931", "Content-Type": "application/json" }
2094
+ });
2095
+ return { data, newPacmToken: cookies.pacmtoken || "" };
2096
+ };
2097
+
2098
+ // src/modules/user_message_interaction.ts
2099
+ var getInteractionMsg = async (pacmtoken, type, page = 1, size = 10) => {
2100
+ if (!["fans", "collection"].includes(type)) {
2101
+ return { data: { success: false, error: "type must be fans or collection" }, newPacmToken: void 0 };
2102
+ }
2103
+ const { data, cookies } = await ckfetch(`https://app.u.nf.migu.cn/MIGUM2.0/v2.0/user/interaction.do`, {
2104
+ cookie: { pacmtoken },
2105
+ params: { "type": type === "fans" ? 2 : 1, pageNo: page, pageSize: size }
2106
+ });
2107
+ return { data, newPacmToken: cookies.pacmtoken || "" };
2108
+ };
2109
+
2110
+ // src/modules/user_message_notice.ts
2111
+ var getNoticeMsg = async (pacmtoken, page = 1, size = 10) => {
2112
+ const { data, cookies } = await ckfetch(`https://app.u.nf.migu.cn/MIGUM2.0/v1.0/user/notifies.do`, {
2113
+ cookie: { pacmtoken },
2114
+ params: { pageNo: page, pageSize: size }
2115
+ });
2116
+ return { data, newPacmToken: cookies.pacmtoken || "" };
2117
+ };
2118
+
2119
+ // src/modules/user_message_thumbs.ts
2120
+ var getThumbsMsg = async (pacmtoken, page = 1, size = 10) => {
2121
+ const { data, cookies } = await ckfetch(`https://app.u.nf.migu.cn/MIGUM2.0/v1.0/user/thumbsDetail.do`, {
2122
+ cookie: { pacmtoken },
2123
+ params: { pageNo: page, pageSize: size }
2124
+ });
2125
+ return { data, newPacmToken: cookies.pacmtoken || "" };
2126
+ };
2127
+
2128
+ // src/modules/cloud_upload.ts
2129
+ import crypto3 from "crypto";
2130
+ function getExt(file) {
2131
+ const index = file.name.lastIndexOf(".");
2132
+ if (index <= 0) return "";
2133
+ return file.name.substring(index + 1).toLowerCase();
2134
+ }
2135
+ async function getHash(file) {
2136
+ const hash = crypto3.createHash("md5");
2137
+ const reader = file.stream().getReader();
2138
+ while (true) {
2139
+ const { done, value } = await reader.read();
2140
+ if (done) {
2141
+ break;
2142
+ }
2143
+ hash.update(value);
2144
+ }
2145
+ return hash.digest("hex");
2146
+ }
2147
+ var getCloudUploadUrl = async (pacmtoken, file) => {
2148
+ const ext = getExt(file);
2149
+ if (!["mp3", "wav", "flac"].includes(ext)) {
2150
+ return { data: { success: false, error: "file ext is not supported" }, newPacmToken: void 0 };
2151
+ }
2152
+ const hash = await getHash(file), size = file.size;
2153
+ const { data, cookies } = await ckfetch("https://app.c.nf.migu.cn/MIGUM3.0/user/cloud/meta/upload/v1.0", {
2154
+ method: "POST",
2155
+ body: JSON.stringify([{
2156
+ "contentId": hash,
2157
+ "contentName": file.name,
2158
+ "contentSize": size,
2159
+ "needUpload": true
2160
+ }]),
2161
+ cookie: { pacmtoken },
2162
+ headers: { "channel": "0146931", "Content-Type": "application/json" }
2163
+ });
2164
+ return { data, newPacmToken: cookies.pacmtoken || "" };
2165
+ };
2166
+
2167
+ // src/modules/comment_delete.ts
2168
+ var deleteComment = async (pacmtoken, resourceId) => {
2169
+ const { data, cookies } = await ckfetch(
2170
+ `https://app.u.nf.migu.cn/MIGUM2.0/v1.0/user/delComment.do`,
2171
+ {
2172
+ method: "GET",
2173
+ params: { resourceId, hasAudited: "false" },
2174
+ cookie: { pacmtoken },
2175
+ headers: {
2176
+ "channel": "0146891",
2177
+ "Content-Type": "application/json"
2178
+ }
2179
+ }
2180
+ );
2181
+ return { data, newPacmToken: cookies.pacmtoken || "" };
2182
+ };
2183
+
2184
+ // src/modules/singer_letter.ts
2185
+ var getSingerLetter = async (singerId, pageId) => {
2186
+ return await h5fetch(`https://app.c.nf.migu.cn/user/blog/api/love-letter/query/v1.0?resourceId=${singerId}&nextPageId=${pageId}`);
2187
+ };
2188
+
2189
+ // src/modules/singer_mv.ts
2190
+ var getSingerMv = async (singerId, page) => {
2191
+ return await h5fetch(`https://app.c.nf.migu.cn/bmw/singer/video/v1.0?pageNo=${page || 1}&singerId=${singerId}`);
2192
+ };
2193
+
2194
+ // src/modules/ai-bean.ts
2195
+ var signAiBean = async (pacmtoken) => {
2196
+ const { data, cookies } = await ckfetch("https://app.c.nf.migu.cn/act-jbzx/sign", {
2197
+ method: "POST",
2198
+ cookie: { pacmtoken },
2199
+ headers: {
2200
+ "location-data": "30.6698676660,104.1229614820",
2201
+ "channel": "0146921",
2202
+ "activityId": "MAC_KF_CBH_JBZX",
2203
+ "Referer": "https://h5.nf.migu.cn"
2204
+ }
2205
+ });
2206
+ return { data, newPacmToken: cookies.pacmtoken || "" };
2207
+ };
2208
+ var getAiBeanCount = async (pacmtoken) => {
2209
+ const { data, cookies } = await ckfetch("https://app.c.nf.migu.cn/act-jbzx/ai-bean/query-available", {
2210
+ cookie: { pacmtoken },
2211
+ headers: {
2212
+ "activityId": "MAC_KF_CBH_JBZX"
2213
+ }
2214
+ });
2215
+ return { data, newPacmToken: cookies.pacmtoken || "" };
2216
+ };
2217
+ var getAiBeanSignStatus = async (pacmtoken) => {
2218
+ const { data, cookies } = await ckfetch("https://app.c.nf.migu.cn/act-jbzx/sign/status", {
2219
+ cookie: { pacmtoken },
2220
+ headers: {
2221
+ "channel": "0146921",
2222
+ "activityId": "MAC_KF_CBH_JBZX"
2223
+ }
2224
+ });
2225
+ return { data, newPacmToken: cookies.pacmtoken || "" };
2226
+ };
2227
+ var redeemAiBean = async (pacmtoken) => {
2228
+ const { data, cookies } = await ckfetch("https://app.c.nf.m-jbzx/member-jbzx/member/redeem", {
2229
+ method: "POST",
2230
+ cookie: { pacmtoken }
2231
+ });
2232
+ return { data, newPacmToken: cookies.pacmtoken || "" };
2233
+ };
2234
+
2235
+ // src/modules/cloud_dl.ts
2236
+ var getCloudDLUrl = async (pacmtoken, contentId, toneFlag = "PQ") => {
2237
+ const { data, cookies } = await ckfetch("https://app.c.nf.migu.cn/MIGUM3.0/strategy/cloud/download-url/v1.0", {
2238
+ cookie: { pacmtoken },
2239
+ headers: { "channel": "0146931", "version": "7.41.13" },
2240
+ params: {
2241
+ contentId,
2242
+ "formatType": toneFlag,
2243
+ "type": "0"
2244
+ }
2245
+ });
2246
+ return { data, newPacmToken: cookies.pacmtoken || "" };
2247
+ };
2248
+
2249
+ // src/modules/user_phoneInfo.ts
2250
+ var getUserPhoneInfo = async (pacmtoken) => {
2251
+ const { data, cookies } = await ckfetch("https://app.c.nf.migu.cn/MIGUM2.0/v1.0/tone/isrbtuser.do", {
2252
+ cookie: { pacmtoken },
2253
+ headers: {
2254
+ "channel": "0146921",
2255
+ "version": "8.8.0"
2256
+ }
2257
+ });
2258
+ return { data, newPacmToken: cookies.pacmtoken || "" };
2259
+ };
2260
+
2261
+ // src/modules/recommend_listenFreely_tab.ts
2262
+ var getListenFreelyTab = async (pacmtoken = "") => {
2263
+ const { data, cookies } = await ckfetch(`https://app.c.nf.migu.cn/bmw/page/view/listen-freely/v1.0`, {
2264
+ cookie: pacmtoken ? { pacmtoken } : void 0
2265
+ });
2266
+ return { data, newPacmToken: cookies.pacmtoken || void 0 };
2267
+ };
2268
+
2269
+ // src/modules/recommend_listenFreely.ts
2270
+ var getListenFreelySongs = async (pacmtoken, modelId = "701000") => {
2271
+ if (!pacmtoken) return { data: { success: false, code: "290001", info: "\u8BF7\u5148\u767B\u5F55" }, newPacmToken: void 0 };
2272
+ const { data, cookies } = await ckfetch(`http://app.c.nf.migu.cn/resource-dataloader/recommend/listen-freely/v2.0?modelId=${modelId}`, {
2273
+ cookie: { pacmtoken }
2274
+ });
2275
+ return { data, newPacmToken: cookies.pacmtoken || "" };
2276
+ };
2277
+
2278
+ // src/modules/playlist_square_listByTag.ts
2279
+ var getSquareListByTag = async (tagId, page) => {
2280
+ const res = await h5fetch(`http://app.c.nf.migu.cn/MIGUM3.0/v1.0/template/musiclistplaza-listbytag?templateVersion=1&tagId=${tagId}&pageNumber=${page}`);
2281
+ res.data.contentItemList = res?.data?.contentItemList?.itemList?.reduce((acc, item) => {
2282
+ if (!item.actionUrl || !item.actionUrl.includes("song-list-info")) {
2283
+ return acc;
2284
+ }
2285
+ item.playlistId = item.actionUrl.split("id=")[1].split("&")[0] || "";
2286
+ acc.push(item);
2287
+ return acc;
2288
+ }, []) || [];
2289
+ res.data.hasNext = res.data.contentItemList.length < 30 ? false : res?.data?.nextPageUrl !== void 0 && res?.data?.nextPageUrl !== "";
2290
+ return res;
2291
+ };
2292
+
2293
+ // src/modules/playlist_square_recommend.ts
2294
+ var getSquareRecommend = async () => {
2295
+ return await h5fetch(`https://app.c.nf.migu.cn/pc/bmw/playlist-square/recommend-playlist/v1.0?templateVersion=2`);
2296
+ };
2297
+
2298
+ // src/modules/playlist_square_tag.ts
2299
+ var getSquareTag = async (needMoreTag = true) => {
2300
+ const baseTag = await h5fetch(`https://app.c.nf.migu.cn/pc/bmw/playlist-square/tab/v1.0`);
2301
+ if (!needMoreTag) {
2302
+ return baseTag;
2303
+ }
2304
+ const moreTag = await h5fetch(`https://app.c.nf.migu.cn/pc/v1.0/template/musiclistplaza-taglist/release`);
2305
+ baseTag.data.moreTag = moreTag.data.map((item) => {
2306
+ const title = item?.header?.title;
2307
+ const tagList = item?.content.map((it) => ({
2308
+ tagName: it.texts[0],
2309
+ tagId: it.texts[1]
2310
+ }));
2311
+ return { title, tagList };
2312
+ });
2313
+ return baseTag;
2314
+ };
2315
+
2316
+ // src/modules/resourceinfo_song.ts
2317
+ var getSongInfo = async (contentIds) => {
2318
+ contentIds = contentIds.replace(/,/g, "|");
2319
+ return await h5fetch(`https://app.c.nf.migu.cn/resource/song/by-contentids/v2.0?contentId=${contentIds}`);
2320
+ };
2321
+
2322
+ // src/modules/activities.ts
2323
+ var getActivities = async () => {
2324
+ return await h5fetch(`https://app.u.nf.migu.cn/MIGUM3.0/v1.0/template/index-activity/release`);
2325
+ };
2326
+
2327
+ // src/modules/user_ordered.ts
2328
+ var getUserOrdered = async (pacmtoken) => {
2329
+ if (!pacmtoken) return { data: { success: false, code: "290001", info: "\u8BF7\u5148\u767B\u5F55" }, newPacmToken: void 0 };
2330
+ const { data, cookies } = await ckfetch("https://app.c.nf.migu.cn/MIGUM3.0/strategy/song-ordered/v2.0", {
2331
+ cookie: { pacmtoken },
2332
+ headers: { "channel": "014X031" }
2333
+ });
2334
+ return { data, newPacmToken: cookies.pacmtoken || "" };
2335
+ };
2336
+
2337
+ // src/modules/dalbum_info.ts
2338
+ var getDAlbumInfo = async (dAlbumId) => {
2339
+ return await h5fetch(`https://app.c.nf.migu.cn/MIGUM3.0/resource/dalbum/v2.0?dAlbumId=${dAlbumId}`);
2340
+ };
2341
+
2342
+ // src/modules/dalbum_song.ts
2343
+ var getDAlbumSong = async (dAlbumId) => {
2344
+ return await h5fetch(`https://app.c.nf.migu.cn/MIGUM3.0/resource/dalbum/song/v2.0?dAlbumId=${dAlbumId}`);
2345
+ };
2346
+
2347
+ // src/modules/dalbum_pay.ts
2348
+ var getDAlbumPay = async (dAlbumId) => {
2349
+ return await h5fetch(
2350
+ `https://app.c.nf.migu.cn/MIGUM3.0/strategy/album-sub-rank/v1.0?queryType=01&resourceId=${dAlbumId}`,
2351
+ { headers: { "channel": "0146891" } }
2352
+ );
2353
+ };
2354
+ export {
2355
+ YDRZ,
2356
+ addFollower,
2357
+ addSongToMyList,
2358
+ addUserCollect,
2359
+ addUserMyList,
2360
+ checkCanListen,
2361
+ checkToken,
2362
+ deleteCloudMusic,
2363
+ deleteComment,
2364
+ dislikeSong,
2365
+ editUserMyList,
2366
+ emojiAction,
2367
+ getActivities,
2368
+ getAiBeanCount,
2369
+ getAiBeanSignStatus,
2370
+ getAlbumInfo,
2371
+ getAlbumSong,
2372
+ getCloudDLUrl,
2373
+ getCloudUploadUrl,
2374
+ getCloudUrl,
2375
+ getColumnInfo,
2376
+ getComment,
2377
+ getConcertComment,
2378
+ getConcertDetail,
2379
+ getConcertInfo,
2380
+ getConcertRecommendMv,
2381
+ getConcertUrl,
2382
+ getDAlbumInfo,
2383
+ getDAlbumPay,
2384
+ getDAlbumSong,
2385
+ getDLUrlV1,
2386
+ getEmojiNum,
2387
+ getFollowerList,
2388
+ getFollowingList,
2389
+ getFollowingVra,
2390
+ getInteractionMsg,
2391
+ getListenFreelySongs,
2392
+ getListenFreelyTab,
2393
+ getListenRank,
2394
+ getLyric,
2395
+ getMVRecommend,
2396
+ getMvBySong,
2397
+ getMvHls,
2398
+ getMvInfo,
2399
+ getNewCDList,
2400
+ getNewSongList,
2401
+ getNinanByDate,
2402
+ getNinanSignInfo,
2403
+ getNinanSong,
2404
+ getNoticeMsg,
2405
+ getOpNum,
2406
+ getPacmToken,
2407
+ getPageInfo,
2408
+ getPageTab,
2409
+ getPlaylistInfo,
2410
+ getPlaylistSong,
2411
+ getRadioRecommend,
2412
+ getRadioRecommendAll,
2413
+ getRadioSong,
2414
+ getRankIndex,
2415
+ getRankInfo,
2416
+ getRecommendPlaylist,
2417
+ getRedirectUrl,
2418
+ getResourceInfo,
2419
+ getSVideoInfo,
2420
+ getSVideoRecommend,
2421
+ getSVideoSearchSuggest,
2422
+ getSVideoUrl,
2423
+ getSVideoUserContent,
2424
+ getSVideoUserInfo,
2425
+ getSceneRecommend,
2426
+ getSearchDefault,
2427
+ getSearchHot,
2428
+ getSearchSingerTab,
2429
+ getSearchSingerTabList,
2430
+ getSimilarSongRecommend,
2431
+ getSingerAlbum,
2432
+ getSingerIndex,
2433
+ getSingerLetter,
2434
+ getSingerMv,
2435
+ getSingerSimilar,
2436
+ getSingerSong,
2437
+ getSongInfo,
2438
+ getSquareListByTag,
2439
+ getSquarePage,
2440
+ getSquareRecommend,
2441
+ getSquareTag,
2442
+ getThumbsMsg,
2443
+ getTicketInfo,
2444
+ getTodayRecommend,
2445
+ getUrlH5V24,
2446
+ getUrlM2,
2447
+ getUrlV1,
2448
+ getUrlV2,
2449
+ getUserAudioBook,
2450
+ getUserBadge,
2451
+ getUserCollectList,
2452
+ getUserHeader,
2453
+ getUserHeartthrob,
2454
+ getUserHomePage,
2455
+ getUserMyList,
2456
+ getUserOrdered,
2457
+ getUserPhoneInfo,
2458
+ getUserSongPage,
2459
+ getVersion,
2460
+ getVipPlaylist,
2461
+ getVrbtOpNum,
2462
+ getVrbtUrl,
2463
+ isFollowAuthor,
2464
+ likeSong,
2465
+ loginNP,
2466
+ loginOneClick,
2467
+ loginPhone,
2468
+ loginSim,
2469
+ logout,
2470
+ matchPlaylist,
2471
+ queryUserInfo,
2472
+ redeemAiBean,
2473
+ removeFollower,
2474
+ removeSongFromMyList,
2475
+ removeUserCollect,
2476
+ removeUserMyList,
2477
+ searchAlbum,
2478
+ searchConcert,
2479
+ searchLrc,
2480
+ searchMv,
2481
+ searchPlaylist,
2482
+ searchRbt,
2483
+ searchSVideo,
2484
+ searchSinger,
2485
+ searchSong,
2486
+ searchSuggest,
2487
+ searchTicket,
2488
+ shareCommon,
2489
+ shareVideo,
2490
+ signAiBean,
2491
+ signNinan
2492
+ };
2493
+ //# sourceMappingURL=index.js.map