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.js
CHANGED
|
@@ -13,6 +13,7 @@ __export(modules_exports, {
|
|
|
13
13
|
getAlbumInfo: () => getAlbumInfo,
|
|
14
14
|
getAlbumSong: () => getAlbumSong,
|
|
15
15
|
getComment: () => getComment,
|
|
16
|
+
getMVRecommend: () => getMVRecommend,
|
|
16
17
|
getMvHls: () => getMvHls,
|
|
17
18
|
getMvInfo: () => getMvInfo,
|
|
18
19
|
getOpNum: () => getOpNum,
|
|
@@ -46,6 +47,7 @@ __export(modules_exports, {
|
|
|
46
47
|
getVersion: () => getVersion,
|
|
47
48
|
loginNP: () => loginNP,
|
|
48
49
|
loginOneClick: () => loginOneClick,
|
|
50
|
+
loginPhone: () => loginPhone,
|
|
49
51
|
loginSim: () => loginSim,
|
|
50
52
|
queryUserInfo: () => queryUserInfo,
|
|
51
53
|
searchAlbum: () => searchAlbum,
|
|
@@ -423,13 +425,13 @@ var decryptData2 = async (blob) => {
|
|
|
423
425
|
};
|
|
424
426
|
|
|
425
427
|
// src/modules/version.ts
|
|
426
|
-
var getVersion = async (channel = "0146921", version = "8.4.0",
|
|
428
|
+
var getVersion = async (channel = "0146921", version = "8.4.0", ua2 = "Android_migu") => {
|
|
427
429
|
return await h5fetch(
|
|
428
430
|
`http://app.c.nf.migu.cn/MIGUM2.0/resource/client/version/v1.0`,
|
|
429
431
|
{
|
|
430
432
|
headers: {
|
|
431
433
|
"channel": channel,
|
|
432
|
-
"ua":
|
|
434
|
+
"ua": ua2,
|
|
433
435
|
"version": version
|
|
434
436
|
}
|
|
435
437
|
}
|
|
@@ -437,8 +439,8 @@ var getVersion = async (channel = "0146921", version = "8.4.0", ua = "Android_mi
|
|
|
437
439
|
};
|
|
438
440
|
|
|
439
441
|
// src/modules/mv_info.ts
|
|
440
|
-
var getMvInfo = async (
|
|
441
|
-
return h5fetch(`https://c.musicapp.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?resourceId=${
|
|
442
|
+
var getMvInfo = async (mvContentId) => {
|
|
443
|
+
return await h5fetch(`https://c.musicapp.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?resourceId=${mvContentId}&resourceType=D&needSimple=01`);
|
|
442
444
|
};
|
|
443
445
|
|
|
444
446
|
// src/modules/mv_hls.ts
|
|
@@ -500,7 +502,6 @@ var RSAKey = class {
|
|
|
500
502
|
}
|
|
501
503
|
}
|
|
502
504
|
};
|
|
503
|
-
var rsalib_default = { RSAKey };
|
|
504
505
|
|
|
505
506
|
// src/utils/publicKey.ts
|
|
506
507
|
var getPublicKey = async () => {
|
|
@@ -527,7 +528,6 @@ function URLParams($) {
|
|
|
527
528
|
}
|
|
528
529
|
|
|
529
530
|
// src/modules/login_np.ts
|
|
530
|
-
var RSAKey2 = rsalib_default.RSAKey;
|
|
531
531
|
function randomString() {
|
|
532
532
|
const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
|
533
533
|
return random.toLowerCase();
|
|
@@ -557,7 +557,7 @@ var loginNP = {
|
|
|
557
557
|
if (!modulus || !publicExponent) {
|
|
558
558
|
return { error: "\u83B7\u53D6\u516C\u94A5\u5931\u8D25" };
|
|
559
559
|
}
|
|
560
|
-
var rsa = new
|
|
560
|
+
var rsa = new RSAKey();
|
|
561
561
|
rsa.setPublic(modulus, publicExponent);
|
|
562
562
|
const rsa_pwd = rsa.encrypt(password);
|
|
563
563
|
const rsa_username = rsa.encrypt(username);
|
|
@@ -572,7 +572,10 @@ var loginNP = {
|
|
|
572
572
|
{
|
|
573
573
|
method: "POST",
|
|
574
574
|
headers: {
|
|
575
|
-
"Host": "passport.migu.cn"
|
|
575
|
+
"Host": "passport.migu.cn",
|
|
576
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
577
|
+
"Referer": "https://passport.migu.cn/login",
|
|
578
|
+
"Origin": "https://passport.migu.cn"
|
|
576
579
|
},
|
|
577
580
|
body: form
|
|
578
581
|
}
|
|
@@ -721,7 +724,6 @@ var getTodayRecommend = async (pacmtoken) => {
|
|
|
721
724
|
};
|
|
722
725
|
|
|
723
726
|
// src/modules/login_sim.ts
|
|
724
|
-
var RSAKey3 = rsalib_default.RSAKey;
|
|
725
727
|
function randomString2() {
|
|
726
728
|
const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
|
727
729
|
return random.toLowerCase();
|
|
@@ -744,7 +746,7 @@ var loginSim = {
|
|
|
744
746
|
if (!modulus || !publicExponent) {
|
|
745
747
|
return { error: "\u83B7\u53D6\u516C\u94A5\u5931\u8D25" };
|
|
746
748
|
}
|
|
747
|
-
const rsa = new
|
|
749
|
+
const rsa = new RSAKey();
|
|
748
750
|
rsa.setPublic(modulus, publicExponent);
|
|
749
751
|
const encPhone = rsa.encrypt(phone);
|
|
750
752
|
const fakeFingerprint = randomString2();
|
|
@@ -757,8 +759,10 @@ var loginSim = {
|
|
|
757
759
|
{
|
|
758
760
|
method: "POST",
|
|
759
761
|
headers: {
|
|
760
|
-
|
|
761
|
-
"
|
|
762
|
+
"Host": "passport.migu.cn",
|
|
763
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
764
|
+
"Referer": "https://passport.migu.cn/login",
|
|
765
|
+
"Origin": "https://passport.migu.cn"
|
|
762
766
|
},
|
|
763
767
|
body: form
|
|
764
768
|
}
|
|
@@ -787,7 +791,12 @@ var loginSim = {
|
|
|
787
791
|
`https://passport.migu.cn/api/simauth/query`,
|
|
788
792
|
{
|
|
789
793
|
method: "POST",
|
|
790
|
-
headers: {
|
|
794
|
+
headers: {
|
|
795
|
+
"Host": "passport.migu.cn",
|
|
796
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
797
|
+
"Referer": "https://passport.migu.cn/login",
|
|
798
|
+
"Origin": "https://passport.migu.cn"
|
|
799
|
+
},
|
|
791
800
|
body: form
|
|
792
801
|
}
|
|
793
802
|
);
|
|
@@ -895,9 +904,9 @@ var YDRZ = {
|
|
|
895
904
|
return Math.floor(Math.random() * (min - max) + max);
|
|
896
905
|
},
|
|
897
906
|
getUA() {
|
|
898
|
-
const
|
|
907
|
+
const ua2 = nav.userAgent, l = [
|
|
899
908
|
nav.platform,
|
|
900
|
-
|
|
909
|
+
ua2,
|
|
901
910
|
nav.appVersion,
|
|
902
911
|
nav.cookieEnabled,
|
|
903
912
|
void 0,
|
|
@@ -908,7 +917,7 @@ var YDRZ = {
|
|
|
908
917
|
nav.availHeight,
|
|
909
918
|
nav.colorDepth,
|
|
910
919
|
nav.timezoneOffset
|
|
911
|
-
], key = l.join("@@"), finalUA =
|
|
920
|
+
], key = l.join("@@"), finalUA = ua2.length > 100 ? ua2.substring(0, 100) : ua2;
|
|
912
921
|
return nav.platform + "@@" + finalUA + "@@" + md5(key);
|
|
913
922
|
},
|
|
914
923
|
uaE(str) {
|
|
@@ -1047,11 +1056,131 @@ var loginOneClick = {
|
|
|
1047
1056
|
authn
|
|
1048
1057
|
};
|
|
1049
1058
|
|
|
1059
|
+
// src/modules/login_phone.ts
|
|
1060
|
+
function randomString3() {
|
|
1061
|
+
const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
|
1062
|
+
return random.toLowerCase();
|
|
1063
|
+
}
|
|
1064
|
+
var loginPhone = {
|
|
1065
|
+
//获取验证码
|
|
1066
|
+
async getMsgCode(phone) {
|
|
1067
|
+
var $ = {
|
|
1068
|
+
"isAsync": true,
|
|
1069
|
+
"msisdn": "",
|
|
1070
|
+
"captcha": "",
|
|
1071
|
+
"sourceID": "220029",
|
|
1072
|
+
"imgcodeType": "2",
|
|
1073
|
+
"fingerPrint": "",
|
|
1074
|
+
"fingerPrintDetail": "",
|
|
1075
|
+
"_": ""
|
|
1076
|
+
};
|
|
1077
|
+
const result = await getPublicKey();
|
|
1078
|
+
const { publicExponent = "", modulus = "" } = result;
|
|
1079
|
+
var c = new RSAKey();
|
|
1080
|
+
c.setPublic(modulus, publicExponent);
|
|
1081
|
+
$.msisdn = c.encrypt(phone) || "";
|
|
1082
|
+
if (!$.msisdn) return { error: "encrypt error" };
|
|
1083
|
+
const fakeFingerprint = randomString3();
|
|
1084
|
+
$.fingerPrint = fakeFingerprint;
|
|
1085
|
+
$.fingerPrintDetail = fakeFingerprint;
|
|
1086
|
+
$._ = (/* @__PURE__ */ new Date()).getTime().toString();
|
|
1087
|
+
const query = URLParams($);
|
|
1088
|
+
const res = await fetch(
|
|
1089
|
+
`https://passport.migu.cn/login/dynamicpassword?${query}`,
|
|
1090
|
+
{
|
|
1091
|
+
method: "GET",
|
|
1092
|
+
headers: {
|
|
1093
|
+
"Host": "passport.migu.cn",
|
|
1094
|
+
"Referer": "https://passport.migu.cn/login",
|
|
1095
|
+
"Origin": "https://passport.migu.cn"
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
);
|
|
1099
|
+
if (!res.ok) return { error: "gmc e" };
|
|
1100
|
+
const data = await res.json();
|
|
1101
|
+
return data;
|
|
1102
|
+
},
|
|
1103
|
+
//登陆
|
|
1104
|
+
async authn(phone, msgCode) {
|
|
1105
|
+
var $ = {
|
|
1106
|
+
"isAsync": true,
|
|
1107
|
+
"msisdn": "",
|
|
1108
|
+
"dynamicPassword": "",
|
|
1109
|
+
"captcha": "",
|
|
1110
|
+
"appType": "",
|
|
1111
|
+
"securityCode": "7619",
|
|
1112
|
+
"sourceID": "220029",
|
|
1113
|
+
"imgcodeType": "2",
|
|
1114
|
+
"fingerPrint": "",
|
|
1115
|
+
"fingerPrintDetail": ""
|
|
1116
|
+
};
|
|
1117
|
+
const result = await getPublicKey();
|
|
1118
|
+
const { publicExponent = "", modulus = "" } = result;
|
|
1119
|
+
var c = new RSAKey();
|
|
1120
|
+
c.setPublic(modulus, publicExponent);
|
|
1121
|
+
$.msisdn = c.encrypt(phone) || "";
|
|
1122
|
+
$.dynamicPassword = c.encrypt(msgCode) || "";
|
|
1123
|
+
if (!$.msisdn || !$.dynamicPassword) return { error: "encrypt error" };
|
|
1124
|
+
const fakeFingerprint = randomString3();
|
|
1125
|
+
$.fingerPrint = fakeFingerprint;
|
|
1126
|
+
$.fingerPrintDetail = fakeFingerprint;
|
|
1127
|
+
const form = URLParams($);
|
|
1128
|
+
const res = await fetch(
|
|
1129
|
+
`https://passport.migu.cn/authn/dynamicpassword`,
|
|
1130
|
+
{
|
|
1131
|
+
method: "POST",
|
|
1132
|
+
headers: {
|
|
1133
|
+
"Host": "passport.migu.cn",
|
|
1134
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
1135
|
+
"Referer": "https://passport.migu.cn/login",
|
|
1136
|
+
"Origin": "https://passport.migu.cn"
|
|
1137
|
+
},
|
|
1138
|
+
body: form
|
|
1139
|
+
}
|
|
1140
|
+
);
|
|
1141
|
+
if (!res.ok) return { error: "gmc e" };
|
|
1142
|
+
const data = await res.json();
|
|
1143
|
+
return data;
|
|
1144
|
+
}
|
|
1145
|
+
};
|
|
1146
|
+
|
|
1147
|
+
// src/modules/mv_recommend.ts
|
|
1148
|
+
var getMVRecommend = async (mvContentId, page = 1) => {
|
|
1149
|
+
return await h5fetch(`https://c.musicapp.migu.cn/MIGUM3.0/v3.0/content/recommend-mv?resourceId=${mvContentId}&pageNumber=${page}&resourceType=D`);
|
|
1150
|
+
};
|
|
1151
|
+
|
|
1152
|
+
// src/utils/index.ts
|
|
1153
|
+
var utils_exports = {};
|
|
1154
|
+
__export(utils_exports, {
|
|
1155
|
+
RSAKey: () => RSAKey,
|
|
1156
|
+
URLParams: () => URLParams,
|
|
1157
|
+
getDeviceId: () => getDeviceId,
|
|
1158
|
+
getPublicKey: () => getPublicKey,
|
|
1159
|
+
randomUA: () => randomUA,
|
|
1160
|
+
ua: () => ua
|
|
1161
|
+
});
|
|
1162
|
+
|
|
1163
|
+
// src/utils/ua.ts
|
|
1164
|
+
var ua = [
|
|
1165
|
+
"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",
|
|
1166
|
+
"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",
|
|
1167
|
+
"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",
|
|
1168
|
+
"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 ",
|
|
1169
|
+
"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"
|
|
1170
|
+
];
|
|
1171
|
+
var randomUA = () => {
|
|
1172
|
+
const i = Math.floor(Math.random() * 5);
|
|
1173
|
+
return ua[i];
|
|
1174
|
+
};
|
|
1175
|
+
|
|
1050
1176
|
// src/index.ts
|
|
1051
1177
|
function createClient() {
|
|
1052
1178
|
return modules_exports;
|
|
1053
1179
|
}
|
|
1054
1180
|
export {
|
|
1181
|
+
utils_exports as MiguUtils,
|
|
1182
|
+
RSAKey,
|
|
1183
|
+
URLParams,
|
|
1055
1184
|
YDRZ,
|
|
1056
1185
|
checkCanListen,
|
|
1057
1186
|
checkToken,
|
|
@@ -1059,12 +1188,15 @@ export {
|
|
|
1059
1188
|
getAlbumInfo,
|
|
1060
1189
|
getAlbumSong,
|
|
1061
1190
|
getComment,
|
|
1191
|
+
getDeviceId,
|
|
1192
|
+
getMVRecommend,
|
|
1062
1193
|
getMvHls,
|
|
1063
1194
|
getMvInfo,
|
|
1064
1195
|
getOpNum,
|
|
1065
1196
|
getPacmToken,
|
|
1066
1197
|
getPlaylistInfo,
|
|
1067
1198
|
getPlaylistSong,
|
|
1199
|
+
getPublicKey,
|
|
1068
1200
|
getRadioRecommend,
|
|
1069
1201
|
getRankIndex,
|
|
1070
1202
|
getRankInfo,
|
|
@@ -1092,9 +1224,11 @@ export {
|
|
|
1092
1224
|
getVersion,
|
|
1093
1225
|
loginNP,
|
|
1094
1226
|
loginOneClick,
|
|
1227
|
+
loginPhone,
|
|
1095
1228
|
loginSim,
|
|
1096
1229
|
modules_exports as modules,
|
|
1097
1230
|
queryUserInfo,
|
|
1231
|
+
randomUA,
|
|
1098
1232
|
searchAlbum,
|
|
1099
1233
|
searchConcert,
|
|
1100
1234
|
searchRbt,
|
|
@@ -1102,6 +1236,7 @@ export {
|
|
|
1102
1236
|
searchSong,
|
|
1103
1237
|
searchSuggest,
|
|
1104
1238
|
searchTicket,
|
|
1105
|
-
searchVideo
|
|
1239
|
+
searchVideo,
|
|
1240
|
+
ua
|
|
1106
1241
|
};
|
|
1107
1242
|
//# sourceMappingURL=index.js.map
|