migu-api-enhanced 1.2.1 → 1.2.2
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 +25 -5
- package/dist/index.cjs +639 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -4
- package/dist/index.d.ts +30 -4
- package/dist/index.js +623 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,17 +17,29 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
21
31
|
var index_exports = {};
|
|
22
32
|
__export(index_exports, {
|
|
23
33
|
checkCanListen: () => checkCanListen,
|
|
34
|
+
checkToken: () => checkToken,
|
|
24
35
|
createClient: () => createClient,
|
|
25
36
|
getAlbumInfo: () => getAlbumInfo,
|
|
26
37
|
getAlbumSong: () => getAlbumSong,
|
|
27
38
|
getComment: () => getComment,
|
|
39
|
+
getMvHls: () => getMvHls,
|
|
40
|
+
getMvInfo: () => getMvInfo,
|
|
28
41
|
getOpNum: () => getOpNum,
|
|
42
|
+
getPacmToken: () => getPacmToken,
|
|
29
43
|
getPlaylistInfo: () => getPlaylistInfo,
|
|
30
44
|
getPlaylistSong: () => getPlaylistSong,
|
|
31
45
|
getRankIndex: () => getRankIndex,
|
|
@@ -40,10 +54,12 @@ __export(index_exports, {
|
|
|
40
54
|
getSingerAlbum: () => getSingerAlbum,
|
|
41
55
|
getSingerIndex: () => getSingerIndex,
|
|
42
56
|
getSingerSong: () => getSingerSong,
|
|
57
|
+
getTicketInfo: () => getTicketInfo,
|
|
43
58
|
getUrlH5V24: () => getUrlH5V24,
|
|
44
59
|
getUrlV1: () => getUrlV1,
|
|
45
60
|
getUrlV2: () => getUrlV2,
|
|
46
61
|
getVersion: () => getVersion,
|
|
62
|
+
loginNP: () => loginNP,
|
|
47
63
|
modules: () => modules_exports,
|
|
48
64
|
searchAlbum: () => searchAlbum,
|
|
49
65
|
searchConcert: () => searchConcert,
|
|
@@ -60,10 +76,14 @@ module.exports = __toCommonJS(index_exports);
|
|
|
60
76
|
var modules_exports = {};
|
|
61
77
|
__export(modules_exports, {
|
|
62
78
|
checkCanListen: () => checkCanListen,
|
|
79
|
+
checkToken: () => checkToken,
|
|
63
80
|
getAlbumInfo: () => getAlbumInfo,
|
|
64
81
|
getAlbumSong: () => getAlbumSong,
|
|
65
82
|
getComment: () => getComment,
|
|
83
|
+
getMvHls: () => getMvHls,
|
|
84
|
+
getMvInfo: () => getMvInfo,
|
|
66
85
|
getOpNum: () => getOpNum,
|
|
86
|
+
getPacmToken: () => getPacmToken,
|
|
67
87
|
getPlaylistInfo: () => getPlaylistInfo,
|
|
68
88
|
getPlaylistSong: () => getPlaylistSong,
|
|
69
89
|
getRankIndex: () => getRankIndex,
|
|
@@ -78,10 +98,12 @@ __export(modules_exports, {
|
|
|
78
98
|
getSingerAlbum: () => getSingerAlbum,
|
|
79
99
|
getSingerIndex: () => getSingerIndex,
|
|
80
100
|
getSingerSong: () => getSingerSong,
|
|
101
|
+
getTicketInfo: () => getTicketInfo,
|
|
81
102
|
getUrlH5V24: () => getUrlH5V24,
|
|
82
103
|
getUrlV1: () => getUrlV1,
|
|
83
104
|
getUrlV2: () => getUrlV2,
|
|
84
105
|
getVersion: () => getVersion,
|
|
106
|
+
loginNP: () => loginNP,
|
|
85
107
|
searchAlbum: () => searchAlbum,
|
|
86
108
|
searchConcert: () => searchConcert,
|
|
87
109
|
searchRbt: () => searchRbt,
|
|
@@ -230,8 +252,8 @@ var getRecommendSong = async (size = 20, scene = "TODAY_RECOMMEND") => {
|
|
|
230
252
|
};
|
|
231
253
|
|
|
232
254
|
// src/modules/comment.ts
|
|
233
|
-
var getComment = async (resourceId, resourceType = 2,
|
|
234
|
-
return await h5fetch(`https://
|
|
255
|
+
var getComment = async (resourceId, resourceType = 2, size = 20, hotCommentStart = 0) => {
|
|
256
|
+
return await h5fetch(`https://u.musicapp.migu.cn/MIGUM3.0/user/comment/stack/v1.0?resourceId=${resourceId}&resourceType=${resourceType}&pageSize=${size}&hotCommentStart=${hotCommentStart}&platformType=1&commentId=0&queryType=1`);
|
|
235
257
|
};
|
|
236
258
|
|
|
237
259
|
// src/modules/resourceinfo.ts
|
|
@@ -270,8 +292,15 @@ var getUrlV1 = async (contentId, copyrightId, resourceType = "2") => {
|
|
|
270
292
|
);
|
|
271
293
|
};
|
|
272
294
|
|
|
295
|
+
// src/utils/deviceID.ts
|
|
296
|
+
function getDeviceId() {
|
|
297
|
+
const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
|
298
|
+
const a = `${random.substring(0, 8)}-${random.substring(8, 12)}-${random.substring(12, 16)}-${random.substring(16, 20)}-${random.substring(20)}`;
|
|
299
|
+
return a.toUpperCase();
|
|
300
|
+
}
|
|
301
|
+
|
|
273
302
|
// src/modules/url_v2.ts
|
|
274
|
-
var getUrlV2 = async (contentId, copyrightId, resourceType = "2") => {
|
|
303
|
+
var getUrlV2 = async (contentId, copyrightId, resourceType = "2", pacmtoken = "") => {
|
|
275
304
|
const deviceId = getDeviceId();
|
|
276
305
|
const timestamp = Date.now();
|
|
277
306
|
const headers = {
|
|
@@ -281,7 +310,7 @@ var getUrlV2 = async (contentId, copyrightId, resourceType = "2") => {
|
|
|
281
310
|
"subchannel": "014X031",
|
|
282
311
|
"logId": "cfrom=&appId=h5",
|
|
283
312
|
"uid": "",
|
|
284
|
-
"pacmtoken":
|
|
313
|
+
"pacmtoken": pacmtoken,
|
|
285
314
|
"appId": "h5",
|
|
286
315
|
"platform": "H5",
|
|
287
316
|
"deviceId": deviceId,
|
|
@@ -308,11 +337,6 @@ var SECURE = "Jk8qzuePiJ1qE3mDYhLQ3T73DtDoAhLP";
|
|
|
308
337
|
var aw = 171;
|
|
309
338
|
var iw = 205;
|
|
310
339
|
var ow = 1;
|
|
311
|
-
function getDeviceId() {
|
|
312
|
-
const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
|
313
|
-
const a = `${random.substring(0, 8)}-${random.substring(8, 12)}-${random.substring(12, 16)}-${random.substring(16, 20)}-${random.substring(20)}`;
|
|
314
|
-
return a.toUpperCase();
|
|
315
|
-
}
|
|
316
340
|
function textEncode(e) {
|
|
317
341
|
return new TextEncoder().encode(e);
|
|
318
342
|
}
|
|
@@ -423,6 +447,606 @@ var getVersion = async (channel = "0146921", version = "8.4.0", ua = "Android_mi
|
|
|
423
447
|
);
|
|
424
448
|
};
|
|
425
449
|
|
|
450
|
+
// src/modules/mv_info.ts
|
|
451
|
+
var getMvInfo = async (mvIds, {
|
|
452
|
+
needAbsoluteUrl = false
|
|
453
|
+
}) => {
|
|
454
|
+
const res = await h5fetch(`https://c.musicapp.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?resourceId=${mvIds}&resourceType=D&needSimple=01`);
|
|
455
|
+
if (!res) return { error: "\u8BF7\u6C42\u5931\u8D25" };
|
|
456
|
+
if (res.error) return { error: res.error };
|
|
457
|
+
const resource = res.resource || [];
|
|
458
|
+
if (resource.length === 0) return { error: "resource\u4E0D\u5B58\u5728" };
|
|
459
|
+
if (needAbsoluteUrl) {
|
|
460
|
+
resource.forEach((item) => {
|
|
461
|
+
if (!item.rateFormats) return;
|
|
462
|
+
item.rateFormats.forEach((rateFormat) => {
|
|
463
|
+
if (!rateFormat.url) return;
|
|
464
|
+
if (!rateFormat.url.startsWith("http") && !rateFormat.url.startsWith("https")) {
|
|
465
|
+
if (rateFormat.url[0] === "/" && rateFormat.url[1] !== "/") {
|
|
466
|
+
rateFormat.absoluteUrl = `https://freevod.nf.migu.cn${rateFormat.url}`;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
});
|
|
471
|
+
res.resource = resource;
|
|
472
|
+
return res;
|
|
473
|
+
}
|
|
474
|
+
return res;
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
// src/modules/mv_hls.ts
|
|
478
|
+
var getMvHls = async (mvContentId, mvCopyrightId, url, size, format = "050012", needHttps = true) => {
|
|
479
|
+
size = size.toString();
|
|
480
|
+
url = encodeURIComponent(url);
|
|
481
|
+
return await h5fetch(
|
|
482
|
+
`https://c.musicapp.migu.cn/MIGUM2.0/v1.0/content/mvplayinfo.do?format=${format}&mvContentId=${mvContentId}&mvCopyrightId=${mvCopyrightId}&needHttps=${needHttps}&size=${size}&url=${url}`,
|
|
483
|
+
{
|
|
484
|
+
method: "GET",
|
|
485
|
+
headers: {
|
|
486
|
+
"Channel": "014021I"
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
);
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
// src/utils/rsalib.js
|
|
493
|
+
var import_crypto = __toESM(require("crypto"), 1);
|
|
494
|
+
var rsa;
|
|
495
|
+
globalThis.define = function(id, deps, factory) {
|
|
496
|
+
let req = () => ({});
|
|
497
|
+
let exp = {};
|
|
498
|
+
let mod = { exports: exp };
|
|
499
|
+
factory(req, exp, mod);
|
|
500
|
+
rsa = mod.exports;
|
|
501
|
+
};
|
|
502
|
+
globalThis.window = {};
|
|
503
|
+
Object.defineProperty(globalThis, "navigator", {
|
|
504
|
+
writable: true,
|
|
505
|
+
value: {
|
|
506
|
+
appName: "Netscape",
|
|
507
|
+
appVersion: "5.0 (Node.js)"
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
globalThis.window.navigator = globalThis.navigator;
|
|
511
|
+
globalThis.window.crypto = {
|
|
512
|
+
getRandomValues: function(arr) {
|
|
513
|
+
const bytes = import_crypto.default.randomBytes(arr.length);
|
|
514
|
+
for (let i = 0; i < arr.length; i++) {
|
|
515
|
+
arr[i] = bytes[i];
|
|
516
|
+
}
|
|
517
|
+
return arr;
|
|
518
|
+
},
|
|
519
|
+
random: function(len) {
|
|
520
|
+
const bytes = import_crypto.default.randomBytes(len);
|
|
521
|
+
return Array.from(bytes, (b) => String.fromCharCode(b)).join("");
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
define("lib/rsa/rsa", [], function(a, b, c) {
|
|
525
|
+
function d(a2, b2, c2) {
|
|
526
|
+
null != a2 && ("number" == typeof a2 ? this.fromNumber(a2, b2, c2) : null == b2 && "string" != typeof a2 ? this.fromString(a2, 256) : this.fromString(a2, b2));
|
|
527
|
+
}
|
|
528
|
+
function e() {
|
|
529
|
+
return new d(null);
|
|
530
|
+
}
|
|
531
|
+
function f(a2, b2, c2, d2, e2, f2) {
|
|
532
|
+
for (; --f2 >= 0; ) {
|
|
533
|
+
var g2 = b2 * this[a2++] + c2[d2] + e2;
|
|
534
|
+
e2 = Math.floor(g2 / 67108864), c2[d2++] = 67108863 & g2;
|
|
535
|
+
}
|
|
536
|
+
return e2;
|
|
537
|
+
}
|
|
538
|
+
function g(a2, b2, c2, d2, e2, f2) {
|
|
539
|
+
for (var g2 = 32767 & b2, h2 = b2 >> 15; --f2 >= 0; ) {
|
|
540
|
+
var i2 = 32767 & this[a2], j2 = this[a2++] >> 15, k2 = h2 * i2 + j2 * g2;
|
|
541
|
+
i2 = g2 * i2 + ((32767 & k2) << 15) + c2[d2] + (1073741823 & e2), e2 = (i2 >>> 30) + (k2 >>> 15) + h2 * j2 + (e2 >>> 30), c2[d2++] = 1073741823 & i2;
|
|
542
|
+
}
|
|
543
|
+
return e2;
|
|
544
|
+
}
|
|
545
|
+
function h(a2, b2, c2, d2, e2, f2) {
|
|
546
|
+
for (var g2 = 16383 & b2, h2 = b2 >> 14; --f2 >= 0; ) {
|
|
547
|
+
var i2 = 16383 & this[a2], j2 = this[a2++] >> 14, k2 = h2 * i2 + j2 * g2;
|
|
548
|
+
i2 = g2 * i2 + ((16383 & k2) << 14) + c2[d2] + e2, e2 = (i2 >> 28) + (k2 >> 14) + h2 * j2, c2[d2++] = 268435455 & i2;
|
|
549
|
+
}
|
|
550
|
+
return e2;
|
|
551
|
+
}
|
|
552
|
+
function i(a2) {
|
|
553
|
+
return nb.charAt(a2);
|
|
554
|
+
}
|
|
555
|
+
function j(a2, b2) {
|
|
556
|
+
var c2 = ob[a2.charCodeAt(b2)];
|
|
557
|
+
return null == c2 ? -1 : c2;
|
|
558
|
+
}
|
|
559
|
+
function k(a2) {
|
|
560
|
+
for (var b2 = this.t - 1; b2 >= 0; --b2)
|
|
561
|
+
a2[b2] = this[b2];
|
|
562
|
+
a2.t = this.t, a2.s = this.s;
|
|
563
|
+
}
|
|
564
|
+
function l(a2) {
|
|
565
|
+
this.t = 1, this.s = 0 > a2 ? -1 : 0, a2 > 0 ? this[0] = a2 : -1 > a2 ? this[0] = a2 + this.DV : this.t = 0;
|
|
566
|
+
}
|
|
567
|
+
function m(a2) {
|
|
568
|
+
var b2 = e();
|
|
569
|
+
return b2.fromInt(a2), b2;
|
|
570
|
+
}
|
|
571
|
+
function n(a2, b2) {
|
|
572
|
+
var c2;
|
|
573
|
+
if (16 == b2)
|
|
574
|
+
c2 = 4;
|
|
575
|
+
else if (8 == b2)
|
|
576
|
+
c2 = 3;
|
|
577
|
+
else if (256 == b2)
|
|
578
|
+
c2 = 8;
|
|
579
|
+
else if (2 == b2)
|
|
580
|
+
c2 = 1;
|
|
581
|
+
else if (32 == b2)
|
|
582
|
+
c2 = 5;
|
|
583
|
+
else {
|
|
584
|
+
if (4 != b2)
|
|
585
|
+
return void this.fromRadix(a2, b2);
|
|
586
|
+
c2 = 2;
|
|
587
|
+
}
|
|
588
|
+
this.t = 0, this.s = 0;
|
|
589
|
+
for (var e2 = a2.length, f2 = false, g2 = 0; --e2 >= 0; ) {
|
|
590
|
+
var h2 = 8 == c2 ? 255 & a2[e2] : j(a2, e2);
|
|
591
|
+
0 > h2 ? "-" == a2.charAt(e2) && (f2 = true) : (f2 = false, 0 == g2 ? this[this.t++] = h2 : g2 + c2 > this.DB ? (this[this.t - 1] |= (h2 & (1 << this.DB - g2) - 1) << g2, this[this.t++] = h2 >> this.DB - g2) : this[this.t - 1] |= h2 << g2, g2 += c2, g2 >= this.DB && (g2 -= this.DB));
|
|
592
|
+
}
|
|
593
|
+
8 == c2 && 0 != (128 & a2[0]) && (this.s = -1, g2 > 0 && (this[this.t - 1] |= (1 << this.DB - g2) - 1 << g2)), this.clamp(), f2 && d.ZERO.subTo(this, this);
|
|
594
|
+
}
|
|
595
|
+
function o() {
|
|
596
|
+
for (var a2 = this.s & this.DM; this.t > 0 && this[this.t - 1] == a2; )
|
|
597
|
+
--this.t;
|
|
598
|
+
}
|
|
599
|
+
function p(a2) {
|
|
600
|
+
if (this.s < 0)
|
|
601
|
+
return "-" + this.negate().toString(a2);
|
|
602
|
+
var b2;
|
|
603
|
+
if (16 == a2)
|
|
604
|
+
b2 = 4;
|
|
605
|
+
else if (8 == a2)
|
|
606
|
+
b2 = 3;
|
|
607
|
+
else if (2 == a2)
|
|
608
|
+
b2 = 1;
|
|
609
|
+
else if (32 == a2)
|
|
610
|
+
b2 = 5;
|
|
611
|
+
else {
|
|
612
|
+
if (4 != a2)
|
|
613
|
+
return this.toRadix(a2);
|
|
614
|
+
b2 = 2;
|
|
615
|
+
}
|
|
616
|
+
var c2, d2 = (1 << b2) - 1, e2 = false, f2 = "", g2 = this.t, h2 = this.DB - g2 * this.DB % b2;
|
|
617
|
+
if (g2-- > 0)
|
|
618
|
+
for (h2 < this.DB && (c2 = this[g2] >> h2) > 0 && (e2 = true, f2 = i(c2)); g2 >= 0; )
|
|
619
|
+
b2 > h2 ? (c2 = (this[g2] & (1 << h2) - 1) << b2 - h2, c2 |= this[--g2] >> (h2 += this.DB - b2)) : (c2 = this[g2] >> (h2 -= b2) & d2, 0 >= h2 && (h2 += this.DB, --g2)), c2 > 0 && (e2 = true), e2 && (f2 += i(c2));
|
|
620
|
+
return e2 ? f2 : "0";
|
|
621
|
+
}
|
|
622
|
+
function q() {
|
|
623
|
+
var a2 = e();
|
|
624
|
+
return d.ZERO.subTo(this, a2), a2;
|
|
625
|
+
}
|
|
626
|
+
function r() {
|
|
627
|
+
return this.s < 0 ? this.negate() : this;
|
|
628
|
+
}
|
|
629
|
+
function s(a2) {
|
|
630
|
+
var b2 = this.s - a2.s;
|
|
631
|
+
if (0 != b2)
|
|
632
|
+
return b2;
|
|
633
|
+
var c2 = this.t;
|
|
634
|
+
if (b2 = c2 - a2.t, 0 != b2)
|
|
635
|
+
return this.s < 0 ? -b2 : b2;
|
|
636
|
+
for (; --c2 >= 0; )
|
|
637
|
+
if (0 != (b2 = this[c2] - a2[c2]))
|
|
638
|
+
return b2;
|
|
639
|
+
return 0;
|
|
640
|
+
}
|
|
641
|
+
function t(a2) {
|
|
642
|
+
var b2, c2 = 1;
|
|
643
|
+
return 0 != (b2 = a2 >>> 16) && (a2 = b2, c2 += 16), 0 != (b2 = a2 >> 8) && (a2 = b2, c2 += 8), 0 != (b2 = a2 >> 4) && (a2 = b2, c2 += 4), 0 != (b2 = a2 >> 2) && (a2 = b2, c2 += 2), 0 != (b2 = a2 >> 1) && (a2 = b2, c2 += 1), c2;
|
|
644
|
+
}
|
|
645
|
+
function u() {
|
|
646
|
+
return this.t <= 0 ? 0 : this.DB * (this.t - 1) + t(this[this.t - 1] ^ this.s & this.DM);
|
|
647
|
+
}
|
|
648
|
+
function v(a2, b2) {
|
|
649
|
+
var c2;
|
|
650
|
+
for (c2 = this.t - 1; c2 >= 0; --c2)
|
|
651
|
+
b2[c2 + a2] = this[c2];
|
|
652
|
+
for (c2 = a2 - 1; c2 >= 0; --c2)
|
|
653
|
+
b2[c2] = 0;
|
|
654
|
+
b2.t = this.t + a2, b2.s = this.s;
|
|
655
|
+
}
|
|
656
|
+
function w(a2, b2) {
|
|
657
|
+
for (var c2 = a2; c2 < this.t; ++c2)
|
|
658
|
+
b2[c2 - a2] = this[c2];
|
|
659
|
+
b2.t = Math.max(this.t - a2, 0), b2.s = this.s;
|
|
660
|
+
}
|
|
661
|
+
function x(a2, b2) {
|
|
662
|
+
var c2, d2 = a2 % this.DB, e2 = this.DB - d2, f2 = (1 << e2) - 1, g2 = Math.floor(a2 / this.DB), h2 = this.s << d2 & this.DM;
|
|
663
|
+
for (c2 = this.t - 1; c2 >= 0; --c2)
|
|
664
|
+
b2[c2 + g2 + 1] = this[c2] >> e2 | h2, h2 = (this[c2] & f2) << d2;
|
|
665
|
+
for (c2 = g2 - 1; c2 >= 0; --c2)
|
|
666
|
+
b2[c2] = 0;
|
|
667
|
+
b2[g2] = h2, b2.t = this.t + g2 + 1, b2.s = this.s, b2.clamp();
|
|
668
|
+
}
|
|
669
|
+
function y(a2, b2) {
|
|
670
|
+
b2.s = this.s;
|
|
671
|
+
var c2 = Math.floor(a2 / this.DB);
|
|
672
|
+
if (c2 >= this.t)
|
|
673
|
+
return void (b2.t = 0);
|
|
674
|
+
var d2 = a2 % this.DB, e2 = this.DB - d2, f2 = (1 << d2) - 1;
|
|
675
|
+
b2[0] = this[c2] >> d2;
|
|
676
|
+
for (var g2 = c2 + 1; g2 < this.t; ++g2)
|
|
677
|
+
b2[g2 - c2 - 1] |= (this[g2] & f2) << e2, b2[g2 - c2] = this[g2] >> d2;
|
|
678
|
+
d2 > 0 && (b2[this.t - c2 - 1] |= (this.s & f2) << e2), b2.t = this.t - c2, b2.clamp();
|
|
679
|
+
}
|
|
680
|
+
function z(a2, b2) {
|
|
681
|
+
for (var c2 = 0, d2 = 0, e2 = Math.min(a2.t, this.t); e2 > c2; )
|
|
682
|
+
d2 += this[c2] - a2[c2], b2[c2++] = d2 & this.DM, d2 >>= this.DB;
|
|
683
|
+
if (a2.t < this.t) {
|
|
684
|
+
for (d2 -= a2.s; c2 < this.t; )
|
|
685
|
+
d2 += this[c2], b2[c2++] = d2 & this.DM, d2 >>= this.DB;
|
|
686
|
+
d2 += this.s;
|
|
687
|
+
} else {
|
|
688
|
+
for (d2 += this.s; c2 < a2.t; )
|
|
689
|
+
d2 -= a2[c2], b2[c2++] = d2 & this.DM, d2 >>= this.DB;
|
|
690
|
+
d2 -= a2.s;
|
|
691
|
+
}
|
|
692
|
+
b2.s = 0 > d2 ? -1 : 0, -1 > d2 ? b2[c2++] = this.DV + d2 : d2 > 0 && (b2[c2++] = d2), b2.t = c2, b2.clamp();
|
|
693
|
+
}
|
|
694
|
+
function A(a2, b2) {
|
|
695
|
+
var c2 = this.abs(), e2 = a2.abs(), f2 = c2.t;
|
|
696
|
+
for (b2.t = f2 + e2.t; --f2 >= 0; )
|
|
697
|
+
b2[f2] = 0;
|
|
698
|
+
for (f2 = 0; f2 < e2.t; ++f2)
|
|
699
|
+
b2[f2 + c2.t] = c2.am(0, e2[f2], b2, f2, 0, c2.t);
|
|
700
|
+
b2.s = 0, b2.clamp(), this.s != a2.s && d.ZERO.subTo(b2, b2);
|
|
701
|
+
}
|
|
702
|
+
function B(a2) {
|
|
703
|
+
for (var b2 = this.abs(), c2 = a2.t = 2 * b2.t; --c2 >= 0; )
|
|
704
|
+
a2[c2] = 0;
|
|
705
|
+
for (c2 = 0; c2 < b2.t - 1; ++c2) {
|
|
706
|
+
var d2 = b2.am(c2, b2[c2], a2, 2 * c2, 0, 1);
|
|
707
|
+
(a2[c2 + b2.t] += b2.am(c2 + 1, 2 * b2[c2], a2, 2 * c2 + 1, d2, b2.t - c2 - 1)) >= b2.DV && (a2[c2 + b2.t] -= b2.DV, a2[c2 + b2.t + 1] = 1);
|
|
708
|
+
}
|
|
709
|
+
a2.t > 0 && (a2[a2.t - 1] += b2.am(c2, b2[c2], a2, 2 * c2, 0, 1)), a2.s = 0, a2.clamp();
|
|
710
|
+
}
|
|
711
|
+
function C(a2, b2, c2) {
|
|
712
|
+
var f2 = a2.abs();
|
|
713
|
+
if (!(f2.t <= 0)) {
|
|
714
|
+
var g2 = this.abs();
|
|
715
|
+
if (g2.t < f2.t)
|
|
716
|
+
return null != b2 && b2.fromInt(0), void (null != c2 && this.copyTo(c2));
|
|
717
|
+
null == c2 && (c2 = e());
|
|
718
|
+
var h2 = e(), i2 = this.s, j2 = a2.s, k2 = this.DB - t(f2[f2.t - 1]);
|
|
719
|
+
k2 > 0 ? (f2.lShiftTo(k2, h2), g2.lShiftTo(k2, c2)) : (f2.copyTo(h2), g2.copyTo(c2));
|
|
720
|
+
var l2 = h2.t, m2 = h2[l2 - 1];
|
|
721
|
+
if (0 != m2) {
|
|
722
|
+
var n2 = m2 * (1 << this.F1) + (l2 > 1 ? h2[l2 - 2] >> this.F2 : 0), o2 = this.FV / n2, p2 = (1 << this.F1) / n2, q2 = 1 << this.F2, r2 = c2.t, s2 = r2 - l2, u2 = null == b2 ? e() : b2;
|
|
723
|
+
for (h2.dlShiftTo(s2, u2), c2.compareTo(u2) >= 0 && (c2[c2.t++] = 1, c2.subTo(u2, c2)), d.ONE.dlShiftTo(l2, u2), u2.subTo(h2, h2); h2.t < l2; )
|
|
724
|
+
h2[h2.t++] = 0;
|
|
725
|
+
for (; --s2 >= 0; ) {
|
|
726
|
+
var v2 = c2[--r2] == m2 ? this.DM : Math.floor(c2[r2] * o2 + (c2[r2 - 1] + q2) * p2);
|
|
727
|
+
if ((c2[r2] += h2.am(0, v2, c2, s2, 0, l2)) < v2)
|
|
728
|
+
for (h2.dlShiftTo(s2, u2), c2.subTo(u2, c2); c2[r2] < --v2; )
|
|
729
|
+
c2.subTo(u2, c2);
|
|
730
|
+
}
|
|
731
|
+
null != b2 && (c2.drShiftTo(l2, b2), i2 != j2 && d.ZERO.subTo(b2, b2)), c2.t = l2, c2.clamp(), k2 > 0 && c2.rShiftTo(k2, c2), 0 > i2 && d.ZERO.subTo(c2, c2);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
function D(a2) {
|
|
736
|
+
var b2 = e();
|
|
737
|
+
return this.abs().divRemTo(a2, null, b2), this.s < 0 && b2.compareTo(d.ZERO) > 0 && a2.subTo(b2, b2), b2;
|
|
738
|
+
}
|
|
739
|
+
function E(a2) {
|
|
740
|
+
this.m = a2;
|
|
741
|
+
}
|
|
742
|
+
function F(a2) {
|
|
743
|
+
return a2.s < 0 || a2.compareTo(this.m) >= 0 ? a2.mod(this.m) : a2;
|
|
744
|
+
}
|
|
745
|
+
function G(a2) {
|
|
746
|
+
return a2;
|
|
747
|
+
}
|
|
748
|
+
function H(a2) {
|
|
749
|
+
a2.divRemTo(this.m, null, a2);
|
|
750
|
+
}
|
|
751
|
+
function I(a2, b2, c2) {
|
|
752
|
+
a2.multiplyTo(b2, c2), this.reduce(c2);
|
|
753
|
+
}
|
|
754
|
+
function J(a2, b2) {
|
|
755
|
+
a2.squareTo(b2), this.reduce(b2);
|
|
756
|
+
}
|
|
757
|
+
function K() {
|
|
758
|
+
if (this.t < 1)
|
|
759
|
+
return 0;
|
|
760
|
+
var a2 = this[0];
|
|
761
|
+
if (0 == (1 & a2))
|
|
762
|
+
return 0;
|
|
763
|
+
var b2 = 3 & a2;
|
|
764
|
+
return b2 = b2 * (2 - (15 & a2) * b2) & 15, b2 = b2 * (2 - (255 & a2) * b2) & 255, b2 = b2 * (2 - ((65535 & a2) * b2 & 65535)) & 65535, b2 = b2 * (2 - a2 * b2 % this.DV) % this.DV, b2 > 0 ? this.DV - b2 : -b2;
|
|
765
|
+
}
|
|
766
|
+
function L(a2) {
|
|
767
|
+
this.m = a2, this.mp = a2.invDigit(), this.mpl = 32767 & this.mp, this.mph = this.mp >> 15, this.um = (1 << a2.DB - 15) - 1, this.mt2 = 2 * a2.t;
|
|
768
|
+
}
|
|
769
|
+
function M(a2) {
|
|
770
|
+
var b2 = e();
|
|
771
|
+
return a2.abs().dlShiftTo(this.m.t, b2), b2.divRemTo(this.m, null, b2), a2.s < 0 && b2.compareTo(d.ZERO) > 0 && this.m.subTo(b2, b2), b2;
|
|
772
|
+
}
|
|
773
|
+
function N(a2) {
|
|
774
|
+
var b2 = e();
|
|
775
|
+
return a2.copyTo(b2), this.reduce(b2), b2;
|
|
776
|
+
}
|
|
777
|
+
function O(a2) {
|
|
778
|
+
for (; a2.t <= this.mt2; )
|
|
779
|
+
a2[a2.t++] = 0;
|
|
780
|
+
for (var b2 = 0; b2 < this.m.t; ++b2) {
|
|
781
|
+
var c2 = 32767 & a2[b2], d2 = c2 * this.mpl + ((c2 * this.mph + (a2[b2] >> 15) * this.mpl & this.um) << 15) & a2.DM;
|
|
782
|
+
for (c2 = b2 + this.m.t, a2[c2] += this.m.am(0, d2, a2, b2, 0, this.m.t); a2[c2] >= a2.DV; )
|
|
783
|
+
a2[c2] -= a2.DV, a2[++c2]++;
|
|
784
|
+
}
|
|
785
|
+
a2.clamp(), a2.drShiftTo(this.m.t, a2), a2.compareTo(this.m) >= 0 && a2.subTo(this.m, a2);
|
|
786
|
+
}
|
|
787
|
+
function P(a2, b2) {
|
|
788
|
+
a2.squareTo(b2), this.reduce(b2);
|
|
789
|
+
}
|
|
790
|
+
function Q(a2, b2, c2) {
|
|
791
|
+
a2.multiplyTo(b2, c2), this.reduce(c2);
|
|
792
|
+
}
|
|
793
|
+
function R() {
|
|
794
|
+
return 0 == (this.t > 0 ? 1 & this[0] : this.s);
|
|
795
|
+
}
|
|
796
|
+
function S(a2, b2) {
|
|
797
|
+
if (a2 > 4294967295 || 1 > a2)
|
|
798
|
+
return d.ONE;
|
|
799
|
+
var c2 = e(), f2 = e(), g2 = b2.convert(this), h2 = t(a2) - 1;
|
|
800
|
+
for (g2.copyTo(c2); --h2 >= 0; )
|
|
801
|
+
if (b2.sqrTo(c2, f2), (a2 & 1 << h2) > 0)
|
|
802
|
+
b2.mulTo(f2, g2, c2);
|
|
803
|
+
else {
|
|
804
|
+
var i2 = c2;
|
|
805
|
+
c2 = f2, f2 = i2;
|
|
806
|
+
}
|
|
807
|
+
return b2.revert(c2);
|
|
808
|
+
}
|
|
809
|
+
function T(a2, b2) {
|
|
810
|
+
var c2;
|
|
811
|
+
return c2 = 256 > a2 || b2.isEven() ? new E(b2) : new L(b2), this.exp(a2, c2);
|
|
812
|
+
}
|
|
813
|
+
function U() {
|
|
814
|
+
this.i = 0, this.j = 0, this.S = new Array();
|
|
815
|
+
}
|
|
816
|
+
function V(a2) {
|
|
817
|
+
var b2, c2, d2;
|
|
818
|
+
for (b2 = 0; 256 > b2; ++b2)
|
|
819
|
+
this.S[b2] = b2;
|
|
820
|
+
for (c2 = 0, b2 = 0; 256 > b2; ++b2)
|
|
821
|
+
c2 = c2 + this.S[b2] + a2[b2 % a2.length] & 255, d2 = this.S[b2], this.S[b2] = this.S[c2], this.S[c2] = d2;
|
|
822
|
+
this.i = 0, this.j = 0;
|
|
823
|
+
}
|
|
824
|
+
function W() {
|
|
825
|
+
var a2;
|
|
826
|
+
return this.i = this.i + 1 & 255, this.j = this.j + this.S[this.i] & 255, a2 = this.S[this.i], this.S[this.i] = this.S[this.j], this.S[this.j] = a2, this.S[a2 + this.S[this.i] & 255];
|
|
827
|
+
}
|
|
828
|
+
function X() {
|
|
829
|
+
return new U();
|
|
830
|
+
}
|
|
831
|
+
function Y(a2) {
|
|
832
|
+
qb[rb++] ^= 255 & a2, qb[rb++] ^= a2 >> 8 & 255, qb[rb++] ^= a2 >> 16 & 255, qb[rb++] ^= a2 >> 24 & 255, rb >= sb && (rb -= sb);
|
|
833
|
+
}
|
|
834
|
+
function Z() {
|
|
835
|
+
Y((/* @__PURE__ */ new Date()).getTime());
|
|
836
|
+
}
|
|
837
|
+
function $() {
|
|
838
|
+
if (null == pb) {
|
|
839
|
+
for (Z(), pb = X(), pb.init(qb), rb = 0; rb < qb.length; ++rb)
|
|
840
|
+
qb[rb] = 0;
|
|
841
|
+
rb = 0;
|
|
842
|
+
}
|
|
843
|
+
return pb.next();
|
|
844
|
+
}
|
|
845
|
+
function _(a2) {
|
|
846
|
+
var b2;
|
|
847
|
+
for (b2 = 0; b2 < a2.length; ++b2)
|
|
848
|
+
a2[b2] = $();
|
|
849
|
+
}
|
|
850
|
+
function ab() {
|
|
851
|
+
}
|
|
852
|
+
function bb(a2, b2) {
|
|
853
|
+
return new d(a2, b2);
|
|
854
|
+
}
|
|
855
|
+
function cb(a2, b2) {
|
|
856
|
+
if (b2 < a2.length + 11)
|
|
857
|
+
return console.error("Message too long for RSA"), null;
|
|
858
|
+
for (var c2 = new Array(), e2 = a2.length - 1; e2 >= 0 && b2 > 0; ) {
|
|
859
|
+
var f2 = a2.charCodeAt(e2--);
|
|
860
|
+
128 > f2 ? c2[--b2] = f2 : f2 > 127 && 2048 > f2 ? (c2[--b2] = 63 & f2 | 128, c2[--b2] = f2 >> 6 | 192) : (c2[--b2] = 63 & f2 | 128, c2[--b2] = f2 >> 6 & 63 | 128, c2[--b2] = f2 >> 12 | 224);
|
|
861
|
+
}
|
|
862
|
+
c2[--b2] = 0;
|
|
863
|
+
for (var g2 = new ab(), h2 = new Array(); b2 > 2; ) {
|
|
864
|
+
for (h2[0] = 0; 0 == h2[0]; )
|
|
865
|
+
g2.nextBytes(h2);
|
|
866
|
+
c2[--b2] = h2[0];
|
|
867
|
+
}
|
|
868
|
+
return c2[--b2] = 2, c2[--b2] = 0, new d(c2);
|
|
869
|
+
}
|
|
870
|
+
function db() {
|
|
871
|
+
this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null, this.dmq1 = null, this.coeff = null;
|
|
872
|
+
}
|
|
873
|
+
function eb(a2, b2) {
|
|
874
|
+
null != a2 && null != b2 && a2.length > 0 && b2.length > 0 ? (this.n = bb(a2, 16), this.e = parseInt(b2, 16)) : console.error("net error");
|
|
875
|
+
}
|
|
876
|
+
function fb(a2) {
|
|
877
|
+
return a2.modPowInt(this.e, this.n);
|
|
878
|
+
}
|
|
879
|
+
function gb(a2) {
|
|
880
|
+
var b2 = cb(a2, this.n.bitLength() + 7 >> 3);
|
|
881
|
+
if (null == b2)
|
|
882
|
+
return null;
|
|
883
|
+
var c2 = this.doPublic(b2);
|
|
884
|
+
if (null == c2)
|
|
885
|
+
return null;
|
|
886
|
+
var d2 = c2.toString(16);
|
|
887
|
+
return 0 == (1 & d2.length) ? d2 : "0" + d2;
|
|
888
|
+
}
|
|
889
|
+
var hb, ib = 244837814094590, jb = 15715070 == (16777215 & ib);
|
|
890
|
+
jb && "Microsoft Internet Explorer" == navigator.appName ? (d.prototype.am = g, hb = 30) : jb && "Netscape" != navigator.appName ? (d.prototype.am = f, hb = 26) : (d.prototype.am = h, hb = 28), d.prototype.DB = hb, d.prototype.DM = (1 << hb) - 1, d.prototype.DV = 1 << hb;
|
|
891
|
+
var kb = 52;
|
|
892
|
+
d.prototype.FV = Math.pow(2, kb), d.prototype.F1 = kb - hb, d.prototype.F2 = 2 * hb - kb;
|
|
893
|
+
var lb, mb, nb = "0123456789abcdefghijklmnopqrstuvwxyz", ob = new Array();
|
|
894
|
+
for (lb = "0".charCodeAt(0), mb = 0; 9 >= mb; ++mb)
|
|
895
|
+
ob[lb++] = mb;
|
|
896
|
+
for (lb = "a".charCodeAt(0), mb = 10; 36 > mb; ++mb)
|
|
897
|
+
ob[lb++] = mb;
|
|
898
|
+
for (lb = "A".charCodeAt(0), mb = 10; 36 > mb; ++mb)
|
|
899
|
+
ob[lb++] = mb;
|
|
900
|
+
E.prototype.convert = F, E.prototype.revert = G, E.prototype.reduce = H, E.prototype.mulTo = I, E.prototype.sqrTo = J, L.prototype.convert = M, L.prototype.revert = N, L.prototype.reduce = O, L.prototype.mulTo = Q, L.prototype.sqrTo = P, d.prototype.copyTo = k, d.prototype.fromInt = l, d.prototype.fromString = n, d.prototype.clamp = o, d.prototype.dlShiftTo = v, d.prototype.drShiftTo = w, d.prototype.lShiftTo = x, d.prototype.rShiftTo = y, d.prototype.subTo = z, d.prototype.multiplyTo = A, d.prototype.squareTo = B, d.prototype.divRemTo = C, d.prototype.invDigit = K, d.prototype.isEven = R, d.prototype.exp = S, d.prototype.toString = p, d.prototype.negate = q, d.prototype.abs = r, d.prototype.compareTo = s, d.prototype.bitLength = u, d.prototype.mod = D, d.prototype.modPowInt = T, d.ZERO = m(0), d.ONE = m(1), U.prototype.init = V, U.prototype.next = W;
|
|
901
|
+
var pb, qb, rb, sb = 256;
|
|
902
|
+
if (null == qb) {
|
|
903
|
+
qb = new Array(), rb = 0;
|
|
904
|
+
var tb;
|
|
905
|
+
if (window.crypto && window.crypto.getRandomValues) {
|
|
906
|
+
var ub = new Uint8Array(32);
|
|
907
|
+
for (window.crypto.getRandomValues(ub), tb = 0; 32 > tb; ++tb)
|
|
908
|
+
qb[rb++] = ub[tb];
|
|
909
|
+
}
|
|
910
|
+
if ("Netscape" == navigator.appName && navigator.appVersion < "5" && window.crypto) {
|
|
911
|
+
var vb = window.crypto.random(32);
|
|
912
|
+
for (tb = 0; tb < vb.length; ++tb)
|
|
913
|
+
qb[rb++] = 255 & vb.charCodeAt(tb);
|
|
914
|
+
}
|
|
915
|
+
for (; sb > rb; )
|
|
916
|
+
tb = Math.floor(65536 * Math.random()), qb[rb++] = tb >>> 8, qb[rb++] = 255 & tb;
|
|
917
|
+
rb = 0, Z();
|
|
918
|
+
}
|
|
919
|
+
ab.prototype.nextBytes = _, db.prototype.doPublic = fb, db.prototype.setPublic = eb, db.prototype.encrypt = gb, c.exports = {
|
|
920
|
+
RSAKey: db
|
|
921
|
+
};
|
|
922
|
+
});
|
|
923
|
+
var rsalib_default = rsa;
|
|
924
|
+
|
|
925
|
+
// src/utils/publicKey.ts
|
|
926
|
+
var getPublicKey = async () => {
|
|
927
|
+
const res = await fetch(
|
|
928
|
+
"https://passport.migu.cn/password/publickey",
|
|
929
|
+
{
|
|
930
|
+
method: "POST"
|
|
931
|
+
}
|
|
932
|
+
);
|
|
933
|
+
if (!res.ok) return;
|
|
934
|
+
const data = await res.json();
|
|
935
|
+
const publicExponent = data.result.publicExponent;
|
|
936
|
+
const modulus = data.result.modulus;
|
|
937
|
+
return { publicExponent, modulus };
|
|
938
|
+
};
|
|
939
|
+
|
|
940
|
+
// src/modules/login_np.ts
|
|
941
|
+
var RSAKey = rsalib_default.RSAKey;
|
|
942
|
+
function randomString() {
|
|
943
|
+
const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
|
944
|
+
return random.toLowerCase();
|
|
945
|
+
}
|
|
946
|
+
var loginNP = {
|
|
947
|
+
async authn(username, password) {
|
|
948
|
+
var error = "";
|
|
949
|
+
var $ = {
|
|
950
|
+
"isAsync": true,
|
|
951
|
+
"enpassword": "",
|
|
952
|
+
"captcha": "",
|
|
953
|
+
"appType": "0",
|
|
954
|
+
"loginID": "",
|
|
955
|
+
"relayState": "",
|
|
956
|
+
"sourceID": "220029",
|
|
957
|
+
"imgcodeType": "1",
|
|
958
|
+
"fingerPrint": "",
|
|
959
|
+
"fingerPrintDetail": ""
|
|
960
|
+
};
|
|
961
|
+
const p = await getPublicKey();
|
|
962
|
+
const { publicExponent, modulus } = p || {};
|
|
963
|
+
if (!modulus || !publicExponent) {
|
|
964
|
+
error = "\u83B7\u53D6\u516C\u94A5\u5931\u8D25";
|
|
965
|
+
return { error };
|
|
966
|
+
}
|
|
967
|
+
var rsa2 = new RSAKey();
|
|
968
|
+
rsa2.setPublic(modulus, publicExponent);
|
|
969
|
+
const rsa_pwd = rsa2.encrypt(password);
|
|
970
|
+
const rsa_username = rsa2.encrypt(username);
|
|
971
|
+
const fakeFingerprint = randomString();
|
|
972
|
+
$.fingerPrint = fakeFingerprint;
|
|
973
|
+
$.fingerPrintDetail = fakeFingerprint;
|
|
974
|
+
$.enpassword = rsa_pwd;
|
|
975
|
+
$.loginID = rsa_username;
|
|
976
|
+
const form = new URLSearchParams();
|
|
977
|
+
for (const [key, value] of Object.entries($)) {
|
|
978
|
+
form.append(key, String(value));
|
|
979
|
+
}
|
|
980
|
+
const res = await fetch(
|
|
981
|
+
`https://passport.migu.cn/authn`,
|
|
982
|
+
{
|
|
983
|
+
method: "POST",
|
|
984
|
+
headers: {
|
|
985
|
+
"Host": "passport.migu.cn"
|
|
986
|
+
},
|
|
987
|
+
body: form
|
|
988
|
+
}
|
|
989
|
+
);
|
|
990
|
+
if (!res.ok) return { error: ["\u8BF7\u6C42\u767B\u5F55\u5931\u8D25"] };
|
|
991
|
+
const body = await res.json();
|
|
992
|
+
return body;
|
|
993
|
+
}
|
|
994
|
+
};
|
|
995
|
+
|
|
996
|
+
// src/modules/passport_checkToken.ts
|
|
997
|
+
var checkToken = async (token = "") => {
|
|
998
|
+
return await h5fetch(
|
|
999
|
+
`https://c.musicapp.migu.cn/mgateway/api/checkPacMtoken`,
|
|
1000
|
+
{
|
|
1001
|
+
headers: {
|
|
1002
|
+
"pacmtoken": token
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
);
|
|
1006
|
+
};
|
|
1007
|
+
|
|
1008
|
+
// src/modules/passport_pacmToken.ts
|
|
1009
|
+
var getPacmToken = async (token = "", type = "2", sourceId = "220029", activityId = "MUSIC-WWW") => {
|
|
1010
|
+
const res = await fetch(
|
|
1011
|
+
`https://c.musicapp.migu.cn/user/h5/token-validate/v3.0?token=${token}&type=${type}&sourceId=${sourceId}&activityId=${activityId}`,
|
|
1012
|
+
{
|
|
1013
|
+
headers: {
|
|
1014
|
+
"Cookie": "idmpauth=true@passport.migu.cn",
|
|
1015
|
+
//?
|
|
1016
|
+
"Origin": "https://music.migu.cn",
|
|
1017
|
+
"Pragma": "no-cache",
|
|
1018
|
+
"Referer": "https://music.migu.cn/"
|
|
1019
|
+
},
|
|
1020
|
+
method: "GET"
|
|
1021
|
+
}
|
|
1022
|
+
);
|
|
1023
|
+
const headers = res.headers;
|
|
1024
|
+
let cookie = [];
|
|
1025
|
+
if (typeof headers.getSetCookie === "function") {
|
|
1026
|
+
cookie = headers.getSetCookie() || [];
|
|
1027
|
+
} else {
|
|
1028
|
+
const setCookieHeader = headers.get("set-cookie");
|
|
1029
|
+
if (setCookieHeader) {
|
|
1030
|
+
cookie = setCookieHeader.split(",").map((c) => c.trim());
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
let pacmToken = "";
|
|
1034
|
+
cookie.forEach((item) => {
|
|
1035
|
+
if (item.includes("pacmtoken=")) {
|
|
1036
|
+
pacmToken = item.split(";")[0];
|
|
1037
|
+
pacmToken = pacmToken.split("=")[1];
|
|
1038
|
+
return;
|
|
1039
|
+
}
|
|
1040
|
+
});
|
|
1041
|
+
const body = await res.json();
|
|
1042
|
+
return { pacmToken, cookie, body };
|
|
1043
|
+
};
|
|
1044
|
+
|
|
1045
|
+
// src/modules/ticket.ts
|
|
1046
|
+
var getTicketInfo = async (page = 1, pageCount = 20) => {
|
|
1047
|
+
return await h5fetch(`https://app.c.nf.migu.cn/MIGUM3.0/v1.0/ticket/home/ticket?pageNum=${page}&pageCount=${pageCount}`);
|
|
1048
|
+
};
|
|
1049
|
+
|
|
426
1050
|
// src/index.ts
|
|
427
1051
|
function createClient() {
|
|
428
1052
|
return modules_exports;
|
|
@@ -430,11 +1054,15 @@ function createClient() {
|
|
|
430
1054
|
// Annotate the CommonJS export names for ESM import in node:
|
|
431
1055
|
0 && (module.exports = {
|
|
432
1056
|
checkCanListen,
|
|
1057
|
+
checkToken,
|
|
433
1058
|
createClient,
|
|
434
1059
|
getAlbumInfo,
|
|
435
1060
|
getAlbumSong,
|
|
436
1061
|
getComment,
|
|
1062
|
+
getMvHls,
|
|
1063
|
+
getMvInfo,
|
|
437
1064
|
getOpNum,
|
|
1065
|
+
getPacmToken,
|
|
438
1066
|
getPlaylistInfo,
|
|
439
1067
|
getPlaylistSong,
|
|
440
1068
|
getRankIndex,
|
|
@@ -449,10 +1077,12 @@ function createClient() {
|
|
|
449
1077
|
getSingerAlbum,
|
|
450
1078
|
getSingerIndex,
|
|
451
1079
|
getSingerSong,
|
|
1080
|
+
getTicketInfo,
|
|
452
1081
|
getUrlH5V24,
|
|
453
1082
|
getUrlV1,
|
|
454
1083
|
getUrlV2,
|
|
455
1084
|
getVersion,
|
|
1085
|
+
loginNP,
|
|
456
1086
|
modules,
|
|
457
1087
|
searchAlbum,
|
|
458
1088
|
searchConcert,
|