migu-api-enhanced 1.2.6 → 2.0.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.cjs +162 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -3
- package/dist/index.d.ts +45 -3
- package/dist/index.js +152 -17
- package/dist/index.js.map +1 -1
- package/package.json +64 -64
package/dist/index.cjs
CHANGED
|
@@ -30,6 +30,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
MiguUtils: () => utils_exports,
|
|
34
|
+
RSAKey: () => RSAKey,
|
|
35
|
+
URLParams: () => URLParams,
|
|
33
36
|
YDRZ: () => YDRZ,
|
|
34
37
|
checkCanListen: () => checkCanListen,
|
|
35
38
|
checkToken: () => checkToken,
|
|
@@ -37,12 +40,15 @@ __export(index_exports, {
|
|
|
37
40
|
getAlbumInfo: () => getAlbumInfo,
|
|
38
41
|
getAlbumSong: () => getAlbumSong,
|
|
39
42
|
getComment: () => getComment,
|
|
43
|
+
getDeviceId: () => getDeviceId,
|
|
44
|
+
getMVRecommend: () => getMVRecommend,
|
|
40
45
|
getMvHls: () => getMvHls,
|
|
41
46
|
getMvInfo: () => getMvInfo,
|
|
42
47
|
getOpNum: () => getOpNum,
|
|
43
48
|
getPacmToken: () => getPacmToken,
|
|
44
49
|
getPlaylistInfo: () => getPlaylistInfo,
|
|
45
50
|
getPlaylistSong: () => getPlaylistSong,
|
|
51
|
+
getPublicKey: () => getPublicKey,
|
|
46
52
|
getRadioRecommend: () => getRadioRecommend,
|
|
47
53
|
getRankIndex: () => getRankIndex,
|
|
48
54
|
getRankInfo: () => getRankInfo,
|
|
@@ -70,9 +76,11 @@ __export(index_exports, {
|
|
|
70
76
|
getVersion: () => getVersion,
|
|
71
77
|
loginNP: () => loginNP,
|
|
72
78
|
loginOneClick: () => loginOneClick,
|
|
79
|
+
loginPhone: () => loginPhone,
|
|
73
80
|
loginSim: () => loginSim,
|
|
74
81
|
modules: () => modules_exports,
|
|
75
82
|
queryUserInfo: () => queryUserInfo,
|
|
83
|
+
randomUA: () => randomUA,
|
|
76
84
|
searchAlbum: () => searchAlbum,
|
|
77
85
|
searchConcert: () => searchConcert,
|
|
78
86
|
searchRbt: () => searchRbt,
|
|
@@ -80,7 +88,8 @@ __export(index_exports, {
|
|
|
80
88
|
searchSong: () => searchSong,
|
|
81
89
|
searchSuggest: () => searchSuggest,
|
|
82
90
|
searchTicket: () => searchTicket,
|
|
83
|
-
searchVideo: () => searchVideo
|
|
91
|
+
searchVideo: () => searchVideo,
|
|
92
|
+
ua: () => ua
|
|
84
93
|
});
|
|
85
94
|
module.exports = __toCommonJS(index_exports);
|
|
86
95
|
|
|
@@ -93,6 +102,7 @@ __export(modules_exports, {
|
|
|
93
102
|
getAlbumInfo: () => getAlbumInfo,
|
|
94
103
|
getAlbumSong: () => getAlbumSong,
|
|
95
104
|
getComment: () => getComment,
|
|
105
|
+
getMVRecommend: () => getMVRecommend,
|
|
96
106
|
getMvHls: () => getMvHls,
|
|
97
107
|
getMvInfo: () => getMvInfo,
|
|
98
108
|
getOpNum: () => getOpNum,
|
|
@@ -126,6 +136,7 @@ __export(modules_exports, {
|
|
|
126
136
|
getVersion: () => getVersion,
|
|
127
137
|
loginNP: () => loginNP,
|
|
128
138
|
loginOneClick: () => loginOneClick,
|
|
139
|
+
loginPhone: () => loginPhone,
|
|
129
140
|
loginSim: () => loginSim,
|
|
130
141
|
queryUserInfo: () => queryUserInfo,
|
|
131
142
|
searchAlbum: () => searchAlbum,
|
|
@@ -503,13 +514,13 @@ var decryptData2 = async (blob) => {
|
|
|
503
514
|
};
|
|
504
515
|
|
|
505
516
|
// src/modules/version.ts
|
|
506
|
-
var getVersion = async (channel = "0146921", version = "8.4.0",
|
|
517
|
+
var getVersion = async (channel = "0146921", version = "8.4.0", ua2 = "Android_migu") => {
|
|
507
518
|
return await h5fetch(
|
|
508
519
|
`http://app.c.nf.migu.cn/MIGUM2.0/resource/client/version/v1.0`,
|
|
509
520
|
{
|
|
510
521
|
headers: {
|
|
511
522
|
"channel": channel,
|
|
512
|
-
"ua":
|
|
523
|
+
"ua": ua2,
|
|
513
524
|
"version": version
|
|
514
525
|
}
|
|
515
526
|
}
|
|
@@ -517,8 +528,8 @@ var getVersion = async (channel = "0146921", version = "8.4.0", ua = "Android_mi
|
|
|
517
528
|
};
|
|
518
529
|
|
|
519
530
|
// src/modules/mv_info.ts
|
|
520
|
-
var getMvInfo = async (
|
|
521
|
-
return h5fetch(`https://c.musicapp.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?resourceId=${
|
|
531
|
+
var getMvInfo = async (mvContentId) => {
|
|
532
|
+
return await h5fetch(`https://c.musicapp.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?resourceId=${mvContentId}&resourceType=D&needSimple=01`);
|
|
522
533
|
};
|
|
523
534
|
|
|
524
535
|
// src/modules/mv_hls.ts
|
|
@@ -580,7 +591,6 @@ var RSAKey = class {
|
|
|
580
591
|
}
|
|
581
592
|
}
|
|
582
593
|
};
|
|
583
|
-
var rsalib_default = { RSAKey };
|
|
584
594
|
|
|
585
595
|
// src/utils/publicKey.ts
|
|
586
596
|
var getPublicKey = async () => {
|
|
@@ -607,7 +617,6 @@ function URLParams($) {
|
|
|
607
617
|
}
|
|
608
618
|
|
|
609
619
|
// src/modules/login_np.ts
|
|
610
|
-
var RSAKey2 = rsalib_default.RSAKey;
|
|
611
620
|
function randomString() {
|
|
612
621
|
const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
|
613
622
|
return random.toLowerCase();
|
|
@@ -637,7 +646,7 @@ var loginNP = {
|
|
|
637
646
|
if (!modulus || !publicExponent) {
|
|
638
647
|
return { error: "\u83B7\u53D6\u516C\u94A5\u5931\u8D25" };
|
|
639
648
|
}
|
|
640
|
-
var rsa = new
|
|
649
|
+
var rsa = new RSAKey();
|
|
641
650
|
rsa.setPublic(modulus, publicExponent);
|
|
642
651
|
const rsa_pwd = rsa.encrypt(password);
|
|
643
652
|
const rsa_username = rsa.encrypt(username);
|
|
@@ -652,7 +661,10 @@ var loginNP = {
|
|
|
652
661
|
{
|
|
653
662
|
method: "POST",
|
|
654
663
|
headers: {
|
|
655
|
-
"Host": "passport.migu.cn"
|
|
664
|
+
"Host": "passport.migu.cn",
|
|
665
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
666
|
+
"Referer": "https://passport.migu.cn/login",
|
|
667
|
+
"Origin": "https://passport.migu.cn"
|
|
656
668
|
},
|
|
657
669
|
body: form
|
|
658
670
|
}
|
|
@@ -801,7 +813,6 @@ var getTodayRecommend = async (pacmtoken) => {
|
|
|
801
813
|
};
|
|
802
814
|
|
|
803
815
|
// src/modules/login_sim.ts
|
|
804
|
-
var RSAKey3 = rsalib_default.RSAKey;
|
|
805
816
|
function randomString2() {
|
|
806
817
|
const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
|
807
818
|
return random.toLowerCase();
|
|
@@ -824,7 +835,7 @@ var loginSim = {
|
|
|
824
835
|
if (!modulus || !publicExponent) {
|
|
825
836
|
return { error: "\u83B7\u53D6\u516C\u94A5\u5931\u8D25" };
|
|
826
837
|
}
|
|
827
|
-
const rsa = new
|
|
838
|
+
const rsa = new RSAKey();
|
|
828
839
|
rsa.setPublic(modulus, publicExponent);
|
|
829
840
|
const encPhone = rsa.encrypt(phone);
|
|
830
841
|
const fakeFingerprint = randomString2();
|
|
@@ -837,8 +848,10 @@ var loginSim = {
|
|
|
837
848
|
{
|
|
838
849
|
method: "POST",
|
|
839
850
|
headers: {
|
|
840
|
-
|
|
841
|
-
"
|
|
851
|
+
"Host": "passport.migu.cn",
|
|
852
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
853
|
+
"Referer": "https://passport.migu.cn/login",
|
|
854
|
+
"Origin": "https://passport.migu.cn"
|
|
842
855
|
},
|
|
843
856
|
body: form
|
|
844
857
|
}
|
|
@@ -867,7 +880,12 @@ var loginSim = {
|
|
|
867
880
|
`https://passport.migu.cn/api/simauth/query`,
|
|
868
881
|
{
|
|
869
882
|
method: "POST",
|
|
870
|
-
headers: {
|
|
883
|
+
headers: {
|
|
884
|
+
"Host": "passport.migu.cn",
|
|
885
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
886
|
+
"Referer": "https://passport.migu.cn/login",
|
|
887
|
+
"Origin": "https://passport.migu.cn"
|
|
888
|
+
},
|
|
871
889
|
body: form
|
|
872
890
|
}
|
|
873
891
|
);
|
|
@@ -975,9 +993,9 @@ var YDRZ = {
|
|
|
975
993
|
return Math.floor(Math.random() * (min - max) + max);
|
|
976
994
|
},
|
|
977
995
|
getUA() {
|
|
978
|
-
const
|
|
996
|
+
const ua2 = nav.userAgent, l = [
|
|
979
997
|
nav.platform,
|
|
980
|
-
|
|
998
|
+
ua2,
|
|
981
999
|
nav.appVersion,
|
|
982
1000
|
nav.cookieEnabled,
|
|
983
1001
|
void 0,
|
|
@@ -988,7 +1006,7 @@ var YDRZ = {
|
|
|
988
1006
|
nav.availHeight,
|
|
989
1007
|
nav.colorDepth,
|
|
990
1008
|
nav.timezoneOffset
|
|
991
|
-
], key = l.join("@@"), finalUA =
|
|
1009
|
+
], key = l.join("@@"), finalUA = ua2.length > 100 ? ua2.substring(0, 100) : ua2;
|
|
992
1010
|
return nav.platform + "@@" + finalUA + "@@" + md5(key);
|
|
993
1011
|
},
|
|
994
1012
|
uaE(str) {
|
|
@@ -1127,12 +1145,132 @@ var loginOneClick = {
|
|
|
1127
1145
|
authn
|
|
1128
1146
|
};
|
|
1129
1147
|
|
|
1148
|
+
// src/modules/login_phone.ts
|
|
1149
|
+
function randomString3() {
|
|
1150
|
+
const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
|
1151
|
+
return random.toLowerCase();
|
|
1152
|
+
}
|
|
1153
|
+
var loginPhone = {
|
|
1154
|
+
//获取验证码
|
|
1155
|
+
async getMsgCode(phone) {
|
|
1156
|
+
var $ = {
|
|
1157
|
+
"isAsync": true,
|
|
1158
|
+
"msisdn": "",
|
|
1159
|
+
"captcha": "",
|
|
1160
|
+
"sourceID": "220029",
|
|
1161
|
+
"imgcodeType": "2",
|
|
1162
|
+
"fingerPrint": "",
|
|
1163
|
+
"fingerPrintDetail": "",
|
|
1164
|
+
"_": ""
|
|
1165
|
+
};
|
|
1166
|
+
const result = await getPublicKey();
|
|
1167
|
+
const { publicExponent = "", modulus = "" } = result;
|
|
1168
|
+
var c = new RSAKey();
|
|
1169
|
+
c.setPublic(modulus, publicExponent);
|
|
1170
|
+
$.msisdn = c.encrypt(phone) || "";
|
|
1171
|
+
if (!$.msisdn) return { error: "encrypt error" };
|
|
1172
|
+
const fakeFingerprint = randomString3();
|
|
1173
|
+
$.fingerPrint = fakeFingerprint;
|
|
1174
|
+
$.fingerPrintDetail = fakeFingerprint;
|
|
1175
|
+
$._ = (/* @__PURE__ */ new Date()).getTime().toString();
|
|
1176
|
+
const query = URLParams($);
|
|
1177
|
+
const res = await fetch(
|
|
1178
|
+
`https://passport.migu.cn/login/dynamicpassword?${query}`,
|
|
1179
|
+
{
|
|
1180
|
+
method: "GET",
|
|
1181
|
+
headers: {
|
|
1182
|
+
"Host": "passport.migu.cn",
|
|
1183
|
+
"Referer": "https://passport.migu.cn/login",
|
|
1184
|
+
"Origin": "https://passport.migu.cn"
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
);
|
|
1188
|
+
if (!res.ok) return { error: "gmc e" };
|
|
1189
|
+
const data = await res.json();
|
|
1190
|
+
return data;
|
|
1191
|
+
},
|
|
1192
|
+
//登陆
|
|
1193
|
+
async authn(phone, msgCode) {
|
|
1194
|
+
var $ = {
|
|
1195
|
+
"isAsync": true,
|
|
1196
|
+
"msisdn": "",
|
|
1197
|
+
"dynamicPassword": "",
|
|
1198
|
+
"captcha": "",
|
|
1199
|
+
"appType": "",
|
|
1200
|
+
"securityCode": "7619",
|
|
1201
|
+
"sourceID": "220029",
|
|
1202
|
+
"imgcodeType": "2",
|
|
1203
|
+
"fingerPrint": "",
|
|
1204
|
+
"fingerPrintDetail": ""
|
|
1205
|
+
};
|
|
1206
|
+
const result = await getPublicKey();
|
|
1207
|
+
const { publicExponent = "", modulus = "" } = result;
|
|
1208
|
+
var c = new RSAKey();
|
|
1209
|
+
c.setPublic(modulus, publicExponent);
|
|
1210
|
+
$.msisdn = c.encrypt(phone) || "";
|
|
1211
|
+
$.dynamicPassword = c.encrypt(msgCode) || "";
|
|
1212
|
+
if (!$.msisdn || !$.dynamicPassword) return { error: "encrypt error" };
|
|
1213
|
+
const fakeFingerprint = randomString3();
|
|
1214
|
+
$.fingerPrint = fakeFingerprint;
|
|
1215
|
+
$.fingerPrintDetail = fakeFingerprint;
|
|
1216
|
+
const form = URLParams($);
|
|
1217
|
+
const res = await fetch(
|
|
1218
|
+
`https://passport.migu.cn/authn/dynamicpassword`,
|
|
1219
|
+
{
|
|
1220
|
+
method: "POST",
|
|
1221
|
+
headers: {
|
|
1222
|
+
"Host": "passport.migu.cn",
|
|
1223
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
1224
|
+
"Referer": "https://passport.migu.cn/login",
|
|
1225
|
+
"Origin": "https://passport.migu.cn"
|
|
1226
|
+
},
|
|
1227
|
+
body: form
|
|
1228
|
+
}
|
|
1229
|
+
);
|
|
1230
|
+
if (!res.ok) return { error: "gmc e" };
|
|
1231
|
+
const data = await res.json();
|
|
1232
|
+
return data;
|
|
1233
|
+
}
|
|
1234
|
+
};
|
|
1235
|
+
|
|
1236
|
+
// src/modules/mv_recommend.ts
|
|
1237
|
+
var getMVRecommend = async (mvContentId, page = 1) => {
|
|
1238
|
+
return await h5fetch(`https://c.musicapp.migu.cn/MIGUM3.0/v3.0/content/recommend-mv?resourceId=${mvContentId}&pageNumber=${page}&resourceType=D`);
|
|
1239
|
+
};
|
|
1240
|
+
|
|
1241
|
+
// src/utils/index.ts
|
|
1242
|
+
var utils_exports = {};
|
|
1243
|
+
__export(utils_exports, {
|
|
1244
|
+
RSAKey: () => RSAKey,
|
|
1245
|
+
URLParams: () => URLParams,
|
|
1246
|
+
getDeviceId: () => getDeviceId,
|
|
1247
|
+
getPublicKey: () => getPublicKey,
|
|
1248
|
+
randomUA: () => randomUA,
|
|
1249
|
+
ua: () => ua
|
|
1250
|
+
});
|
|
1251
|
+
|
|
1252
|
+
// src/utils/ua.ts
|
|
1253
|
+
var ua = [
|
|
1254
|
+
"Mozilla/5.0 (Linux; Android 9; Redmi Note 7 Build/PKQ1.180904.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/72.0.3626.121 Mobile Safari/537.36",
|
|
1255
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36 Edg/149.0.0.0",
|
|
1256
|
+
"Mozilla/5.0 (Linux; Android 9; Redmi Note 7 Build/PKQ1.180904.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36",
|
|
1257
|
+
"Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_1 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B150 /sa-sdk-ios/sensors-verify/sc.baertt.com?production ",
|
|
1258
|
+
"Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/534.31 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/534.31"
|
|
1259
|
+
];
|
|
1260
|
+
var randomUA = () => {
|
|
1261
|
+
const i = Math.floor(Math.random() * 5);
|
|
1262
|
+
return ua[i];
|
|
1263
|
+
};
|
|
1264
|
+
|
|
1130
1265
|
// src/index.ts
|
|
1131
1266
|
function createClient() {
|
|
1132
1267
|
return modules_exports;
|
|
1133
1268
|
}
|
|
1134
1269
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1135
1270
|
0 && (module.exports = {
|
|
1271
|
+
MiguUtils,
|
|
1272
|
+
RSAKey,
|
|
1273
|
+
URLParams,
|
|
1136
1274
|
YDRZ,
|
|
1137
1275
|
checkCanListen,
|
|
1138
1276
|
checkToken,
|
|
@@ -1140,12 +1278,15 @@ function createClient() {
|
|
|
1140
1278
|
getAlbumInfo,
|
|
1141
1279
|
getAlbumSong,
|
|
1142
1280
|
getComment,
|
|
1281
|
+
getDeviceId,
|
|
1282
|
+
getMVRecommend,
|
|
1143
1283
|
getMvHls,
|
|
1144
1284
|
getMvInfo,
|
|
1145
1285
|
getOpNum,
|
|
1146
1286
|
getPacmToken,
|
|
1147
1287
|
getPlaylistInfo,
|
|
1148
1288
|
getPlaylistSong,
|
|
1289
|
+
getPublicKey,
|
|
1149
1290
|
getRadioRecommend,
|
|
1150
1291
|
getRankIndex,
|
|
1151
1292
|
getRankInfo,
|
|
@@ -1173,9 +1314,11 @@ function createClient() {
|
|
|
1173
1314
|
getVersion,
|
|
1174
1315
|
loginNP,
|
|
1175
1316
|
loginOneClick,
|
|
1317
|
+
loginPhone,
|
|
1176
1318
|
loginSim,
|
|
1177
1319
|
modules,
|
|
1178
1320
|
queryUserInfo,
|
|
1321
|
+
randomUA,
|
|
1179
1322
|
searchAlbum,
|
|
1180
1323
|
searchConcert,
|
|
1181
1324
|
searchRbt,
|
|
@@ -1183,6 +1326,7 @@ function createClient() {
|
|
|
1183
1326
|
searchSong,
|
|
1184
1327
|
searchSuggest,
|
|
1185
1328
|
searchTicket,
|
|
1186
|
-
searchVideo
|
|
1329
|
+
searchVideo,
|
|
1330
|
+
ua
|
|
1187
1331
|
});
|
|
1188
1332
|
//# sourceMappingURL=index.cjs.map
|