migu-api-enhanced 2.14.0 → 2.19.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.
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ var __export = (target, all) => {
8
8
  var modules_exports = {};
9
9
  __export(modules_exports, {
10
10
  YDRZ: () => YDRZ,
11
+ addFollower: () => addFollower,
11
12
  addSongToMyList: () => addSongToMyList,
12
13
  addUserCollect: () => addUserCollect,
13
14
  addUserMyList: () => addUserMyList,
@@ -17,6 +18,7 @@ __export(modules_exports, {
17
18
  editUserMyList: () => editUserMyList,
18
19
  getAlbumInfo: () => getAlbumInfo,
19
20
  getAlbumSong: () => getAlbumSong,
21
+ getCloudUrl: () => getCloudUrl,
20
22
  getColumnInfo: () => getColumnInfo,
21
23
  getComment: () => getComment,
22
24
  getConcertComment: () => getConcertComment,
@@ -24,6 +26,11 @@ __export(modules_exports, {
24
26
  getConcertInfo: () => getConcertInfo,
25
27
  getConcertRecommendMv: () => getConcertRecommendMv,
26
28
  getConcertUrl: () => getConcertUrl,
29
+ getDLUrlV1: () => getDLUrlV1,
30
+ getFollowerList: () => getFollowerList,
31
+ getFollowingList: () => getFollowingList,
32
+ getFollowingVra: () => getFollowingVra,
33
+ getListenRank: () => getListenRank,
27
34
  getLyric: () => getLyric,
28
35
  getMVRecommend: () => getMVRecommend,
29
36
  getMvBySong: () => getMvBySong,
@@ -36,6 +43,8 @@ __export(modules_exports, {
36
43
  getNinanSong: () => getNinanSong,
37
44
  getOpNum: () => getOpNum,
38
45
  getPacmToken: () => getPacmToken,
46
+ getPageInfo: () => getPageInfo,
47
+ getPageTab: () => getPageTab,
39
48
  getPlaylistInfo: () => getPlaylistInfo,
40
49
  getPlaylistSong: () => getPlaylistSong,
41
50
  getPlaylistSquarePage: () => getPlaylistSquarePage,
@@ -48,6 +57,7 @@ __export(modules_exports, {
48
57
  getRedirectUrl: () => getRedirectUrl,
49
58
  getResourceInfo: () => getResourceInfo,
50
59
  getSVideoInfo: () => getSVideoInfo,
60
+ getSVideoRecommend: () => getSVideoRecommend,
51
61
  getSVideoSearchSuggest: () => getSVideoSearchSuggest,
52
62
  getSVideoUrl: () => getSVideoUrl,
53
63
  getSVideoUserContent: () => getSVideoUserContent,
@@ -65,12 +75,16 @@ __export(modules_exports, {
65
75
  getTicketInfo: () => getTicketInfo,
66
76
  getTodayRecommend: () => getTodayRecommend,
67
77
  getUrlH5V24: () => getUrlH5V24,
78
+ getUrlM2: () => getUrlM2,
68
79
  getUrlV1: () => getUrlV1,
69
80
  getUrlV2: () => getUrlV2,
81
+ getUserAudioBook: () => getUserAudioBook,
70
82
  getUserBadge: () => getUserBadge,
71
83
  getUserCollectList: () => getUserCollectList,
84
+ getUserHeader: () => getUserHeader,
72
85
  getUserHomePage: () => getUserHomePage,
73
86
  getUserMyList: () => getUserMyList,
87
+ getUserSongPage: () => getUserSongPage,
74
88
  getVersion: () => getVersion,
75
89
  getVipPlaylist: () => getVipPlaylist,
76
90
  getVrbtOpNum: () => getVrbtOpNum,
@@ -81,8 +95,10 @@ __export(modules_exports, {
81
95
  loginOneClick: () => loginOneClick,
82
96
  loginPhone: () => loginPhone,
83
97
  loginSim: () => loginSim,
98
+ logout: () => logout,
84
99
  matchPlaylist: () => matchPlaylist,
85
100
  queryUserInfo: () => queryUserInfo,
101
+ removeFollower: () => removeFollower,
86
102
  removeSongFromMyList: () => removeSongFromMyList,
87
103
  removeUserCollect: () => removeUserCollect,
88
104
  removeUserMyList: () => removeUserMyList,
@@ -96,6 +112,8 @@ __export(modules_exports, {
96
112
  searchSong: () => searchSong,
97
113
  searchSuggest: () => searchSuggest,
98
114
  searchTicket: () => searchTicket,
115
+ shareCommon: () => shareCommon,
116
+ shareVideo: () => shareVideo,
99
117
  signNinan: () => signNinan
100
118
  });
101
119
 
@@ -301,16 +319,16 @@ var getRecommendPlaylist = async () => {
301
319
 
302
320
  // src/utils/deviceID.ts
303
321
  function getDeviceId(a, b) {
304
- var c, d = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""), e = [];
322
+ var c, d = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""), e2 = [];
305
323
  if (b = b || d.length, a)
306
324
  for (c = 0; a > c; c++)
307
- e[c] = d[0 | Math.random() * b];
325
+ e2[c] = d[0 | Math.random() * b];
308
326
  else {
309
327
  var f;
310
- for (e[8] = e[13] = e[18] = e[23] = "-", e[14] = "4", c = 0; 36 > c; c++)
311
- e[c] || (f = 0 | 16 * Math.random(), e[c] = d[19 == c ? 3 & f | 8 : f]);
328
+ for (e2[8] = e2[13] = e2[18] = e2[23] = "-", e2[14] = "4", c = 0; 36 > c; c++)
329
+ e2[c] || (f = 0 | 16 * Math.random(), e2[c] = d[19 == c ? 3 & f | 8 : f]);
312
330
  }
313
- return e.join("");
331
+ return e2.join("");
314
332
  }
315
333
 
316
334
  // src/modules/recommend_song.ts
@@ -430,20 +448,20 @@ var SECURE = "Jk8qzuePiJ1qE3mDYhLQ3T73DtDoAhLP";
430
448
  var aw = 171;
431
449
  var iw = 205;
432
450
  var ow = 1;
433
- function textEncode(e) {
434
- return new TextEncoder().encode(e);
451
+ function textEncode(e2) {
452
+ return new TextEncoder().encode(e2);
435
453
  }
436
- function textDecode(e) {
437
- return new TextDecoder("utf-8").decode(e);
454
+ function textDecode(e2) {
455
+ return new TextDecoder("utf-8").decode(e2);
438
456
  }
439
- function decryptBlob(e, r) {
457
+ function decryptBlob(e2, r) {
440
458
  if (r.length == 0)
441
459
  return null;
442
- var n = e.length;
443
- if (n < 4 || !(e[0] == aw && e[1] == iw) || e[2] != ow)
460
+ var n = e2.length;
461
+ if (n < 4 || !(e2[0] == aw && e2[1] == iw) || e2[2] != ow)
444
462
  return null;
445
- for (var t = e[3], a = textEncode(r), i = a.length, o = new Uint8Array(n - 4), s = 0, c = 4; c < n; c++, s++)
446
- o[s] = e[c] + t - a[s % i];
463
+ for (var t = e2[3], a = textEncode(r), i = a.length, o = new Uint8Array(n - 4), s = 0, c = 4; c < n; c++, s++)
464
+ o[s] = e2[c] + t - a[s % i];
447
465
  return o;
448
466
  }
449
467
  function decryptData(buf) {
@@ -451,7 +469,7 @@ function decryptData(buf) {
451
469
  try {
452
470
  const data = p ? JSON.parse(p) : null;
453
471
  return data;
454
- } catch (e) {
472
+ } catch (e2) {
455
473
  return null;
456
474
  }
457
475
  ;
@@ -459,6 +477,63 @@ function decryptData(buf) {
459
477
 
460
478
  // src/modules/url_h5v2.4.ts
461
479
  import axios3 from "axios";
480
+
481
+ // src/utils/quality.ts
482
+ var qualityList = [
483
+ "PQ",
484
+ "HQ",
485
+ "SQ",
486
+ "ZQ24",
487
+ "ZQ32",
488
+ "Z3D"
489
+ ];
490
+ var e = encodeURI;
491
+ var toneUrl = {
492
+ "PQ": e("\u6807\u6E05\u9AD8\u6E05/MP3_128_16_Stero"),
493
+ "HQ": e("\u6807\u6E05\u9AD8\u6E05/MP3_320_16_Stero"),
494
+ "SQ": e("\u6B4C\u66F2\u4E0B\u8F7D/flac"),
495
+ "ZQ24": e("\u6B4C\u66F2\u4E0B\u8F7D/flac_24bit"),
496
+ "ZQ32": e("\u6B4C\u66F2\u4E0B\u8F7D/wav_32bit"),
497
+ "Z3D": e("\u6B4C\u66F2\u4E0B\u8F7D/wav_3d")
498
+ };
499
+ var toneUrlList = Object.entries(toneUrl);
500
+ var toneFormat = {
501
+ "PQ": ".mp3",
502
+ "HQ": ".mp3",
503
+ "SQ": ".flac",
504
+ "ZQ24": ".flac",
505
+ "ZQ32": ".wav",
506
+ "Z3D": ".wav"
507
+ };
508
+ function isQuality(quality) {
509
+ return qualityList.includes(quality);
510
+ }
511
+ function getQuality(url) {
512
+ let tone = "";
513
+ if (!tone) {
514
+ for (let i = 0; i < toneUrlList.length; i++) {
515
+ const [key, value] = toneUrlList[i];
516
+ if (url.includes(value)) {
517
+ tone = key;
518
+ break;
519
+ }
520
+ }
521
+ }
522
+ return tone;
523
+ }
524
+ function changeQuality(url, quality, originalQuality, splitQuery = true) {
525
+ const originalTone = isQuality(originalQuality) ? originalQuality : getQuality(url);
526
+ if (splitQuery) {
527
+ url = url.split("?")[0];
528
+ }
529
+ if (!isQuality(quality) || !isQuality(originalTone)) {
530
+ return url;
531
+ } else {
532
+ return url.replace(toneUrl[originalTone], toneUrl[quality]).replace(toneFormat[originalTone], toneFormat[quality]);
533
+ }
534
+ }
535
+
536
+ // src/modules/url_h5v2.4.ts
462
537
  var getUrlH5V24 = async (contentId, copyrightId, toneFlag = "PQ") => {
463
538
  const headers = {
464
539
  "birth": "h5page",
@@ -468,17 +543,22 @@ var getUrlH5V24 = async (contentId, copyrightId, toneFlag = "PQ") => {
468
543
  "location-info": ""
469
544
  };
470
545
  const res = await axios3.get(
471
- `https://c.musicapp.migu.cn/strategy/listen-url/h5/v2.4?contentId=${contentId}&copyrightId=${copyrightId}&resourceType=2&netType=01&toneFlag=${toneFlag}&scene=&lowerQualityContentId=${contentId}`,
546
+ `https://c.musicapp.migu.cn/strategy/listen-url/h5/v2.4?contentId=${contentId}&copyrightId=${copyrightId}&resourceType=2&netType=01&toneFlag=PQ&scene=&lowerQualityContentId=${contentId}`,
472
547
  {
473
548
  headers,
474
549
  responseType: "arraybuffer"
475
550
  }
476
551
  );
477
- return await decryptData2(res.data);
552
+ const data = await decryptData2(res.data);
553
+ if (data?.data?.url === "") {
554
+ return { success: false, error: "URL \u4E3A\u7A7A" };
555
+ }
556
+ data.data.url = changeQuality(data.data.url || "", toneFlag, "PQ", true);
557
+ return data;
478
558
  };
479
559
  var SECURE2 = ["Jk8qzuePiJ1qE3mDYhLQ3T73DtDoAhLP"];
480
- function strToUtf8Bytes(e) {
481
- return new TextEncoder().encode(e);
560
+ function strToUtf8Bytes(e2) {
561
+ return new TextEncoder().encode(e2);
482
562
  }
483
563
  function utf8Bytes2str(bytes) {
484
564
  const result = [];
@@ -492,18 +572,18 @@ function utf8Bytes2str(bytes) {
492
572
  }
493
573
  return decodeURIComponent(result.join(""));
494
574
  }
495
- function decode(e, t) {
575
+ function decode(e2, t) {
496
576
  if (0 == t.length)
497
577
  return null;
498
- var n = e.length;
578
+ var n = e2.length;
499
579
  if (n < 4)
500
580
  return null;
501
- if (171 != e[0] || 205 != e[1])
581
+ if (171 != e2[0] || 205 != e2[1])
502
582
  return null;
503
- if (1 != e[2])
583
+ if (1 != e2[2])
504
584
  return null;
505
- for (var r = e[3], o = strToUtf8Bytes(t), a = o.length, i = new Uint8Array(n - 4), s = 0, c = 4; c < n; c++, s++)
506
- i[s] = e[c] + r - o[s % a];
585
+ for (var r = e2[3], o = strToUtf8Bytes(t), a = o.length, i = new Uint8Array(n - 4), s = 0, c = 4; c < n; c++, s++)
586
+ i[s] = e2[c] + r - o[s % a];
507
587
  return i;
508
588
  }
509
589
  var decryptData2 = (ab) => {
@@ -702,8 +782,8 @@ var getPacmToken = async (token = "", type = "2", sourceId = "220029", activityI
702
782
  };
703
783
 
704
784
  // src/modules/ticket.ts
705
- var getTicketInfo = async (page = 1, pageCount = 20) => {
706
- return await h5fetch(`https://app.c.nf.migu.cn/MIGUM3.0/v1.0/ticket/home/ticket?pageNum=${page}&pageCount=${pageCount}`);
785
+ var getTicketInfo = async (page = 1, size = 20) => {
786
+ return await h5fetch(`https://app.c.nf.migu.cn/MIGUM3.0/v1.0/ticket/home/ticket?pageNum=${page}&pageCount=${size}`);
707
787
  };
708
788
 
709
789
  // src/modules/user_badge.ts
@@ -993,9 +1073,9 @@ function md5(s) {
993
1073
  return crypto2.createHash("md5").update(s, "utf-8").digest("hex");
994
1074
  }
995
1075
  var genInternetSign = async () => {
996
- const time = yTime(), e = time, c = "220029", msgId = getDeviceId(), d = msgId;
1076
+ const time = yTime(), e2 = time, c = "220029", msgId = getDeviceId(), d = msgId;
997
1077
  const preSign = YDRZ.getSign("300012033963", "1.2"), b = preSign;
998
- let key = "interfacename=genInternetSign&sourceid=" + c + "&systemtime=" + e + "&msgid=" + d + "&preSign=" + b;
1078
+ let key = "interfacename=genInternetSign&sourceid=" + c + "&systemtime=" + e2 + "&msgid=" + d + "&preSign=" + b;
999
1079
  key = encodeURIComponent(key);
1000
1080
  const signature = md5(key);
1001
1081
  const url = `https://passport.migu.cn/api/genInternetSign?preSign=${preSign}&msgid=${msgId}&systemtime=${time}&sourceid=220029&signature=${signature}`;
@@ -1259,19 +1339,70 @@ var getLyric = async (contentId) => {
1259
1339
  };
1260
1340
 
1261
1341
  // src/modules/user_collect_add.ts
1262
- var addUserCollect = async (pacmtoken, playlistId, title) => {
1263
- title = encodeURIComponent(title);
1264
- const { data, cookies } = await ckfetch(`https://app.c.nf.migu.cn/pc/v1.0/user/add_collection.do?outOPType=03&outResourceName=${title}&outResourceType=2021&outResourceId=${playlistId}`, {
1265
- cookie: { pacmtoken }
1266
- });
1342
+ var addUserCollect = async (pacmtoken, type, contentId, title, userId) => {
1343
+ let jsonParams = {};
1344
+ if (type === "playlist") {
1345
+ jsonParams = {
1346
+ outOPType: "03",
1347
+ outResourceType: "2021",
1348
+ outResourceId: contentId,
1349
+ outResourceName: encodeURIComponent(title || "")
1350
+ };
1351
+ } else if (type === "comment") {
1352
+ jsonParams = {
1353
+ outOPType: "08",
1354
+ outResourceType: "3002",
1355
+ outOwner: userId,
1356
+ outResourceId: contentId,
1357
+ outResourceName: "%E8%AF%84%E8%AE%BA"
1358
+ //=评论
1359
+ };
1360
+ } else if (type === "album") {
1361
+ jsonParams = {
1362
+ outOPType: "03",
1363
+ outResourceType: "2003",
1364
+ outResourceId: contentId,
1365
+ outResourceName: encodeURIComponent(title || "")
1366
+ };
1367
+ } else {
1368
+ return { success: false, err: "\u672A\u77E5type\u7C7B\u578B -playlist\u6216comment\u6216album" };
1369
+ }
1370
+ const { data, cookies } = await ckfetch(
1371
+ `https://app.u.nf.migu.cn/MIGUM2.0/v1.0/user/add_collection.do`,
1372
+ { params: jsonParams, cookie: { pacmtoken } }
1373
+ );
1267
1374
  return { data, newPacmToken: cookies.pacmtoken || "" };
1268
1375
  };
1269
1376
 
1270
1377
  // src/modules/user_collect_remove.ts
1271
- var removeUserCollect = async (pacmtoken, playlistId) => {
1272
- const { data, cookies } = await ckfetch(`https://app.c.nf.migu.cn/pc/v1.0/user/del_collection.do?oPType=03&resourceType=2021&resourceId=${playlistId}`, {
1273
- cookie: { pacmtoken }
1274
- });
1378
+ var removeUserCollect = async (pacmtoken, type, contentId, userId) => {
1379
+ let jsonParams = {};
1380
+ if (type === "playlist") {
1381
+ jsonParams = {
1382
+ OPType: "03",
1383
+ resourceType: "2021",
1384
+ resourceId: contentId
1385
+ };
1386
+ } else if (type === "comment") {
1387
+ jsonParams = {
1388
+ OPType: "08",
1389
+ resourceType: "3002",
1390
+ outOwner: userId,
1391
+ resourceId: contentId
1392
+ };
1393
+ } else if (type === "album") {
1394
+ jsonParams = {
1395
+ OPType: "03",
1396
+ resourceType: "2003",
1397
+ resourceId: contentId
1398
+ };
1399
+ } else {
1400
+ return { success: false, err: "\u672A\u77E5type\u7C7B\u578B -playlist,comment\u6216album" };
1401
+ }
1402
+ const { data, cookies } = await ckfetch(
1403
+ `https://app.u.nf.migu.cn/MIGUM2.0/v1.0/user/del_collection.do`,
1404
+ { params: jsonParams, cookie: { pacmtoken } }
1405
+ );
1275
1406
  return { data, newPacmToken: cookies.pacmtoken || "" };
1276
1407
  };
1277
1408
 
@@ -1500,14 +1631,14 @@ var getRedirectUrl = async (contentId, toneFlag = "PQ") => {
1500
1631
  {
1501
1632
  maxRedirects: 0,
1502
1633
  params: {
1503
- "toneFlag": toneFlag,
1634
+ "toneFlag": "PQ",
1504
1635
  "copyrightId": "0",
1505
1636
  "contentId": contentId,
1506
1637
  "resourceType": "2",
1507
1638
  "channel": "0"
1508
1639
  }
1509
1640
  }
1510
- ).catch((err) => err.response).then((res) => res?.headers?.location?.split("?")[0] ?? "");
1641
+ ).catch((err) => err.response).then((res) => res?.headers?.location?.split("?")[0] ?? "").then((url) => changeQuality(url, toneFlag, "PQ"));
1511
1642
  };
1512
1643
 
1513
1644
  // src/modules/concert_mv.ts
@@ -1559,15 +1690,294 @@ var getVipPlaylist = async (size = 10) => {
1559
1690
  return await h5fetch(`http://app.c.nf.migu.cn/bmw/vip-exclusive/auditions-list/v1.0?pageSize=${size}`);
1560
1691
  };
1561
1692
 
1693
+ // src/modules/user_header.ts
1694
+ var getUserHeader = async (userId) => {
1695
+ return await h5fetch(
1696
+ `https://app.c.nf.migu.cn/user/api/my-page-header/v1.0`,
1697
+ { params: { userId } }
1698
+ );
1699
+ };
1700
+
1701
+ // src/modules/user_songPage.ts
1702
+ var getUserSongPage = async (userId, videoUserId) => {
1703
+ if (!userId && !videoUserId) {
1704
+ return { data: { error: "userId or videoUserId is required" } };
1705
+ }
1706
+ return await h5fetch(
1707
+ `https://app.c.nf.migu.cn/user/api/my-page-music/v1.0`,
1708
+ {
1709
+ params: { userId, videoUserId },
1710
+ headers: { "channel": "0146931" }
1711
+ }
1712
+ );
1713
+ };
1714
+
1715
+ // src/modules/page_view.ts
1716
+ var getPageInfo = async (pageId, sceneId) => {
1717
+ if (!pageId && !sceneId) {
1718
+ return { success: false, data: { error: "pageId or sceneId is required" } };
1719
+ }
1720
+ if (pageId && sceneId) {
1721
+ return { success: false, data: { error: "choose pageId or sceneId to get page info" } };
1722
+ }
1723
+ const base = "https://app.c.nf.migu.cn/bmw";
1724
+ if (pageId) return await h5fetch(`${base}/page-info/v1.0?pageId=${pageId}`);
1725
+ if (sceneId) return await h5fetch(`${base}/page/view/v1.0?columnId=${sceneId}`);
1726
+ };
1727
+
1728
+ // src/modules/page_tab.ts
1729
+ var getPageTab = async () => {
1730
+ return await h5fetch(`https://app.c.nf.migu.cn/bmw/music/nav-bar/v1.0`);
1731
+ };
1732
+
1733
+ // src/modules/svideo_recommend.ts
1734
+ var getSVideoRecommend = async (pacmtoken) => {
1735
+ const { data, cookies } = await ckfetch("https://app.c.nf.migu.cn/resource-dataloader/recommend-video/v2.0", {
1736
+ method: "GET",
1737
+ cookie: { pacmtoken },
1738
+ params: {
1739
+ currentScreen: 1,
1740
+ scene: "home_selected"
1741
+ },
1742
+ headers: { "Content-Type": "application/json" }
1743
+ });
1744
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1745
+ };
1746
+
1747
+ // src/modules/follow_following_vra.ts
1748
+ var getFollowingVra = async (userId, page = 1) => {
1749
+ return await h5fetch(
1750
+ `https://app.c.nf.migu.cn/bmw/page-data/vrbt/follow-videouserlist/v2.0`,
1751
+ { params: {
1752
+ offset: page - 1,
1753
+ templateVersion: 1,
1754
+ uid: userId
1755
+ } }
1756
+ );
1757
+ };
1758
+
1759
+ // src/modules/follow_follower.ts
1760
+ var getFollowerList = async (params) => {
1761
+ if (params.type === "music") return await h5fetch(
1762
+ `https://app.c.nf.migu.cn/MIGUM2.0/v1.0/user/follower.do`,
1763
+ { params: {
1764
+ pageNo: params.page || 1,
1765
+ pageSize: params.size || 20,
1766
+ userId: params.userId
1767
+ } }
1768
+ );
1769
+ if (params.type === "vrbt") {
1770
+ if (!params.userId && !params.videoUserId) return {
1771
+ success: false,
1772
+ error: "userId or videoUserId is required"
1773
+ };
1774
+ return await h5fetch(
1775
+ `https://app.c.nf.migu.cn/user/i/social/fans-list/v1.0`,
1776
+ { params: {
1777
+ userId: params.userId,
1778
+ videoUserId: params.videoUserId
1779
+ } }
1780
+ );
1781
+ }
1782
+ };
1783
+
1784
+ // src/modules/follow_following.ts
1785
+ var getFollowingList = async (userId, type, page = 1, size = 20) => {
1786
+ if (!userId) return { success: false, error: "userId is required" };
1787
+ if (type !== "user" && type !== "singer") return { success: false, error: "type is invalid" };
1788
+ return await h5fetch(
1789
+ `https://app.c.nf.migu.cn/MIGUM2.0/v1.0/user/followingSingers.do`,
1790
+ { params: {
1791
+ "pageNo": page,
1792
+ "pageSize": size,
1793
+ "userId": userId,
1794
+ "userType": type === "singer" ? "1" : "2"
1795
+ } }
1796
+ );
1797
+ };
1798
+
1799
+ // src/modules/follow_add.ts
1800
+ var addFollower = async (pacmtoken, singerId) => {
1801
+ const { data, cookies } = await ckfetch(
1802
+ `https://app.u.nf.migu.cn/user/social/api/add-follow/v1.0`,
1803
+ {
1804
+ params: {
1805
+ "followId": singerId,
1806
+ "type": "1"
1807
+ },
1808
+ cookie: { pacmtoken }
1809
+ }
1810
+ );
1811
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1812
+ };
1813
+
1814
+ // src/modules/follow_remove.ts
1815
+ var removeFollower = async (pacmtoken, singerId) => {
1816
+ const { data, cookies } = await ckfetch(
1817
+ `https://app.u.nf.migu.cn/user/social/api/delete-follow/v1.0?followId=${singerId}`,
1818
+ { cookie: { pacmtoken } }
1819
+ );
1820
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1821
+ };
1822
+
1823
+ // src/modules/passport_logout.ts
1824
+ var logout = async (pacmtoken) => {
1825
+ const { data } = await ckfetch(`https://c.musicapp.migu.cn/mgateway/api/clearPacMtoken`, {
1826
+ cookie: { pacmtoken }
1827
+ });
1828
+ return data;
1829
+ };
1830
+
1831
+ // src/modules/share_video.ts
1832
+ var shareVideo = async (resourceType, contentId, userId) => {
1833
+ return await h5fetch(
1834
+ `https://app.c.nf.migu.cn/resource/share-info/v2.0`,
1835
+ { params: {
1836
+ "appId": "music",
1837
+ contentId,
1838
+ shareType: resourceType,
1839
+ uid: userId || void 0
1840
+ } }
1841
+ );
1842
+ };
1843
+
1844
+ // src/modules/share_common.ts
1845
+ var shareCommon = async (resourceType, contentId, contentName, targetUserName, copyrightId) => {
1846
+ return await h5fetch(
1847
+ `https://app.c.nf.migu.cn/MIGUM2.0/v1.0/content/shareInfo.do`,
1848
+ { params: {
1849
+ "appId": "music",
1850
+ resourceType,
1851
+ contentId,
1852
+ contentName,
1853
+ targetUserName,
1854
+ copyrightId: copyrightId || void 0,
1855
+ specialType: resourceType === "2003" ? "2" : void 0
1856
+ } }
1857
+ );
1858
+ };
1859
+
1860
+ // src/modules/user_audioBook.ts
1861
+ var getUserAudioBook = async (pacmtoken, recentListenNum = 10, recommendNum = 5) => {
1862
+ const { data, cookies } = await ckfetch("https://pd.musicapp.migu.cn/bmw/audio-book/my-audio-book/v1.0", {
1863
+ cookie: { pacmtoken },
1864
+ headers: { "isMock": "00" },
1865
+ params: {
1866
+ "recentListenCount": recentListenNum,
1867
+ "recommendCount": recommendNum
1868
+ }
1869
+ });
1870
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1871
+ };
1872
+
1873
+ // src/modules/user_listenRank.ts
1874
+ var getListenRank = async (pacmtoken, type) => {
1875
+ const { data, cookies } = await ckfetch(`https://app.c.nf.migu.cn//MIGUM3.0/bmw/listen-song/ranking/v1.0`, {
1876
+ method: "POST",
1877
+ cookie: { pacmtoken },
1878
+ body: JSON.stringify({ "type": type === "year" ? 2 : 1 }),
1879
+ headers: { "Content-Type": "application/json" }
1880
+ });
1881
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1882
+ };
1883
+
1884
+ // src/modules/cloud_url.ts
1885
+ var getCloudUrl = async (pacmtoken, contentId, toneFlag = "PQ") => {
1886
+ const { data, cookies } = await ckfetch("https://app.c.nf.migu.cn/MIGUM3.0/strategy/cloud/listen-url/v1.0", {
1887
+ cookie: { pacmtoken },
1888
+ headers: { "channel": "0146931", "version": "7.41.13" },
1889
+ params: {
1890
+ contentId,
1891
+ "formatType": toneFlag,
1892
+ "type": "0"
1893
+ }
1894
+ });
1895
+ return { data, newPacmToken: cookies.pacmtoken || "" };
1896
+ };
1897
+
1898
+ // src/modules/url_dl_v1.ts
1899
+ var getDLUrlV1 = async (songId, toneFlag = "PQ") => {
1900
+ return await h5fetch(
1901
+ `https://app.c.nf.migu.cn/MIGUM2.0/strategy/download-url/by-songid/v1.0`,
1902
+ {
1903
+ headers: { "channel": "0146931", "version": "7.41.13" },
1904
+ params: {
1905
+ "formatType": toneFlag,
1906
+ songId
1907
+ }
1908
+ }
1909
+ );
1910
+ };
1911
+
1912
+ // src/modules/url_m2.ts
1913
+ var getUrlM2 = async (contentId, toneFlag = "PQ", copyrightId, songId, albumId) => {
1914
+ const data = await h5fetch(
1915
+ `https://app.c.nf.migu.cn/MIGUM2.0/v2.1/content/listen-url`,
1916
+ {
1917
+ params: {
1918
+ "netType": "01",
1919
+ "resourceType": "2",
1920
+ contentId,
1921
+ "toneFlag": "PQ",
1922
+ // PQ 默认返回,覆盖处理
1923
+ "copyrightId": copyrightId || void 0,
1924
+ "albumId": albumId || void 0,
1925
+ "songId": songId || void 0
1926
+ },
1927
+ headers: { "channel": "0146832", "version": "7.41.13" }
1928
+ }
1929
+ );
1930
+ if (data?.data?.url === "") {
1931
+ return { success: false, error: "URL \u4E3A\u7A7A" };
1932
+ }
1933
+ data.data.url = changeQuality(data.data.url || "", toneFlag, "PQ", true);
1934
+ return data;
1935
+ };
1936
+
1562
1937
  // src/utils/index.ts
1563
1938
  var utils_exports = {};
1564
1939
  __export(utils_exports, {
1565
1940
  RSAKey: () => RSAKey,
1566
1941
  URLParams: () => URLParams,
1942
+ changeQuality: () => changeQuality,
1567
1943
  getDeviceId: () => getDeviceId,
1568
- getPublicKey: () => getPublicKey
1944
+ getPublicKey: () => getPublicKey,
1945
+ getQuality: () => getQuality,
1946
+ getResourceId: () => getResourceId,
1947
+ isQuality: () => isQuality,
1948
+ qualityList: () => qualityList,
1949
+ toneFormat: () => toneFormat,
1950
+ toneUrl: () => toneUrl
1569
1951
  });
1570
1952
 
1953
+ // src/utils/resourceType.ts
1954
+ var getResourceId = (name) => {
1955
+ name = name.toLowerCase().trim();
1956
+ switch (name) {
1957
+ case "song":
1958
+ return "2";
1959
+ case "album":
1960
+ return "2003";
1961
+ case "singer":
1962
+ case "artist":
1963
+ return "2002";
1964
+ case "playlist":
1965
+ return "2021";
1966
+ case "radio":
1967
+ return "2016";
1968
+ case "comment":
1969
+ return "3002";
1970
+ case "svideo":
1971
+ return "6000";
1972
+ case "mv":
1973
+ return "D";
1974
+ case "vrbt":
1975
+ return "M";
1976
+ default:
1977
+ return "";
1978
+ }
1979
+ };
1980
+
1571
1981
  // src/index.ts
1572
1982
  function createClient() {
1573
1983
  return modules_exports;
@@ -1577,9 +1987,11 @@ export {
1577
1987
  RSAKey,
1578
1988
  URLParams,
1579
1989
  YDRZ,
1990
+ addFollower,
1580
1991
  addSongToMyList,
1581
1992
  addUserCollect,
1582
1993
  addUserMyList,
1994
+ changeQuality,
1583
1995
  checkCanListen,
1584
1996
  checkToken,
1585
1997
  createClient,
@@ -1587,6 +1999,7 @@ export {
1587
1999
  editUserMyList,
1588
2000
  getAlbumInfo,
1589
2001
  getAlbumSong,
2002
+ getCloudUrl,
1590
2003
  getColumnInfo,
1591
2004
  getComment,
1592
2005
  getConcertComment,
@@ -1594,7 +2007,12 @@ export {
1594
2007
  getConcertInfo,
1595
2008
  getConcertRecommendMv,
1596
2009
  getConcertUrl,
2010
+ getDLUrlV1,
1597
2011
  getDeviceId,
2012
+ getFollowerList,
2013
+ getFollowingList,
2014
+ getFollowingVra,
2015
+ getListenRank,
1598
2016
  getLyric,
1599
2017
  getMVRecommend,
1600
2018
  getMvBySong,
@@ -1607,10 +2025,13 @@ export {
1607
2025
  getNinanSong,
1608
2026
  getOpNum,
1609
2027
  getPacmToken,
2028
+ getPageInfo,
2029
+ getPageTab,
1610
2030
  getPlaylistInfo,
1611
2031
  getPlaylistSong,
1612
2032
  getPlaylistSquarePage,
1613
2033
  getPublicKey,
2034
+ getQuality,
1614
2035
  getRadioRecommend,
1615
2036
  getRadioRecommendAll,
1616
2037
  getRadioSong,
@@ -1618,8 +2039,10 @@ export {
1618
2039
  getRankInfo,
1619
2040
  getRecommendPlaylist,
1620
2041
  getRedirectUrl,
2042
+ getResourceId,
1621
2043
  getResourceInfo,
1622
2044
  getSVideoInfo,
2045
+ getSVideoRecommend,
1623
2046
  getSVideoSearchSuggest,
1624
2047
  getSVideoUrl,
1625
2048
  getSVideoUserContent,
@@ -1637,25 +2060,33 @@ export {
1637
2060
  getTicketInfo,
1638
2061
  getTodayRecommend,
1639
2062
  getUrlH5V24,
2063
+ getUrlM2,
1640
2064
  getUrlV1,
1641
2065
  getUrlV2,
2066
+ getUserAudioBook,
1642
2067
  getUserBadge,
1643
2068
  getUserCollectList,
2069
+ getUserHeader,
1644
2070
  getUserHomePage,
1645
2071
  getUserMyList,
2072
+ getUserSongPage,
1646
2073
  getVersion,
1647
2074
  getVipPlaylist,
1648
2075
  getVrbtOpNum,
1649
2076
  getVrbtUrl,
1650
2077
  isFollowAuthor,
2078
+ isQuality,
1651
2079
  likeSong,
1652
2080
  loginNP,
1653
2081
  loginOneClick,
1654
2082
  loginPhone,
1655
2083
  loginSim,
2084
+ logout,
1656
2085
  matchPlaylist,
1657
2086
  modules_exports as modules,
2087
+ qualityList,
1658
2088
  queryUserInfo,
2089
+ removeFollower,
1659
2090
  removeSongFromMyList,
1660
2091
  removeUserCollect,
1661
2092
  removeUserMyList,
@@ -1669,6 +2100,10 @@ export {
1669
2100
  searchSong,
1670
2101
  searchSuggest,
1671
2102
  searchTicket,
1672
- signNinan
2103
+ shareCommon,
2104
+ shareVideo,
2105
+ signNinan,
2106
+ toneFormat,
2107
+ toneUrl
1673
2108
  };
1674
2109
  //# sourceMappingURL=index.js.map