migu-api-enhanced 1.2.6 → 2.2.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/README.md +207 -207
- package/dist/index.cjs +214 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +71 -8
- package/dist/index.d.ts +71 -8
- package/dist/index.js +199 -21
- package/dist/index.js.map +1 -1
- package/package.json +64 -64
package/dist/index.d.ts
CHANGED
|
@@ -45,8 +45,8 @@ declare const getRecommendPlaylist: () => Promise<any>;
|
|
|
45
45
|
declare const getSceneRecommend: (scene?: string, size?: number) => Promise<any>;
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
* 获取电台推荐
|
|
49
|
-
* @param type 1:上瘾电台 2:听见不同
|
|
48
|
+
* 获取电台推荐 (主页电台)
|
|
49
|
+
* @param type 1:上瘾电台 2:听见不同 <- 私人FM <-ALL
|
|
50
50
|
* @returns
|
|
51
51
|
*/
|
|
52
52
|
declare const getRadioRecommend: (type?: number) => Promise<any>;
|
|
@@ -56,19 +56,19 @@ size?: number, hotCommentStart?: number) => Promise<any>;
|
|
|
56
56
|
|
|
57
57
|
declare const getResourceInfo: (resourceId: string, resourceType?: number) => Promise<any>;
|
|
58
58
|
|
|
59
|
-
declare const checkCanListen: (body: any) => Promise<any>;
|
|
59
|
+
declare const checkCanListen: (body: Record<string, any>) => Promise<any>;
|
|
60
60
|
|
|
61
61
|
declare const getOpNum: (ids: string) => Promise<any>;
|
|
62
62
|
|
|
63
63
|
declare const getUrlV1: (contentId: string, copyrightId: string, resourceType?: string) => Promise<any>;
|
|
64
64
|
|
|
65
|
-
declare const getUrlV2: (contentId: string, copyrightId: string, resourceType?: string, pacmtoken?: string) => Promise<any>;
|
|
65
|
+
declare const getUrlV2: (contentId: string, copyrightId: string, toneFlag?: string, resourceType?: string, pacmtoken?: string) => Promise<any>;
|
|
66
66
|
|
|
67
|
-
declare const getUrlH5V24: (contentId: string, copyrightId: string, resourceType?: string) => Promise<any>;
|
|
67
|
+
declare const getUrlH5V24: (contentId: string, copyrightId: string, toneFlag?: string, resourceType?: string) => Promise<any>;
|
|
68
68
|
|
|
69
69
|
declare const getVersion: (channel?: string, version?: string, ua?: string) => Promise<any>;
|
|
70
70
|
|
|
71
|
-
declare const getMvInfo: (
|
|
71
|
+
declare const getMvInfo: (mvContentId: string) => Promise<any>;
|
|
72
72
|
|
|
73
73
|
declare const getMvHls: (mvContentId: string, mvCopyrightId: string, url: string, size: number, format?: string, needHttps?: boolean) => Promise<any>;
|
|
74
74
|
|
|
@@ -221,6 +221,33 @@ declare const loginOneClick: {
|
|
|
221
221
|
}>;
|
|
222
222
|
};
|
|
223
223
|
|
|
224
|
+
declare const loginPhone: {
|
|
225
|
+
getMsgCode(phone: string): Promise<any>;
|
|
226
|
+
authn(phone: string, msgCode: string): Promise<any>;
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* 获取相似歌曲推荐
|
|
231
|
+
* @param contentId 歌曲ID
|
|
232
|
+
*/
|
|
233
|
+
declare const getMVRecommend: (mvContentId: string, page?: number) => Promise<any>;
|
|
234
|
+
|
|
235
|
+
declare const getPlaylistSquare: () => Promise<any>;
|
|
236
|
+
|
|
237
|
+
declare const searchLrc: (text: string, page?: number) => Promise<any>;
|
|
238
|
+
|
|
239
|
+
declare const getNinanSong: () => Promise<any>;
|
|
240
|
+
|
|
241
|
+
declare const getNinanByDate: (date: string) => Promise<any>;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* 获取电台推荐 (所有电台)
|
|
245
|
+
* 私人FM(上瘾电台、听见不同),时序电台,分类电台,乐游播客,YOU乐电台
|
|
246
|
+
* @param pacmtoken 可选-登录凭证,用于获取所有电台
|
|
247
|
+
* @returns
|
|
248
|
+
*/
|
|
249
|
+
declare const getRadioRecommendAll: (pacmtoken?: string) => Promise<any>;
|
|
250
|
+
|
|
224
251
|
/**
|
|
225
252
|
* modules 子目录统一入口
|
|
226
253
|
* 汇总导出所有 API 函数
|
|
@@ -232,13 +259,18 @@ declare const api_checkToken: typeof checkToken;
|
|
|
232
259
|
declare const api_getAlbumInfo: typeof getAlbumInfo;
|
|
233
260
|
declare const api_getAlbumSong: typeof getAlbumSong;
|
|
234
261
|
declare const api_getComment: typeof getComment;
|
|
262
|
+
declare const api_getMVRecommend: typeof getMVRecommend;
|
|
235
263
|
declare const api_getMvHls: typeof getMvHls;
|
|
236
264
|
declare const api_getMvInfo: typeof getMvInfo;
|
|
265
|
+
declare const api_getNinanByDate: typeof getNinanByDate;
|
|
266
|
+
declare const api_getNinanSong: typeof getNinanSong;
|
|
237
267
|
declare const api_getOpNum: typeof getOpNum;
|
|
238
268
|
declare const api_getPacmToken: typeof getPacmToken;
|
|
239
269
|
declare const api_getPlaylistInfo: typeof getPlaylistInfo;
|
|
240
270
|
declare const api_getPlaylistSong: typeof getPlaylistSong;
|
|
271
|
+
declare const api_getPlaylistSquare: typeof getPlaylistSquare;
|
|
241
272
|
declare const api_getRadioRecommend: typeof getRadioRecommend;
|
|
273
|
+
declare const api_getRadioRecommendAll: typeof getRadioRecommendAll;
|
|
242
274
|
declare const api_getRankIndex: typeof getRankIndex;
|
|
243
275
|
declare const api_getRankInfo: typeof getRankInfo;
|
|
244
276
|
declare const api_getRecommendPlaylist: typeof getRecommendPlaylist;
|
|
@@ -265,10 +297,12 @@ declare const api_getUserMyList: typeof getUserMyList;
|
|
|
265
297
|
declare const api_getVersion: typeof getVersion;
|
|
266
298
|
declare const api_loginNP: typeof loginNP;
|
|
267
299
|
declare const api_loginOneClick: typeof loginOneClick;
|
|
300
|
+
declare const api_loginPhone: typeof loginPhone;
|
|
268
301
|
declare const api_loginSim: typeof loginSim;
|
|
269
302
|
declare const api_queryUserInfo: typeof queryUserInfo;
|
|
270
303
|
declare const api_searchAlbum: typeof searchAlbum;
|
|
271
304
|
declare const api_searchConcert: typeof searchConcert;
|
|
305
|
+
declare const api_searchLrc: typeof searchLrc;
|
|
272
306
|
declare const api_searchRbt: typeof searchRbt;
|
|
273
307
|
declare const api_searchSinger: typeof searchSinger;
|
|
274
308
|
declare const api_searchSong: typeof searchSong;
|
|
@@ -276,7 +310,36 @@ declare const api_searchSuggest: typeof searchSuggest;
|
|
|
276
310
|
declare const api_searchTicket: typeof searchTicket;
|
|
277
311
|
declare const api_searchVideo: typeof searchVideo;
|
|
278
312
|
declare namespace api {
|
|
279
|
-
export { api_YDRZ as YDRZ, api_checkCanListen as checkCanListen, api_checkToken as checkToken, api_getAlbumInfo as getAlbumInfo, api_getAlbumSong as getAlbumSong, api_getComment as getComment, api_getMvHls as getMvHls, api_getMvInfo as getMvInfo, api_getOpNum as getOpNum, api_getPacmToken as getPacmToken, api_getPlaylistInfo as getPlaylistInfo, api_getPlaylistSong as getPlaylistSong, api_getRadioRecommend as getRadioRecommend, api_getRankIndex as getRankIndex, api_getRankInfo as getRankInfo, api_getRecommendPlaylist as getRecommendPlaylist, api_getResourceInfo as getResourceInfo, api_getSceneRecommend as getSceneRecommend, api_getSearchDefault as getSearchDefault, api_getSearchHot as getSearchHot, api_getSearchSingerTab as getSearchSingerTab, api_getSearchSingerTabList as getSearchSingerTabList, api_getSimilarSongRecommend as getSimilarSongRecommend, api_getSingerAlbum as getSingerAlbum, api_getSingerIndex as getSingerIndex, api_getSingerSimilar as getSingerSimilar, api_getSingerSong as getSingerSong, api_getTicketInfo as getTicketInfo, api_getTodayRecommend as getTodayRecommend, api_getUrlH5V24 as getUrlH5V24, api_getUrlV1 as getUrlV1, api_getUrlV2 as getUrlV2, api_getUserBadge as getUserBadge, api_getUserCollect as getUserCollect, api_getUserHomePage as getUserHomePage, api_getUserMyList as getUserMyList, api_getVersion as getVersion, api_loginNP as loginNP, api_loginOneClick as loginOneClick, api_loginSim as loginSim, api_queryUserInfo as queryUserInfo, api_searchAlbum as searchAlbum, api_searchConcert as searchConcert, api_searchRbt as searchRbt, api_searchSinger as searchSinger, api_searchSong as searchSong, api_searchSuggest as searchSuggest, api_searchTicket as searchTicket, api_searchVideo as searchVideo };
|
|
313
|
+
export { api_YDRZ as YDRZ, api_checkCanListen as checkCanListen, api_checkToken as checkToken, api_getAlbumInfo as getAlbumInfo, api_getAlbumSong as getAlbumSong, api_getComment as getComment, api_getMVRecommend as getMVRecommend, api_getMvHls as getMvHls, api_getMvInfo as getMvInfo, api_getNinanByDate as getNinanByDate, api_getNinanSong as getNinanSong, api_getOpNum as getOpNum, api_getPacmToken as getPacmToken, api_getPlaylistInfo as getPlaylistInfo, api_getPlaylistSong as getPlaylistSong, api_getPlaylistSquare as getPlaylistSquare, api_getRadioRecommend as getRadioRecommend, api_getRadioRecommendAll as getRadioRecommendAll, api_getRankIndex as getRankIndex, api_getRankInfo as getRankInfo, api_getRecommendPlaylist as getRecommendPlaylist, api_getResourceInfo as getResourceInfo, api_getSceneRecommend as getSceneRecommend, api_getSearchDefault as getSearchDefault, api_getSearchHot as getSearchHot, api_getSearchSingerTab as getSearchSingerTab, api_getSearchSingerTabList as getSearchSingerTabList, api_getSimilarSongRecommend as getSimilarSongRecommend, api_getSingerAlbum as getSingerAlbum, api_getSingerIndex as getSingerIndex, api_getSingerSimilar as getSingerSimilar, api_getSingerSong as getSingerSong, api_getTicketInfo as getTicketInfo, api_getTodayRecommend as getTodayRecommend, api_getUrlH5V24 as getUrlH5V24, api_getUrlV1 as getUrlV1, api_getUrlV2 as getUrlV2, api_getUserBadge as getUserBadge, api_getUserCollect as getUserCollect, api_getUserHomePage as getUserHomePage, api_getUserMyList as getUserMyList, api_getVersion as getVersion, api_loginNP as loginNP, api_loginOneClick as loginOneClick, api_loginPhone as loginPhone, api_loginSim as loginSim, api_queryUserInfo as queryUserInfo, api_searchAlbum as searchAlbum, api_searchConcert as searchConcert, api_searchLrc as searchLrc, api_searchRbt as searchRbt, api_searchSinger as searchSinger, api_searchSong as searchSong, api_searchSuggest as searchSuggest, api_searchTicket as searchTicket, api_searchVideo as searchVideo };
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
declare const ua: string[];
|
|
317
|
+
declare const randomUA: () => string;
|
|
318
|
+
|
|
319
|
+
declare function getDeviceId(a?: number, b?: number): string;
|
|
320
|
+
|
|
321
|
+
declare const getPublicKey: () => Promise<{
|
|
322
|
+
publicExponent: string;
|
|
323
|
+
modulus: string;
|
|
324
|
+
} | undefined>;
|
|
325
|
+
|
|
326
|
+
declare class RSAKey {
|
|
327
|
+
private publicKey;
|
|
328
|
+
setPublic(modulus: string, exponent: string): void;
|
|
329
|
+
encrypt(text: string): string | null;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
declare function URLParams($: object | string): string;
|
|
333
|
+
|
|
334
|
+
type index_RSAKey = RSAKey;
|
|
335
|
+
declare const index_RSAKey: typeof RSAKey;
|
|
336
|
+
declare const index_URLParams: typeof URLParams;
|
|
337
|
+
declare const index_getDeviceId: typeof getDeviceId;
|
|
338
|
+
declare const index_getPublicKey: typeof getPublicKey;
|
|
339
|
+
declare const index_randomUA: typeof randomUA;
|
|
340
|
+
declare const index_ua: typeof ua;
|
|
341
|
+
declare namespace index {
|
|
342
|
+
export { index_RSAKey as RSAKey, index_URLParams as URLParams, index_getDeviceId as getDeviceId, index_getPublicKey as getPublicKey, index_randomUA as randomUA, index_ua as ua };
|
|
280
343
|
}
|
|
281
344
|
|
|
282
345
|
/**
|
|
@@ -293,4 +356,4 @@ declare function createClient(): typeof api;
|
|
|
293
356
|
/** 客户端类型 */
|
|
294
357
|
type MiguClient = ReturnType<typeof createClient>;
|
|
295
358
|
|
|
296
|
-
export { type MiguClient, YDRZ, checkCanListen, checkToken, createClient, getAlbumInfo, getAlbumSong, getComment, getMvHls, getMvInfo, getOpNum, getPacmToken, getPlaylistInfo, getPlaylistSong, getRadioRecommend, getRankIndex, getRankInfo, getRecommendPlaylist, getResourceInfo, getSceneRecommend, getSearchDefault, getSearchHot, getSearchSingerTab, getSearchSingerTabList, getSimilarSongRecommend, getSingerAlbum, getSingerIndex, getSingerSimilar, getSingerSong, getTicketInfo, getTodayRecommend, getUrlH5V24, getUrlV1, getUrlV2, getUserBadge, getUserCollect, getUserHomePage, getUserMyList, getVersion, loginNP, loginOneClick, loginSim, api as modules, queryUserInfo, searchAlbum, searchConcert, searchRbt, searchSinger, searchSong, searchSuggest, searchTicket, searchVideo };
|
|
359
|
+
export { type MiguClient, index as MiguUtils, RSAKey, URLParams, YDRZ, checkCanListen, checkToken, createClient, getAlbumInfo, getAlbumSong, getComment, getDeviceId, getMVRecommend, getMvHls, getMvInfo, getNinanByDate, getNinanSong, getOpNum, getPacmToken, getPlaylistInfo, getPlaylistSong, getPlaylistSquare, getPublicKey, getRadioRecommend, getRadioRecommendAll, getRankIndex, getRankInfo, getRecommendPlaylist, getResourceInfo, getSceneRecommend, getSearchDefault, getSearchHot, getSearchSingerTab, getSearchSingerTabList, getSimilarSongRecommend, getSingerAlbum, getSingerIndex, getSingerSimilar, getSingerSong, getTicketInfo, getTodayRecommend, getUrlH5V24, getUrlV1, getUrlV2, getUserBadge, getUserCollect, getUserHomePage, getUserMyList, getVersion, loginNP, loginOneClick, loginPhone, loginSim, api as modules, queryUserInfo, randomUA, searchAlbum, searchConcert, searchLrc, searchRbt, searchSinger, searchSong, searchSuggest, searchTicket, searchVideo, ua };
|
package/dist/index.js
CHANGED
|
@@ -13,13 +13,18 @@ __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,
|
|
19
|
+
getNinanByDate: () => getNinanByDate,
|
|
20
|
+
getNinanSong: () => getNinanSong,
|
|
18
21
|
getOpNum: () => getOpNum,
|
|
19
22
|
getPacmToken: () => getPacmToken,
|
|
20
23
|
getPlaylistInfo: () => getPlaylistInfo,
|
|
21
24
|
getPlaylistSong: () => getPlaylistSong,
|
|
25
|
+
getPlaylistSquare: () => getPlaylistSquare,
|
|
22
26
|
getRadioRecommend: () => getRadioRecommend,
|
|
27
|
+
getRadioRecommendAll: () => getRadioRecommendAll,
|
|
23
28
|
getRankIndex: () => getRankIndex,
|
|
24
29
|
getRankInfo: () => getRankInfo,
|
|
25
30
|
getRecommendPlaylist: () => getRecommendPlaylist,
|
|
@@ -46,10 +51,12 @@ __export(modules_exports, {
|
|
|
46
51
|
getVersion: () => getVersion,
|
|
47
52
|
loginNP: () => loginNP,
|
|
48
53
|
loginOneClick: () => loginOneClick,
|
|
54
|
+
loginPhone: () => loginPhone,
|
|
49
55
|
loginSim: () => loginSim,
|
|
50
56
|
queryUserInfo: () => queryUserInfo,
|
|
51
57
|
searchAlbum: () => searchAlbum,
|
|
52
58
|
searchConcert: () => searchConcert,
|
|
59
|
+
searchLrc: () => searchLrc,
|
|
53
60
|
searchRbt: () => searchRbt,
|
|
54
61
|
searchSinger: () => searchSinger,
|
|
55
62
|
searchSong: () => searchSong,
|
|
@@ -285,7 +292,7 @@ var getUrlV1 = async (contentId, copyrightId, resourceType = "2") => {
|
|
|
285
292
|
};
|
|
286
293
|
|
|
287
294
|
// src/modules/url_v2.ts
|
|
288
|
-
var getUrlV2 = async (contentId, copyrightId, resourceType = "2", pacmtoken = "") => {
|
|
295
|
+
var getUrlV2 = async (contentId, copyrightId, toneFlag = "PQ", resourceType = "2", pacmtoken = "") => {
|
|
289
296
|
const deviceId = getDeviceId();
|
|
290
297
|
const timestamp = Date.now();
|
|
291
298
|
const headers = {
|
|
@@ -312,7 +319,7 @@ var getUrlV2 = async (contentId, copyrightId, resourceType = "2", pacmtoken = ""
|
|
|
312
319
|
"location-info": ""
|
|
313
320
|
};
|
|
314
321
|
const res = await fetch(
|
|
315
|
-
`https://app.c.nf.migu.cn/strategy/pc/listen/v2.0?contentId=${contentId}©rightId=${copyrightId}&scene=&netType=01&resourceType=${resourceType}&toneFlag
|
|
322
|
+
`https://app.c.nf.migu.cn/strategy/pc/listen/v2.0?contentId=${contentId}©rightId=${copyrightId}&scene=&netType=01&resourceType=${resourceType}&toneFlag=${toneFlag}`,
|
|
316
323
|
{
|
|
317
324
|
headers
|
|
318
325
|
}
|
|
@@ -357,7 +364,7 @@ async function decryptData(blob) {
|
|
|
357
364
|
}
|
|
358
365
|
|
|
359
366
|
// src/modules/url_h5v2.4.ts
|
|
360
|
-
var getUrlH5V24 = async (contentId, copyrightId, resourceType = "2") => {
|
|
367
|
+
var getUrlH5V24 = async (contentId, copyrightId, toneFlag = "PQ", resourceType = "2") => {
|
|
361
368
|
const headers = {
|
|
362
369
|
"birth": "h5page",
|
|
363
370
|
"channel": "014X031",
|
|
@@ -366,7 +373,7 @@ var getUrlH5V24 = async (contentId, copyrightId, resourceType = "2") => {
|
|
|
366
373
|
"location-info": ""
|
|
367
374
|
};
|
|
368
375
|
const res = await fetch(
|
|
369
|
-
`https://c.musicapp.migu.cn/strategy/listen-url/h5/v2.4?contentId=${contentId}©rightId=${copyrightId}&resourceType=${resourceType}&netType=01&toneFlag
|
|
376
|
+
`https://c.musicapp.migu.cn/strategy/listen-url/h5/v2.4?contentId=${contentId}©rightId=${copyrightId}&resourceType=${resourceType}&netType=01&toneFlag=${toneFlag}&scene=&lowerQualityContentId=${contentId}`,
|
|
370
377
|
{
|
|
371
378
|
headers
|
|
372
379
|
}
|
|
@@ -423,13 +430,13 @@ var decryptData2 = async (blob) => {
|
|
|
423
430
|
};
|
|
424
431
|
|
|
425
432
|
// src/modules/version.ts
|
|
426
|
-
var getVersion = async (channel = "0146921", version = "8.4.0",
|
|
433
|
+
var getVersion = async (channel = "0146921", version = "8.4.0", ua2 = "Android_migu") => {
|
|
427
434
|
return await h5fetch(
|
|
428
435
|
`http://app.c.nf.migu.cn/MIGUM2.0/resource/client/version/v1.0`,
|
|
429
436
|
{
|
|
430
437
|
headers: {
|
|
431
438
|
"channel": channel,
|
|
432
|
-
"ua":
|
|
439
|
+
"ua": ua2,
|
|
433
440
|
"version": version
|
|
434
441
|
}
|
|
435
442
|
}
|
|
@@ -437,8 +444,8 @@ var getVersion = async (channel = "0146921", version = "8.4.0", ua = "Android_mi
|
|
|
437
444
|
};
|
|
438
445
|
|
|
439
446
|
// 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=${
|
|
447
|
+
var getMvInfo = async (mvContentId) => {
|
|
448
|
+
return await h5fetch(`https://c.musicapp.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?resourceId=${mvContentId}&resourceType=D&needSimple=01`);
|
|
442
449
|
};
|
|
443
450
|
|
|
444
451
|
// src/modules/mv_hls.ts
|
|
@@ -500,7 +507,6 @@ var RSAKey = class {
|
|
|
500
507
|
}
|
|
501
508
|
}
|
|
502
509
|
};
|
|
503
|
-
var rsalib_default = { RSAKey };
|
|
504
510
|
|
|
505
511
|
// src/utils/publicKey.ts
|
|
506
512
|
var getPublicKey = async () => {
|
|
@@ -527,7 +533,6 @@ function URLParams($) {
|
|
|
527
533
|
}
|
|
528
534
|
|
|
529
535
|
// src/modules/login_np.ts
|
|
530
|
-
var RSAKey2 = rsalib_default.RSAKey;
|
|
531
536
|
function randomString() {
|
|
532
537
|
const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
|
533
538
|
return random.toLowerCase();
|
|
@@ -557,7 +562,7 @@ var loginNP = {
|
|
|
557
562
|
if (!modulus || !publicExponent) {
|
|
558
563
|
return { error: "\u83B7\u53D6\u516C\u94A5\u5931\u8D25" };
|
|
559
564
|
}
|
|
560
|
-
var rsa = new
|
|
565
|
+
var rsa = new RSAKey();
|
|
561
566
|
rsa.setPublic(modulus, publicExponent);
|
|
562
567
|
const rsa_pwd = rsa.encrypt(password);
|
|
563
568
|
const rsa_username = rsa.encrypt(username);
|
|
@@ -572,7 +577,10 @@ var loginNP = {
|
|
|
572
577
|
{
|
|
573
578
|
method: "POST",
|
|
574
579
|
headers: {
|
|
575
|
-
"Host": "passport.migu.cn"
|
|
580
|
+
"Host": "passport.migu.cn",
|
|
581
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
582
|
+
"Referer": "https://passport.migu.cn/login",
|
|
583
|
+
"Origin": "https://passport.migu.cn"
|
|
576
584
|
},
|
|
577
585
|
body: form
|
|
578
586
|
}
|
|
@@ -721,7 +729,6 @@ var getTodayRecommend = async (pacmtoken) => {
|
|
|
721
729
|
};
|
|
722
730
|
|
|
723
731
|
// src/modules/login_sim.ts
|
|
724
|
-
var RSAKey3 = rsalib_default.RSAKey;
|
|
725
732
|
function randomString2() {
|
|
726
733
|
const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
|
727
734
|
return random.toLowerCase();
|
|
@@ -744,7 +751,7 @@ var loginSim = {
|
|
|
744
751
|
if (!modulus || !publicExponent) {
|
|
745
752
|
return { error: "\u83B7\u53D6\u516C\u94A5\u5931\u8D25" };
|
|
746
753
|
}
|
|
747
|
-
const rsa = new
|
|
754
|
+
const rsa = new RSAKey();
|
|
748
755
|
rsa.setPublic(modulus, publicExponent);
|
|
749
756
|
const encPhone = rsa.encrypt(phone);
|
|
750
757
|
const fakeFingerprint = randomString2();
|
|
@@ -757,8 +764,10 @@ var loginSim = {
|
|
|
757
764
|
{
|
|
758
765
|
method: "POST",
|
|
759
766
|
headers: {
|
|
760
|
-
|
|
761
|
-
"
|
|
767
|
+
"Host": "passport.migu.cn",
|
|
768
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
769
|
+
"Referer": "https://passport.migu.cn/login",
|
|
770
|
+
"Origin": "https://passport.migu.cn"
|
|
762
771
|
},
|
|
763
772
|
body: form
|
|
764
773
|
}
|
|
@@ -787,7 +796,12 @@ var loginSim = {
|
|
|
787
796
|
`https://passport.migu.cn/api/simauth/query`,
|
|
788
797
|
{
|
|
789
798
|
method: "POST",
|
|
790
|
-
headers: {
|
|
799
|
+
headers: {
|
|
800
|
+
"Host": "passport.migu.cn",
|
|
801
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
802
|
+
"Referer": "https://passport.migu.cn/login",
|
|
803
|
+
"Origin": "https://passport.migu.cn"
|
|
804
|
+
},
|
|
791
805
|
body: form
|
|
792
806
|
}
|
|
793
807
|
);
|
|
@@ -895,9 +909,9 @@ var YDRZ = {
|
|
|
895
909
|
return Math.floor(Math.random() * (min - max) + max);
|
|
896
910
|
},
|
|
897
911
|
getUA() {
|
|
898
|
-
const
|
|
912
|
+
const ua2 = nav.userAgent, l = [
|
|
899
913
|
nav.platform,
|
|
900
|
-
|
|
914
|
+
ua2,
|
|
901
915
|
nav.appVersion,
|
|
902
916
|
nav.cookieEnabled,
|
|
903
917
|
void 0,
|
|
@@ -908,7 +922,7 @@ var YDRZ = {
|
|
|
908
922
|
nav.availHeight,
|
|
909
923
|
nav.colorDepth,
|
|
910
924
|
nav.timezoneOffset
|
|
911
|
-
], key = l.join("@@"), finalUA =
|
|
925
|
+
], key = l.join("@@"), finalUA = ua2.length > 100 ? ua2.substring(0, 100) : ua2;
|
|
912
926
|
return nav.platform + "@@" + finalUA + "@@" + md5(key);
|
|
913
927
|
},
|
|
914
928
|
uaE(str) {
|
|
@@ -1047,11 +1061,164 @@ var loginOneClick = {
|
|
|
1047
1061
|
authn
|
|
1048
1062
|
};
|
|
1049
1063
|
|
|
1064
|
+
// src/modules/login_phone.ts
|
|
1065
|
+
function randomString3() {
|
|
1066
|
+
const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
|
1067
|
+
return random.toLowerCase();
|
|
1068
|
+
}
|
|
1069
|
+
var loginPhone = {
|
|
1070
|
+
//获取验证码
|
|
1071
|
+
async getMsgCode(phone) {
|
|
1072
|
+
var $ = {
|
|
1073
|
+
"isAsync": true,
|
|
1074
|
+
"msisdn": "",
|
|
1075
|
+
"captcha": "",
|
|
1076
|
+
"sourceID": "220029",
|
|
1077
|
+
"imgcodeType": "2",
|
|
1078
|
+
"fingerPrint": "",
|
|
1079
|
+
"fingerPrintDetail": "",
|
|
1080
|
+
"_": ""
|
|
1081
|
+
};
|
|
1082
|
+
const result = await getPublicKey();
|
|
1083
|
+
const { publicExponent = "", modulus = "" } = result;
|
|
1084
|
+
var c = new RSAKey();
|
|
1085
|
+
c.setPublic(modulus, publicExponent);
|
|
1086
|
+
$.msisdn = c.encrypt(phone) || "";
|
|
1087
|
+
if (!$.msisdn) return { error: "encrypt error" };
|
|
1088
|
+
const fakeFingerprint = randomString3();
|
|
1089
|
+
$.fingerPrint = fakeFingerprint;
|
|
1090
|
+
$.fingerPrintDetail = fakeFingerprint;
|
|
1091
|
+
$._ = (/* @__PURE__ */ new Date()).getTime().toString();
|
|
1092
|
+
const query = URLParams($);
|
|
1093
|
+
const res = await fetch(
|
|
1094
|
+
`https://passport.migu.cn/login/dynamicpassword?${query}`,
|
|
1095
|
+
{
|
|
1096
|
+
method: "GET",
|
|
1097
|
+
headers: {
|
|
1098
|
+
"Host": "passport.migu.cn",
|
|
1099
|
+
"Referer": "https://passport.migu.cn/login",
|
|
1100
|
+
"Origin": "https://passport.migu.cn"
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
);
|
|
1104
|
+
if (!res.ok) return { error: "gmc e" };
|
|
1105
|
+
const data = await res.json();
|
|
1106
|
+
return data;
|
|
1107
|
+
},
|
|
1108
|
+
//登陆
|
|
1109
|
+
async authn(phone, msgCode) {
|
|
1110
|
+
var $ = {
|
|
1111
|
+
"isAsync": true,
|
|
1112
|
+
"msisdn": "",
|
|
1113
|
+
"dynamicPassword": "",
|
|
1114
|
+
"captcha": "",
|
|
1115
|
+
"appType": "",
|
|
1116
|
+
"securityCode": "7619",
|
|
1117
|
+
"sourceID": "220029",
|
|
1118
|
+
"imgcodeType": "2",
|
|
1119
|
+
"fingerPrint": "",
|
|
1120
|
+
"fingerPrintDetail": ""
|
|
1121
|
+
};
|
|
1122
|
+
const result = await getPublicKey();
|
|
1123
|
+
const { publicExponent = "", modulus = "" } = result;
|
|
1124
|
+
var c = new RSAKey();
|
|
1125
|
+
c.setPublic(modulus, publicExponent);
|
|
1126
|
+
$.msisdn = c.encrypt(phone) || "";
|
|
1127
|
+
$.dynamicPassword = c.encrypt(msgCode) || "";
|
|
1128
|
+
if (!$.msisdn || !$.dynamicPassword) return { error: "encrypt error" };
|
|
1129
|
+
const fakeFingerprint = randomString3();
|
|
1130
|
+
$.fingerPrint = fakeFingerprint;
|
|
1131
|
+
$.fingerPrintDetail = fakeFingerprint;
|
|
1132
|
+
const form = URLParams($);
|
|
1133
|
+
const res = await fetch(
|
|
1134
|
+
`https://passport.migu.cn/authn/dynamicpassword`,
|
|
1135
|
+
{
|
|
1136
|
+
method: "POST",
|
|
1137
|
+
headers: {
|
|
1138
|
+
"Host": "passport.migu.cn",
|
|
1139
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
1140
|
+
"Referer": "https://passport.migu.cn/login",
|
|
1141
|
+
"Origin": "https://passport.migu.cn"
|
|
1142
|
+
},
|
|
1143
|
+
body: form
|
|
1144
|
+
}
|
|
1145
|
+
);
|
|
1146
|
+
if (!res.ok) return { error: "gmc e" };
|
|
1147
|
+
const data = await res.json();
|
|
1148
|
+
return data;
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
1151
|
+
|
|
1152
|
+
// src/modules/mv_recommend.ts
|
|
1153
|
+
var getMVRecommend = async (mvContentId, page = 1) => {
|
|
1154
|
+
return await h5fetch(`https://c.musicapp.migu.cn/MIGUM3.0/v3.0/content/recommend-mv?resourceId=${mvContentId}&pageNumber=${page}&resourceType=D`);
|
|
1155
|
+
};
|
|
1156
|
+
|
|
1157
|
+
// src/modules/playlist_square.ts
|
|
1158
|
+
var getPlaylistSquare = async () => {
|
|
1159
|
+
return await h5fetch(`https://app.c.nf.migu.cn/pc/bmw/page-data/playlist-square-recommend/v1.0?templateVersion=2`);
|
|
1160
|
+
};
|
|
1161
|
+
|
|
1162
|
+
// src/modules/search_lrc.ts
|
|
1163
|
+
var searchLrc = async (text, page = 1) => {
|
|
1164
|
+
return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/lrc/v1.0?pageNo=${page}&text=${text}`);
|
|
1165
|
+
};
|
|
1166
|
+
|
|
1167
|
+
// src/modules/ninan_song.ts
|
|
1168
|
+
var getNinanSong = async () => {
|
|
1169
|
+
return await h5fetch(`https://c.musicapp.migu.cn/MIGUM2.0/column/ninan/song-list/v1.0`);
|
|
1170
|
+
};
|
|
1171
|
+
|
|
1172
|
+
// src/modules/ninan_date.ts
|
|
1173
|
+
var getNinanByDate = async (date) => {
|
|
1174
|
+
return await h5fetch(`https://c.musicapp.migu.cn/MIGUM2.0/v2.0/content/getNinanByDate.do?columnTitle=${date}`);
|
|
1175
|
+
};
|
|
1176
|
+
|
|
1177
|
+
// src/modules/recommend_radio_all.ts
|
|
1178
|
+
var getRadioRecommendAll = async (pacmtoken = "") => {
|
|
1179
|
+
return await h5fetch(
|
|
1180
|
+
`https://app.c.nf.migu.cn/pc/bmw/page-data/music-radio/v1.0?templateVersion=1`,
|
|
1181
|
+
{
|
|
1182
|
+
method: "GET",
|
|
1183
|
+
headers: {
|
|
1184
|
+
"Cookie": `pacmtoken=${pacmtoken}`
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
);
|
|
1188
|
+
};
|
|
1189
|
+
|
|
1190
|
+
// src/utils/index.ts
|
|
1191
|
+
var utils_exports = {};
|
|
1192
|
+
__export(utils_exports, {
|
|
1193
|
+
RSAKey: () => RSAKey,
|
|
1194
|
+
URLParams: () => URLParams,
|
|
1195
|
+
getDeviceId: () => getDeviceId,
|
|
1196
|
+
getPublicKey: () => getPublicKey,
|
|
1197
|
+
randomUA: () => randomUA,
|
|
1198
|
+
ua: () => ua
|
|
1199
|
+
});
|
|
1200
|
+
|
|
1201
|
+
// src/utils/ua.ts
|
|
1202
|
+
var ua = [
|
|
1203
|
+
"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",
|
|
1204
|
+
"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",
|
|
1205
|
+
"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",
|
|
1206
|
+
"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 ",
|
|
1207
|
+
"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"
|
|
1208
|
+
];
|
|
1209
|
+
var randomUA = () => {
|
|
1210
|
+
const i = Math.floor(Math.random() * 5);
|
|
1211
|
+
return ua[i];
|
|
1212
|
+
};
|
|
1213
|
+
|
|
1050
1214
|
// src/index.ts
|
|
1051
1215
|
function createClient() {
|
|
1052
1216
|
return modules_exports;
|
|
1053
1217
|
}
|
|
1054
1218
|
export {
|
|
1219
|
+
utils_exports as MiguUtils,
|
|
1220
|
+
RSAKey,
|
|
1221
|
+
URLParams,
|
|
1055
1222
|
YDRZ,
|
|
1056
1223
|
checkCanListen,
|
|
1057
1224
|
checkToken,
|
|
@@ -1059,13 +1226,20 @@ export {
|
|
|
1059
1226
|
getAlbumInfo,
|
|
1060
1227
|
getAlbumSong,
|
|
1061
1228
|
getComment,
|
|
1229
|
+
getDeviceId,
|
|
1230
|
+
getMVRecommend,
|
|
1062
1231
|
getMvHls,
|
|
1063
1232
|
getMvInfo,
|
|
1233
|
+
getNinanByDate,
|
|
1234
|
+
getNinanSong,
|
|
1064
1235
|
getOpNum,
|
|
1065
1236
|
getPacmToken,
|
|
1066
1237
|
getPlaylistInfo,
|
|
1067
1238
|
getPlaylistSong,
|
|
1239
|
+
getPlaylistSquare,
|
|
1240
|
+
getPublicKey,
|
|
1068
1241
|
getRadioRecommend,
|
|
1242
|
+
getRadioRecommendAll,
|
|
1069
1243
|
getRankIndex,
|
|
1070
1244
|
getRankInfo,
|
|
1071
1245
|
getRecommendPlaylist,
|
|
@@ -1092,16 +1266,20 @@ export {
|
|
|
1092
1266
|
getVersion,
|
|
1093
1267
|
loginNP,
|
|
1094
1268
|
loginOneClick,
|
|
1269
|
+
loginPhone,
|
|
1095
1270
|
loginSim,
|
|
1096
1271
|
modules_exports as modules,
|
|
1097
1272
|
queryUserInfo,
|
|
1273
|
+
randomUA,
|
|
1098
1274
|
searchAlbum,
|
|
1099
1275
|
searchConcert,
|
|
1276
|
+
searchLrc,
|
|
1100
1277
|
searchRbt,
|
|
1101
1278
|
searchSinger,
|
|
1102
1279
|
searchSong,
|
|
1103
1280
|
searchSuggest,
|
|
1104
1281
|
searchTicket,
|
|
1105
|
-
searchVideo
|
|
1282
|
+
searchVideo,
|
|
1283
|
+
ua
|
|
1106
1284
|
};
|
|
1107
1285
|
//# sourceMappingURL=index.js.map
|