migu-api-enhanced 1.2.3 → 1.2.5

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.cjs CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ YDRZ: () => YDRZ,
33
34
  checkCanListen: () => checkCanListen,
34
35
  checkToken: () => checkToken,
35
36
  createClient: () => createClient,
@@ -52,8 +53,10 @@ __export(index_exports, {
52
53
  getSearchHot: () => getSearchHot,
53
54
  getSearchSingerTab: () => getSearchSingerTab,
54
55
  getSearchSingerTabList: () => getSearchSingerTabList,
56
+ getSimilarSongRecommend: () => getSimilarSongRecommend,
55
57
  getSingerAlbum: () => getSingerAlbum,
56
58
  getSingerIndex: () => getSingerIndex,
59
+ getSingerSimilar: () => getSingerSimilar,
57
60
  getSingerSong: () => getSingerSong,
58
61
  getTicketInfo: () => getTicketInfo,
59
62
  getTodayRecommend: () => getTodayRecommend,
@@ -61,9 +64,13 @@ __export(index_exports, {
61
64
  getUrlV1: () => getUrlV1,
62
65
  getUrlV2: () => getUrlV2,
63
66
  getUserBadge: () => getUserBadge,
67
+ getUserCollect: () => getUserCollect,
64
68
  getUserHomePage: () => getUserHomePage,
69
+ getUserMyList: () => getUserMyList,
65
70
  getVersion: () => getVersion,
66
71
  loginNP: () => loginNP,
72
+ loginOneClick: () => loginOneClick,
73
+ loginSim: () => loginSim,
67
74
  modules: () => modules_exports,
68
75
  queryUserInfo: () => queryUserInfo,
69
76
  searchAlbum: () => searchAlbum,
@@ -80,6 +87,7 @@ module.exports = __toCommonJS(index_exports);
80
87
  // src/modules/index.ts
81
88
  var modules_exports = {};
82
89
  __export(modules_exports, {
90
+ YDRZ: () => YDRZ,
83
91
  checkCanListen: () => checkCanListen,
84
92
  checkToken: () => checkToken,
85
93
  getAlbumInfo: () => getAlbumInfo,
@@ -101,8 +109,10 @@ __export(modules_exports, {
101
109
  getSearchHot: () => getSearchHot,
102
110
  getSearchSingerTab: () => getSearchSingerTab,
103
111
  getSearchSingerTabList: () => getSearchSingerTabList,
112
+ getSimilarSongRecommend: () => getSimilarSongRecommend,
104
113
  getSingerAlbum: () => getSingerAlbum,
105
114
  getSingerIndex: () => getSingerIndex,
115
+ getSingerSimilar: () => getSingerSimilar,
106
116
  getSingerSong: () => getSingerSong,
107
117
  getTicketInfo: () => getTicketInfo,
108
118
  getTodayRecommend: () => getTodayRecommend,
@@ -110,9 +120,13 @@ __export(modules_exports, {
110
120
  getUrlV1: () => getUrlV1,
111
121
  getUrlV2: () => getUrlV2,
112
122
  getUserBadge: () => getUserBadge,
123
+ getUserCollect: () => getUserCollect,
113
124
  getUserHomePage: () => getUserHomePage,
125
+ getUserMyList: () => getUserMyList,
114
126
  getVersion: () => getVersion,
115
127
  loginNP: () => loginNP,
128
+ loginOneClick: () => loginOneClick,
129
+ loginSim: () => loginSim,
116
130
  queryUserInfo: () => queryUserInfo,
117
131
  searchAlbum: () => searchAlbum,
118
132
  searchConcert: () => searchConcert,
@@ -257,10 +271,17 @@ var getRecommendPlaylist = async () => {
257
271
  };
258
272
 
259
273
  // src/utils/deviceID.ts
260
- function getDeviceId() {
261
- const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
262
- const a = `${random.substring(0, 8)}-${random.substring(8, 12)}-${random.substring(12, 16)}-${random.substring(16, 20)}-${random.substring(20)}`;
263
- return a.toUpperCase();
274
+ function getDeviceId(a, b) {
275
+ var c, d = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""), e = [];
276
+ if (b = b || d.length, a)
277
+ for (c = 0; a > c; c++)
278
+ e[c] = d[0 | Math.random() * b];
279
+ else {
280
+ var f;
281
+ for (e[8] = e[13] = e[18] = e[23] = "-", e[14] = "4", c = 0; 36 > c; c++)
282
+ e[c] || (f = 0 | 16 * Math.random(), e[c] = d[19 == c ? 3 & f | 8 : f]);
283
+ }
284
+ return e.join("");
264
285
  }
265
286
 
266
287
  // src/modules/recommend_song.ts
@@ -366,7 +387,9 @@ var getUrlV2 = async (contentId, copyrightId, resourceType = "2", pacmtoken = ""
366
387
  "timestamp": timestamp.toString(),
367
388
  "Content-Type": "application/json;charset=UTF-8",
368
389
  "referer": "https://music.migu.cn/",
369
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Edg/148.0.0.0"
390
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Edg/148.0.0.0",
391
+ "location-data": "30.6698676660,104.1229614820",
392
+ "location-info": ""
370
393
  };
371
394
  const res = await fetch(
372
395
  `https://app.c.nf.migu.cn/strategy/pc/listen/v2.0?contentId=${contentId}&copyrightId=${copyrightId}&scene=&netType=01&resourceType=${resourceType}&toneFlag=PQ`,
@@ -418,7 +441,9 @@ var getUrlH5V24 = async (contentId, copyrightId, resourceType = "2") => {
418
441
  const headers = {
419
442
  "birth": "h5page",
420
443
  "channel": "014X031",
421
- "Referer": "https://y.migu.cn/"
444
+ "Referer": "https://y.migu.cn/",
445
+ "location-data": "30.6698676660,104.1229614820",
446
+ "location-info": ""
422
447
  };
423
448
  const res = await fetch(
424
449
  `https://c.musicapp.migu.cn/strategy/listen-url/h5/v2.4?contentId=${contentId}&copyrightId=${copyrightId}&resourceType=${resourceType}&netType=01&toneFlag=PQ&scene=&lowerQualityContentId=${contentId}`,
@@ -492,35 +517,12 @@ var getVersion = async (channel = "0146921", version = "8.4.0", ua = "Android_mi
492
517
  };
493
518
 
494
519
  // src/modules/mv_info.ts
495
- var getMvInfo = async (mvIds, {
496
- needAbsoluteUrl = false
497
- }) => {
498
- const res = await h5fetch(`https://c.musicapp.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?resourceId=${mvIds}&resourceType=D&needSimple=01`);
499
- if (!res) return { error: "\u8BF7\u6C42\u5931\u8D25" };
500
- if (res.error) return { error: res.error };
501
- const resource = res.resource || [];
502
- if (resource.length === 0) return { error: "resource\u4E0D\u5B58\u5728" };
503
- if (needAbsoluteUrl) {
504
- resource.forEach((item) => {
505
- if (!item.rateFormats) return;
506
- item.rateFormats.forEach((rateFormat) => {
507
- if (!rateFormat.url) return;
508
- if (!rateFormat.url.startsWith("http") && !rateFormat.url.startsWith("https")) {
509
- if (rateFormat.url[0] === "/" && rateFormat.url[1] !== "/") {
510
- rateFormat.absoluteUrl = `https://freevod.nf.migu.cn${rateFormat.url}`;
511
- }
512
- }
513
- });
514
- });
515
- res.resource = resource;
516
- return res;
517
- }
518
- return res;
520
+ var getMvInfo = async (mvIds) => {
521
+ return h5fetch(`https://c.musicapp.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?resourceId=${mvIds}&resourceType=D&needSimple=01`);
519
522
  };
520
523
 
521
524
  // src/modules/mv_hls.ts
522
525
  var getMvHls = async (mvContentId, mvCopyrightId, url, size, format = "050012", needHttps = true) => {
523
- size = size.toString();
524
526
  url = encodeURIComponent(url);
525
527
  return await h5fetch(
526
528
  `https://c.musicapp.migu.cn/MIGUM2.0/v1.0/content/mvplayinfo.do?format=${format}&mvContentId=${mvContentId}&mvCopyrightId=${mvCopyrightId}&needHttps=${needHttps}&size=${size}&url=${url}`,
@@ -981,6 +983,15 @@ var getPublicKey = async () => {
981
983
  return { publicExponent, modulus };
982
984
  };
983
985
 
986
+ // src/utils/URLParams.ts
987
+ function URLParams($) {
988
+ const form = new URLSearchParams();
989
+ for (const [key, value] of Object.entries($)) {
990
+ form.append(key, String(value));
991
+ }
992
+ return form.toString();
993
+ }
994
+
984
995
  // src/modules/login_np.ts
985
996
  var RSAKey = rsalib_default.RSAKey;
986
997
  function randomString() {
@@ -988,8 +999,13 @@ function randomString() {
988
999
  return random.toLowerCase();
989
1000
  }
990
1001
  var loginNP = {
1002
+ /**
1003
+ * 账号密码登录
1004
+ * @param username 用户名
1005
+ * @param password 密码
1006
+ * @returns 登录成功后的 pacmtoken
1007
+ */
991
1008
  async authn(username, password) {
992
- var error = "";
993
1009
  var $ = {
994
1010
  "isAsync": true,
995
1011
  "enpassword": "",
@@ -1005,8 +1021,7 @@ var loginNP = {
1005
1021
  const p = await getPublicKey();
1006
1022
  const { publicExponent, modulus } = p || {};
1007
1023
  if (!modulus || !publicExponent) {
1008
- error = "\u83B7\u53D6\u516C\u94A5\u5931\u8D25";
1009
- return { error };
1024
+ return { error: "\u83B7\u53D6\u516C\u94A5\u5931\u8D25" };
1010
1025
  }
1011
1026
  var rsa2 = new RSAKey();
1012
1027
  rsa2.setPublic(modulus, publicExponent);
@@ -1017,10 +1032,7 @@ var loginNP = {
1017
1032
  $.fingerPrintDetail = fakeFingerprint;
1018
1033
  $.enpassword = rsa_pwd;
1019
1034
  $.loginID = rsa_username;
1020
- const form = new URLSearchParams();
1021
- for (const [key, value] of Object.entries($)) {
1022
- form.append(key, String(value));
1023
- }
1035
+ const form = URLParams($);
1024
1036
  const res = await fetch(
1025
1037
  `https://passport.migu.cn/authn`,
1026
1038
  {
@@ -1031,7 +1043,7 @@ var loginNP = {
1031
1043
  body: form
1032
1044
  }
1033
1045
  );
1034
- if (!res.ok) return { error: ["\u8BF7\u6C42\u767B\u5F55\u5931\u8D25"] };
1046
+ if (!res.ok) return { error: "\u8BF7\u6C42\u767B\u5F55\u5931\u8D25" };
1035
1047
  const body = await res.json();
1036
1048
  return body;
1037
1049
  }
@@ -1174,12 +1186,340 @@ var getTodayRecommend = async (pacmtoken) => {
1174
1186
  return { data, pacmtoken: newPacmToken };
1175
1187
  };
1176
1188
 
1189
+ // src/modules/login_sim.ts
1190
+ var RSAKey2 = rsalib_default.RSAKey;
1191
+ function randomString2() {
1192
+ const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
1193
+ return random.toLowerCase();
1194
+ }
1195
+ var loginSim = {
1196
+ async simSend(phone) {
1197
+ var $;
1198
+ $ = {
1199
+ "isAsync": true,
1200
+ "sim": "1",
1201
+ "encMsisdn": "",
1202
+ "appType": "0",
1203
+ "relayState": "",
1204
+ "sourceID": "220029",
1205
+ "fingerPrint": "",
1206
+ "fingerPrintDetail": ""
1207
+ };
1208
+ const p = await getPublicKey();
1209
+ const { publicExponent, modulus } = p || {};
1210
+ if (!modulus || !publicExponent) {
1211
+ return { error: "\u83B7\u53D6\u516C\u94A5\u5931\u8D25" };
1212
+ }
1213
+ const rsa2 = new RSAKey2();
1214
+ rsa2.setPublic(modulus, publicExponent);
1215
+ const encPhone = rsa2.encrypt(phone);
1216
+ const fakeFingerprint = randomString2();
1217
+ $.fingerPrint = fakeFingerprint;
1218
+ $.fingerPrintDetail = fakeFingerprint;
1219
+ $.encMsisdn = encPhone;
1220
+ const form = URLParams($);
1221
+ const send = await fetch(
1222
+ `https://passport.migu.cn/api/simauth/send`,
1223
+ {
1224
+ method: "POST",
1225
+ headers: {
1226
+ //'User-Agent': ua,
1227
+ "Host": "passport.migu.cn"
1228
+ },
1229
+ body: form
1230
+ }
1231
+ );
1232
+ if (!send.ok) return { error: "simauth f:net error" };
1233
+ const sendbody = await send.json();
1234
+ if (!sendbody && sendbody.status != "2000") {
1235
+ return { error: sendbody };
1236
+ }
1237
+ const sim_sessionid = sendbody.result.sim_sessionid || "";
1238
+ if (!sim_sessionid) return { error: "sim_sessionid e" };
1239
+ return { sim_sessionid };
1240
+ },
1241
+ async simQuery(sim_sessionid) {
1242
+ var $;
1243
+ $ = {
1244
+ "isAsync": true,
1245
+ "sim_sessionid": sim_sessionid,
1246
+ "sourceID": "220029"
1247
+ };
1248
+ const form = new URLSearchParams();
1249
+ for (const [key, value] of Object.entries($)) {
1250
+ form.append(key, String(value));
1251
+ }
1252
+ const query = await fetch(
1253
+ `https://passport.migu.cn/api/simauth/query`,
1254
+ {
1255
+ method: "POST",
1256
+ headers: { "Host": "passport.migu.cn" },
1257
+ body: form
1258
+ }
1259
+ );
1260
+ if (!query.ok) return { error: "simauth e" };
1261
+ const querybody = await query.json();
1262
+ if (querybody.status == "4071") {
1263
+ return { error: "waiting", body: querybody };
1264
+ } else if (querybody.status == "2000") {
1265
+ const token = querybody?.result?.token || "";
1266
+ const status = querybody?.status || "";
1267
+ return { token, status };
1268
+ } else {
1269
+ return { error: querybody.status, body: querybody };
1270
+ }
1271
+ }
1272
+ };
1273
+
1274
+ // src/modules/user_collect.ts
1275
+ var getUserCollect = async (pacmtoken, page = 1, size = 20) => {
1276
+ const res = await fetch(
1277
+ `https://app.c.nf.migu.cn/user/h5/user/collection/v1.0?pageNo=${page}&type=1&OPType=03&pageSize=${size}&resourceType=2021`,
1278
+ {
1279
+ method: "GET",
1280
+ headers: {
1281
+ "Cookie": `pacmtoken=${pacmtoken}`
1282
+ }
1283
+ }
1284
+ );
1285
+ const newPacmToken = getSetCookieValue(res.headers, "pacmtoken");
1286
+ const data = await res.json();
1287
+ return { data, pacmtoken: newPacmToken };
1288
+ };
1289
+
1290
+ // src/modules/user_myList.ts
1291
+ var getUserMyList = async (pacmtoken, queryType = 0, page = 1, size = 20) => {
1292
+ const res = await fetch(
1293
+ `https://app.c.nf.migu.cn/user/h5/my-music-list/v1.0?queryType=${queryType}&pageNo=${page}&pageSize=${size}`,
1294
+ {
1295
+ method: "GET",
1296
+ headers: {
1297
+ "Cookie": `pacmtoken=${pacmtoken}`
1298
+ }
1299
+ }
1300
+ );
1301
+ const newPacmToken = getSetCookieValue(res.headers, "pacmtoken");
1302
+ const data = await res.json();
1303
+ return { data, pacmtoken: newPacmToken };
1304
+ };
1305
+
1306
+ // src/modules/singer_similar.ts
1307
+ var getSingerSimilar = async (singerId) => {
1308
+ return await h5fetch(`https://app.c.nf.migu.cn/bmw/recommend-singer/similar/v1.0?singerId=${singerId}`);
1309
+ };
1310
+
1311
+ // src/modules/recommend_similarSong.ts
1312
+ var getSimilarSongRecommend = async (contentId = "") => {
1313
+ return await h5fetch(
1314
+ `https://app.c.nf.migu.cn/bmw/recommend-song/similar/v1.0?contentId=${contentId}`,
1315
+ {
1316
+ method: "GET",
1317
+ headers: {
1318
+ "deviceId": getDeviceId(),
1319
+ "recommendstatus": "1"
1320
+ }
1321
+ }
1322
+ );
1323
+ };
1324
+
1325
+ // src/modules/login_oneclick.ts
1326
+ var import_crypto2 = __toESM(require("crypto"), 1);
1327
+ var nav = {
1328
+ "platform": "iPhone",
1329
+ "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",
1330
+ "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",
1331
+ "cookieEnabled": true,
1332
+ "empty": null,
1333
+ "hardwareConcurrency": 6,
1334
+ "language": "zh-CN",
1335
+ "plugins": "",
1336
+ "availWidth": 390,
1337
+ "availHeight": 844,
1338
+ "colorDepth": 24,
1339
+ "timezoneOffset": -480
1340
+ };
1341
+ var YDRZ = {
1342
+ "optparams": {
1343
+ "uuid": "",
1344
+ "msgId": "",
1345
+ "traceId": "",
1346
+ "businessType": "10",
1347
+ "appId": "",
1348
+ "timestamp": yTime(),
1349
+ "isimge": false,
1350
+ "expandParams": "",
1351
+ "userInformations": "",
1352
+ "CMRequestApi": ""
1353
+ },
1354
+ randomString(len, range = 32) {
1355
+ var i, bite = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""), list = [];
1356
+ for (i = 0; i < len; i++)
1357
+ list[i] = bite[0 | Math.random() * range];
1358
+ return list.join("");
1359
+ },
1360
+ randomRange(min, max) {
1361
+ return Math.floor(Math.random() * (min - max) + max);
1362
+ },
1363
+ getUA() {
1364
+ const ua = nav.userAgent, l = [
1365
+ nav.platform,
1366
+ ua,
1367
+ nav.appVersion,
1368
+ nav.cookieEnabled,
1369
+ void 0,
1370
+ nav.hardwareConcurrency,
1371
+ nav.language,
1372
+ nav.plugins,
1373
+ nav.availWidth,
1374
+ nav.availHeight,
1375
+ nav.colorDepth,
1376
+ nav.timezoneOffset
1377
+ ], key = l.join("@@"), finalUA = ua.length > 100 ? ua.substring(0, 100) : ua;
1378
+ return nav.platform + "@@" + finalUA + "@@" + md5(key);
1379
+ },
1380
+ uaE(str) {
1381
+ var b, c, d, r4, r1, r2, r3, result = "", bite = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", i = 0;
1382
+ for (; i < str.length; )
1383
+ 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);
1384
+ return result;
1385
+ },
1386
+ getUserInfo() {
1387
+ return encodeURIComponent(this.uaE(this.getUA()));
1388
+ },
1389
+ getSign(appID, version) {
1390
+ const optparams = this.optparams;
1391
+ optparams.uuid = this.randomString(32, 32);
1392
+ optparams.msgId = this.randomString(32, 32);
1393
+ this.optparams = optparams;
1394
+ return appID + optparams.msgId + optparams.timestamp + optparams.uuid + version;
1395
+ },
1396
+ async getTokenInfo(data) {
1397
+ const optparams = this.optparams;
1398
+ const requestData = {
1399
+ "version": data.version,
1400
+ "appId": data.appId,
1401
+ "openType": data.openType,
1402
+ "expandParams": data.expandParams,
1403
+ "isTest": data.isTest,
1404
+ "sign": data.sign,
1405
+ "getNetworkType": data.getNetworkType,
1406
+ "getMsisdnMask": data.getMsisdnMask,
1407
+ "traceId": optparams.uuid,
1408
+ "msgId": optparams.msgId,
1409
+ "timestamp": optparams.timestamp,
1410
+ "uuid": optparams.uuid,
1411
+ "businessType": optparams.businessType,
1412
+ "userInformations": this.getUserInfo()
1413
+ };
1414
+ const res = await fetch(
1415
+ "https://verify.cmpassport.com/h5/getPreMobile",
1416
+ {
1417
+ method: "POST",
1418
+ headers: {
1419
+ "Referer": "https://passport.migu.cn/",
1420
+ "Origin": "https://passport.migu.cn"
1421
+ },
1422
+ body: JSON.stringify(requestData)
1423
+ }
1424
+ );
1425
+ if (!res.ok) return;
1426
+ const json = await res.json(), token = json.body?.token || "";
1427
+ if (!token) return;
1428
+ return token;
1429
+ }
1430
+ };
1431
+ function yTime() {
1432
+ const date = /* @__PURE__ */ new Date(), a = [
1433
+ date.getFullYear(),
1434
+ date.getMonth() + 1,
1435
+ date.getDate(),
1436
+ date.getHours(),
1437
+ date.getMinutes(),
1438
+ date.getSeconds(),
1439
+ date.getMilliseconds()
1440
+ ];
1441
+ const f = a.map((t) => {
1442
+ return t.toString().padStart(2, "0");
1443
+ });
1444
+ f[6] = f[6].toString().padStart(3, "0");
1445
+ return f.join("");
1446
+ }
1447
+ function md5(s) {
1448
+ return import_crypto2.default.createHash("md5").update(s, "utf-8").digest("hex");
1449
+ }
1450
+ var genInternetSign = async () => {
1451
+ const time = yTime(), e = time, c = "220029", msgId = getDeviceId(), d = msgId;
1452
+ const preSign = YDRZ.getSign("300012033963", "1.2"), b = preSign;
1453
+ let key = "interfacename=genInternetSign&sourceid=" + c + "&systemtime=" + e + "&msgid=" + d + "&preSign=" + b;
1454
+ key = encodeURIComponent(key);
1455
+ const signature = md5(key);
1456
+ const url = `https://passport.migu.cn/api/genInternetSign?preSign=${preSign}&msgid=${msgId}&systemtime=${time}&sourceid=220029&signature=${signature}`;
1457
+ const res = await fetch(url);
1458
+ if (!res.ok) return void 0;
1459
+ const data = await res.json();
1460
+ if (!data || data.status !== 2e3) return void 0;
1461
+ const rsaSign = data.result?.rsaSign || "";
1462
+ return rsaSign;
1463
+ };
1464
+ var getSTToken = async (uniToken) => {
1465
+ const $ = {
1466
+ "sourceID": "220029",
1467
+ "appType": 0,
1468
+ "relayState": "",
1469
+ "token": uniToken,
1470
+ "userInformation": YDRZ.getUserInfo(),
1471
+ "isFirst": 1
1472
+ };
1473
+ const form = URLParams($);
1474
+ const res = await fetch(
1475
+ "https://passport.migu.cn/authn/uniTokenValidate",
1476
+ {
1477
+ method: "POST",
1478
+ headers: {
1479
+ "content-type": "application/x-www-form-urlencoded; charset=UTF-8"
1480
+ },
1481
+ body: form
1482
+ }
1483
+ );
1484
+ if (!res.ok) return { error: "fetch uni e" };
1485
+ const json = await res.json(), status = json.status?.toString() || "", token = json.result?.token || "", msisdn = json.result?.msisdn || "";
1486
+ if (status !== "2000") return { error: "status e" };
1487
+ return { token, msisdn, status };
1488
+ };
1489
+ var authn = async () => {
1490
+ const rsaSign = await genInternetSign();
1491
+ if (!rsaSign) return { error: "genInternetSign failed" };
1492
+ const uniToken = await YDRZ.getTokenInfo({
1493
+ version: "1.2",
1494
+ appId: "300012033963",
1495
+ sign: rsaSign,
1496
+ openType: "1",
1497
+ expandParams: "",
1498
+ isTest: false,
1499
+ getNetworkType: "",
1500
+ getMsisdnMask: ""
1501
+ });
1502
+ if (!uniToken) return { error: "getTokenInfo failed" };
1503
+ const result = await getSTToken(uniToken);
1504
+ if ("error" in result) return result;
1505
+ const { token, msisdn, status } = result;
1506
+ if (!token) return { error: "no token" };
1507
+ if (!msisdn) return { error: "no msisdn" };
1508
+ return { token, msisdn, status };
1509
+ };
1510
+ var loginOneClick = {
1511
+ genInternetSign,
1512
+ getSTToken,
1513
+ authn
1514
+ };
1515
+
1177
1516
  // src/index.ts
1178
1517
  function createClient() {
1179
1518
  return modules_exports;
1180
1519
  }
1181
1520
  // Annotate the CommonJS export names for ESM import in node:
1182
1521
  0 && (module.exports = {
1522
+ YDRZ,
1183
1523
  checkCanListen,
1184
1524
  checkToken,
1185
1525
  createClient,
@@ -1202,8 +1542,10 @@ function createClient() {
1202
1542
  getSearchHot,
1203
1543
  getSearchSingerTab,
1204
1544
  getSearchSingerTabList,
1545
+ getSimilarSongRecommend,
1205
1546
  getSingerAlbum,
1206
1547
  getSingerIndex,
1548
+ getSingerSimilar,
1207
1549
  getSingerSong,
1208
1550
  getTicketInfo,
1209
1551
  getTodayRecommend,
@@ -1211,9 +1553,13 @@ function createClient() {
1211
1553
  getUrlV1,
1212
1554
  getUrlV2,
1213
1555
  getUserBadge,
1556
+ getUserCollect,
1214
1557
  getUserHomePage,
1558
+ getUserMyList,
1215
1559
  getVersion,
1216
1560
  loginNP,
1561
+ loginOneClick,
1562
+ loginSim,
1217
1563
  modules,
1218
1564
  queryUserInfo,
1219
1565
  searchAlbum,