migu-api-enhanced 2.2.1 → 2.4.0

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.js CHANGED
@@ -13,6 +13,7 @@ __export(modules_exports, {
13
13
  getAlbumInfo: () => getAlbumInfo,
14
14
  getAlbumSong: () => getAlbumSong,
15
15
  getComment: () => getComment,
16
+ getLyric: () => getLyric,
16
17
  getMVRecommend: () => getMVRecommend,
17
18
  getMvHls: () => getMvHls,
18
19
  getMvInfo: () => getMvInfo,
@@ -29,6 +30,10 @@ __export(modules_exports, {
29
30
  getRankInfo: () => getRankInfo,
30
31
  getRecommendPlaylist: () => getRecommendPlaylist,
31
32
  getResourceInfo: () => getResourceInfo,
33
+ getSVideoInfo: () => getSVideoInfo,
34
+ getSVideoSearchSuggest: () => getSVideoSearchSuggest,
35
+ getSVideoUrl: () => getSVideoUrl,
36
+ getSVideoUserContent: () => getSVideoUserContent,
32
37
  getSceneRecommend: () => getSceneRecommend,
33
38
  getSearchDefault: () => getSearchDefault,
34
39
  getSearchHot: () => getSearchHot,
@@ -49,6 +54,8 @@ __export(modules_exports, {
49
54
  getUserHomePage: () => getUserHomePage,
50
55
  getUserMyList: () => getUserMyList,
51
56
  getVersion: () => getVersion,
57
+ getVrbtOpNum: () => getVrbtOpNum,
58
+ getVrbtUrl: () => getVrbtUrl,
52
59
  loginNP: () => loginNP,
53
60
  loginOneClick: () => loginOneClick,
54
61
  loginPhone: () => loginPhone,
@@ -57,34 +64,45 @@ __export(modules_exports, {
57
64
  searchAlbum: () => searchAlbum,
58
65
  searchConcert: () => searchConcert,
59
66
  searchLrc: () => searchLrc,
67
+ searchMv: () => searchMv,
60
68
  searchRbt: () => searchRbt,
69
+ searchSVideo: () => searchSVideo,
61
70
  searchSinger: () => searchSinger,
62
71
  searchSong: () => searchSong,
63
72
  searchSuggest: () => searchSuggest,
64
- searchTicket: () => searchTicket,
65
- searchVideo: () => searchVideo
73
+ searchTicket: () => searchTicket
66
74
  });
67
75
 
68
76
  // src/utils/h5fetch.ts
69
- var createTimeoutSignal = (ms) => {
70
- const controller = new AbortController();
71
- setTimeout(() => controller.abort(), ms);
72
- return controller.signal;
73
- };
77
+ import axios from "axios";
74
78
  var h5fetch = async (url, init) => {
75
- if (!init) {
76
- init = {
77
- method: "GET",
78
- signal: createTimeoutSignal(5e3)
79
- };
80
- } else if (!init.signal) {
81
- init.signal = createTimeoutSignal(5e3);
79
+ const method = (init?.method || "GET").toUpperCase();
80
+ const headersRaw = init?.headers;
81
+ let headers = {};
82
+ if (headersRaw) {
83
+ if (headersRaw instanceof Headers) {
84
+ headersRaw.forEach((value, key) => {
85
+ headers[key] = value;
86
+ });
87
+ } else if (Array.isArray(headersRaw)) {
88
+ headersRaw.forEach(([key, value]) => {
89
+ headers[key] = value;
90
+ });
91
+ } else {
92
+ headers = headersRaw;
93
+ }
82
94
  }
83
- const response = await fetch(url, init);
84
- if (!response.ok) {
85
- throw new Error(`HTTP error! status: ${response.status}`);
95
+ const axiosConfig = {
96
+ url,
97
+ method,
98
+ headers,
99
+ data: init?.body
100
+ };
101
+ if (init?.signal) {
102
+ axiosConfig.signal = init.signal;
86
103
  }
87
- return await response.json();
104
+ const response = await axios(axiosConfig);
105
+ return response.data;
88
106
  };
89
107
 
90
108
  // src/modules/search.ts
@@ -117,8 +135,8 @@ var getSearchDefault = async () => {
117
135
  return await h5fetch(`http://app.c.nf.migu.cn/column/search/default-text/v3.0?resourceVersion=2`);
118
136
  };
119
137
 
120
- // src/modules/search_video.ts
121
- var searchVideo = async (text, page = 1, typeOrder = 0) => {
138
+ // src/modules/search_mv.ts
139
+ var searchMv = async (text, page = 1, typeOrder = 0) => {
122
140
  return await h5fetch(`http://app.c.nf.migu.cn/bmw/search/video/v1.0?pageNo=${page}&text=${text}&typeOrder=${typeOrder}`);
123
141
  };
124
142
 
@@ -219,7 +237,7 @@ var getSceneRecommend = async (scene = "TODAY_RECOMMEND", size = 10) => {
219
237
  } else if (scene === "TODAY_RECOMMEND") {
220
238
  params = `scene=TODAY_RECOMMEND&action=1&size=${size}`;
221
239
  } else {
222
- return { error: "scene\u53C2\u6570\u9519\u8BEF" };
240
+ return { error: "scene\u53C2\u6570\u9519\u8BEF PRIVATE_FM \u6216 TODAY_RECOMMEND" };
223
241
  }
224
242
  return await h5fetch(
225
243
  `https://app.c.nf.migu.cn/pc/resource-dataloader/recommend-song/v1.0?${params}`,
@@ -256,8 +274,10 @@ var getComment = async (resourceId, resourceType = 2, size = 20, hotCommentStart
256
274
  };
257
275
 
258
276
  // src/modules/resourceinfo.ts
259
- var getResourceInfo = async (resourceId, resourceType = 2) => {
260
- return await h5fetch(`https://app.u.nf.migu.cn//MIGUM2.0/v1.0/content/resourceinfo.do?resourceId=${resourceId}&resourceType=${resourceType}`);
277
+ var getResourceInfo = async (resourceIds = "", copyrightIds = "", resourceType = 2) => {
278
+ resourceIds = resourceIds.replace(/,/g, "|");
279
+ copyrightIds = copyrightIds.replace(/,/g, "|");
280
+ return await h5fetch(`https://app.u.nf.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?resourceId=${resourceIds}&copyrightId=${copyrightIds}&resourceType=${resourceType}`);
261
281
  };
262
282
 
263
283
  // src/modules/can-listen.ts
@@ -292,6 +312,7 @@ var getUrlV1 = async (contentId, copyrightId, resourceType = "2") => {
292
312
  };
293
313
 
294
314
  // src/modules/url_v2.ts
315
+ import axios2 from "axios";
295
316
  var getUrlV2 = async (contentId, copyrightId, toneFlag = "PQ", resourceType = "2", pacmtoken = "") => {
296
317
  const deviceId = getDeviceId();
297
318
  const timestamp = Date.now();
@@ -318,14 +339,14 @@ var getUrlV2 = async (contentId, copyrightId, toneFlag = "PQ", resourceType = "2
318
339
  "location-data": "30.6698676660,104.1229614820",
319
340
  "location-info": ""
320
341
  };
321
- const res = await fetch(
342
+ const res = await axios2.get(
322
343
  `https://app.c.nf.migu.cn/strategy/pc/listen/v2.0?contentId=${contentId}&copyrightId=${copyrightId}&scene=&netType=01&resourceType=${resourceType}&toneFlag=${toneFlag}`,
323
344
  {
324
- headers
345
+ headers,
346
+ responseType: "arraybuffer"
325
347
  }
326
348
  );
327
- const blob = await res.blob();
328
- return await decryptData(blob);
349
+ return await decryptData(res.data);
329
350
  };
330
351
  var SECURE = "Jk8qzuePiJ1qE3mDYhLQ3T73DtDoAhLP";
331
352
  var aw = 171;
@@ -337,9 +358,6 @@ function textEncode(e) {
337
358
  function textDecode(e) {
338
359
  return new TextDecoder("utf-8").decode(e);
339
360
  }
340
- var blobToArrayBuffer = async (blob) => {
341
- return blob.arrayBuffer();
342
- };
343
361
  function decryptBlob(e, r) {
344
362
  if (r.length == 0)
345
363
  return null;
@@ -350,20 +368,19 @@ function decryptBlob(e, r) {
350
368
  o[s] = e[c] + t - a[s % i];
351
369
  return o;
352
370
  }
353
- async function decryptData(blob) {
354
- return await blobToArrayBuffer(blob).then((buf) => {
355
- let l = buf, a = SECURE, u = decryptBlob(new Uint8Array(l), a), p = u ? textDecode(u) : null;
356
- try {
357
- const data = p ? JSON.parse(p) : null;
358
- return data;
359
- } catch (e) {
360
- return null;
361
- }
362
- ;
363
- });
371
+ function decryptData(buf) {
372
+ let l = buf, a = SECURE, u = decryptBlob(new Uint8Array(l), a), p = u ? textDecode(u) : null;
373
+ try {
374
+ const data = p ? JSON.parse(p) : null;
375
+ return data;
376
+ } catch (e) {
377
+ return null;
378
+ }
379
+ ;
364
380
  }
365
381
 
366
382
  // src/modules/url_h5v2.4.ts
383
+ import axios3 from "axios";
367
384
  var getUrlH5V24 = async (contentId, copyrightId, toneFlag = "PQ", resourceType = "2") => {
368
385
  const headers = {
369
386
  "birth": "h5page",
@@ -372,19 +389,16 @@ var getUrlH5V24 = async (contentId, copyrightId, toneFlag = "PQ", resourceType =
372
389
  "location-data": "30.6698676660,104.1229614820",
373
390
  "location-info": ""
374
391
  };
375
- const res = await fetch(
392
+ const res = await axios3.get(
376
393
  `https://c.musicapp.migu.cn/strategy/listen-url/h5/v2.4?contentId=${contentId}&copyrightId=${copyrightId}&resourceType=${resourceType}&netType=01&toneFlag=${toneFlag}&scene=&lowerQualityContentId=${contentId}`,
377
394
  {
378
- headers
395
+ headers,
396
+ responseType: "arraybuffer"
379
397
  }
380
398
  );
381
- const blob = await res.blob();
382
- return await decryptData2(blob);
399
+ return await decryptData2(res.data);
383
400
  };
384
401
  var SECURE2 = ["Jk8qzuePiJ1qE3mDYhLQ3T73DtDoAhLP"];
385
- var blobToArrayBuffer2 = async (blob) => {
386
- return await blob.arrayBuffer();
387
- };
388
402
  function strToUtf8Bytes(e) {
389
403
  return new TextEncoder().encode(e);
390
404
  }
@@ -421,12 +435,10 @@ function decode(e, t) {
421
435
  i[s] = e[c] + r - o[s % a];
422
436
  return i;
423
437
  }
424
- var decryptData2 = async (blob) => {
425
- const ab = await blobToArrayBuffer2(blob);
438
+ var decryptData2 = (ab) => {
426
439
  const r = decode(new Uint8Array(ab), SECURE2[0]);
427
440
  const d = utf8Bytes2str(r);
428
- const data = JSON.parse(d);
429
- return data;
441
+ return JSON.parse(d);
430
442
  };
431
443
 
432
444
  // src/modules/version.ts
@@ -462,6 +474,9 @@ var getMvHls = async (mvContentId, mvCopyrightId, url, size, format = "050012",
462
474
  );
463
475
  };
464
476
 
477
+ // src/modules/login_np.ts
478
+ import axios4 from "axios";
479
+
465
480
  // src/utils/rsalib.ts
466
481
  import crypto from "crypto";
467
482
  function hexToBase64Url(hex) {
@@ -510,14 +525,12 @@ var RSAKey = class {
510
525
 
511
526
  // src/utils/publicKey.ts
512
527
  var getPublicKey = async () => {
513
- const res = await fetch(
528
+ const data = await h5fetch(
514
529
  "https://passport.migu.cn/password/publickey",
515
530
  {
516
531
  method: "POST"
517
532
  }
518
533
  );
519
- if (!res.ok) return;
520
- const data = await res.json();
521
534
  const publicExponent = data.result.publicExponent;
522
535
  const modulus = data.result.modulus;
523
536
  return { publicExponent, modulus };
@@ -572,22 +585,19 @@ var loginNP = {
572
585
  $.enpassword = rsa_pwd || "";
573
586
  $.loginID = rsa_username || "";
574
587
  const form = URLParams($);
575
- const res = await fetch(
588
+ const res = await axios4.post(
576
589
  `https://passport.migu.cn/authn`,
590
+ form,
577
591
  {
578
- method: "POST",
579
592
  headers: {
580
593
  "Host": "passport.migu.cn",
581
594
  "Content-Type": "application/x-www-form-urlencoded",
582
595
  "Referer": "https://passport.migu.cn/login",
583
596
  "Origin": "https://passport.migu.cn"
584
- },
585
- body: form
597
+ }
586
598
  }
587
599
  );
588
- if (!res.ok) return { error: "\u8BF7\u6C42\u767B\u5F55\u5931\u8D25" };
589
- const body = await res.json();
590
- return body;
600
+ return res.data;
591
601
  }
592
602
  };
593
603
 
@@ -603,17 +613,10 @@ var checkToken = async (token = "") => {
603
613
  );
604
614
  };
605
615
 
616
+ // src/modules/passport_pacmToken.ts
617
+ import axios5 from "axios";
618
+
606
619
  // src/utils/setCookie.ts
607
- var parseSetCookies = (headers) => {
608
- if (typeof headers.getSetCookie === "function") {
609
- return headers.getSetCookie() || [];
610
- }
611
- const setCookieHeader = headers.get("set-cookie");
612
- if (!setCookieHeader) {
613
- return [];
614
- }
615
- return setCookieHeader.split(",").map((c) => c.trim());
616
- };
617
620
  var getCookieValue = (cookies, key) => {
618
621
  for (const item of cookies) {
619
622
  const prefix = `${key}=`;
@@ -624,14 +627,18 @@ var getCookieValue = (cookies, key) => {
624
627
  }
625
628
  return "";
626
629
  };
627
- var getSetCookieValue = (headers, key) => {
628
- const cookies = parseSetCookies(headers);
630
+ var getSetCookieValueFromObject = (headers, key) => {
631
+ const setCookieHeader = headers["set-cookie"];
632
+ if (!setCookieHeader) {
633
+ return "";
634
+ }
635
+ const cookies = Array.isArray(setCookieHeader) ? setCookieHeader : setCookieHeader.split(",").map((c) => c.trim());
629
636
  return getCookieValue(cookies, key);
630
637
  };
631
638
 
632
639
  // src/modules/passport_pacmToken.ts
633
640
  var getPacmToken = async (token = "", type = "2", sourceId = "220029", activityId = "MUSIC-WWW") => {
634
- const res = await fetch(
641
+ const res = await axios5.get(
635
642
  `https://c.musicapp.migu.cn/user/h5/token-validate/v3.0?token=${token}&type=${type}&sourceId=${sourceId}&activityId=${activityId}`,
636
643
  {
637
644
  headers: {
@@ -639,14 +646,11 @@ var getPacmToken = async (token = "", type = "2", sourceId = "220029", activityI
639
646
  "Origin": "https://music.migu.cn",
640
647
  "Pragma": "no-cache",
641
648
  "Referer": "https://music.migu.cn/"
642
- },
643
- method: "GET"
649
+ }
644
650
  }
645
651
  );
646
- const cookie = parseSetCookies(res.headers);
647
- const pacmToken = getCookieValue(cookie, "pacmtoken");
648
- const body = await res.json();
649
- return { pacmToken, cookie, body };
652
+ const pacmToken = getSetCookieValueFromObject(res.headers, "pacmtoken");
653
+ return { pacmToken, body: res.data };
650
654
  };
651
655
 
652
656
  // src/modules/ticket.ts
@@ -655,80 +659,60 @@ var getTicketInfo = async (page = 1, pageCount = 20) => {
655
659
  };
656
660
 
657
661
  // src/modules/user_badge.ts
662
+ import axios6 from "axios";
658
663
  var getUserBadge = async (pacmtoken) => {
659
- const res = await fetch(
660
- `https://app.c.nf.migu.cn/pc/open/api/member/icon/v1.0`,
661
- {
662
- method: "GET",
663
- headers: {
664
- "Cookie": `pacmtoken=${pacmtoken}`,
665
- "Referer": "https://music.migu.cn/",
666
- "channel": "014X031",
667
- "timestamp": Date.now().toString()
668
- }
664
+ const res = await axios6.get("https://app.c.nf.migu.cn/pc/open/api/member/icon/v1.0", {
665
+ headers: {
666
+ "Cookie": `pacmtoken=${pacmtoken}`,
667
+ "Referer": "https://music.migu.cn/",
668
+ "channel": "014X031",
669
+ "timestamp": Date.now().toString()
669
670
  }
670
- );
671
- const newPacmToken = getSetCookieValue(res.headers, "pacmtoken");
672
- const data = await res.json();
673
- return { data, pacmtoken: newPacmToken };
671
+ });
672
+ const newPacmToken = getSetCookieValueFromObject(res.headers, "pacmtoken");
673
+ return { data: res.data, newPacmToken };
674
674
  };
675
675
 
676
676
  // src/modules/user_queryInfo.ts
677
+ import axios7 from "axios";
677
678
  var queryUserInfo = async (pacmtoken) => {
678
- const res = await fetch(
679
- `https://app.c.nf.migu.cn/pc/user/h5/queryUserInfo/v1.0`,
680
- {
681
- method: "GET",
682
- headers: {
683
- "Cookie": `pacmtoken=${pacmtoken}`,
684
- "channel": "014X031",
685
- "Referer": `https://music.migu.cn/`
686
- //可不用
687
- }
679
+ const res = await axios7.get("https://app.c.nf.migu.cn/pc/user/h5/queryUserInfo/v1.0", {
680
+ headers: {
681
+ "Cookie": `pacmtoken=${pacmtoken}`,
682
+ "channel": "014X031",
683
+ "Referer": "https://music.migu.cn/"
688
684
  }
689
- );
690
- const newPacmToken = getSetCookieValue(res.headers, "pacmtoken");
691
- const data = await res.json();
692
- return { data, pacmtoken: newPacmToken };
685
+ });
686
+ const newPacmToken = getSetCookieValueFromObject(res.headers, "pacmtoken");
687
+ return { data: res.data, newPacmToken };
693
688
  };
694
689
 
695
690
  // src/modules/user_homePage.ts
691
+ import axios8 from "axios";
696
692
  var getUserHomePage = async (pacmtoken) => {
697
- const res = await fetch(
698
- `https://app.c.nf.migu.cn/pc/user/home-page/v2.0`,
699
- {
700
- method: "GET",
701
- headers: {
702
- "Cookie": `pacmtoken=${pacmtoken}`
703
- //"channel": "014X031",
704
- //"Referer": `https://music.migu.cn/`
705
- }
693
+ const res = await axios8.get("https://app.c.nf.migu.cn/pc/user/home-page/v2.0", {
694
+ headers: {
695
+ "Cookie": `pacmtoken=${pacmtoken}`
706
696
  }
707
- );
708
- const newPacmToken = getSetCookieValue(res.headers, "pacmtoken");
709
- const data = await res.json();
710
- return { data, pacmtoken: newPacmToken };
697
+ });
698
+ const newPacmToken = getSetCookieValueFromObject(res.headers, "pacmtoken");
699
+ return { data: res.data, newPacmToken };
711
700
  };
712
701
 
713
702
  // src/modules/user_recom_today.ts
703
+ import axios9 from "axios";
714
704
  var getTodayRecommend = async (pacmtoken) => {
715
- const res = await fetch(
716
- `https://app.c.nf.migu.cn/pc/v1.0/template/todayRecommendList/release?actionId=1&index=1&templateVersion=5`,
717
- {
718
- method: "GET",
719
- headers: {
720
- "Cookie": `pacmtoken=${pacmtoken}`
721
- //"channel": "014X031",
722
- //"Referer": `https://music.migu.cn/`
723
- }
705
+ const res = await axios9.get("https://app.c.nf.migu.cn/pc/v1.0/template/todayRecommendList/release?actionId=1&index=1&templateVersion=5", {
706
+ headers: {
707
+ "Cookie": `pacmtoken=${pacmtoken}`
724
708
  }
725
- );
726
- const newPacmToken = getSetCookieValue(res.headers, "pacmtoken");
727
- const data = await res.json();
728
- return { data, pacmtoken: newPacmToken };
709
+ });
710
+ const newPacmToken = getSetCookieValueFromObject(res.headers, "pacmtoken");
711
+ return { data: res.data, newPacmToken };
729
712
  };
730
713
 
731
714
  // src/modules/login_sim.ts
715
+ import axios10 from "axios";
732
716
  function randomString2() {
733
717
  const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
734
718
  return random.toLowerCase();
@@ -759,21 +743,19 @@ var loginSim = {
759
743
  $.fingerPrintDetail = fakeFingerprint;
760
744
  $.encMsisdn = encPhone || "";
761
745
  const form = URLParams($);
762
- const send = await fetch(
746
+ const send = await axios10.post(
763
747
  `https://passport.migu.cn/api/simauth/send`,
748
+ form,
764
749
  {
765
- method: "POST",
766
750
  headers: {
767
751
  "Host": "passport.migu.cn",
768
752
  "Content-Type": "application/x-www-form-urlencoded",
769
753
  "Referer": "https://passport.migu.cn/login",
770
754
  "Origin": "https://passport.migu.cn"
771
- },
772
- body: form
755
+ }
773
756
  }
774
757
  );
775
- if (!send.ok) return { error: "simauth f:net error" };
776
- const sendbody = await send.json();
758
+ const sendbody = send.data;
777
759
  if (!sendbody && sendbody.status != "2000") {
778
760
  return { error: sendbody };
779
761
  }
@@ -782,18 +764,15 @@ var loginSim = {
782
764
  return { sim_sessionid };
783
765
  },
784
766
  async simQuery(sim_sessionid) {
785
- var $;
786
- $ = {
767
+ const $ = {
787
768
  "isAsync": true,
788
769
  "sim_sessionid": sim_sessionid,
789
770
  "sourceID": "220029"
790
771
  };
791
- const form = new URLSearchParams();
792
- for (const [key, value] of Object.entries($)) {
793
- form.append(key, String(value));
794
- }
795
- const query = await fetch(
772
+ const form = URLParams($);
773
+ const query = await axios10.post(
796
774
  `https://passport.migu.cn/api/simauth/query`,
775
+ form,
797
776
  {
798
777
  method: "POST",
799
778
  headers: {
@@ -801,12 +780,10 @@ var loginSim = {
801
780
  "Content-Type": "application/x-www-form-urlencoded",
802
781
  "Referer": "https://passport.migu.cn/login",
803
782
  "Origin": "https://passport.migu.cn"
804
- },
805
- body: form
783
+ }
806
784
  }
807
785
  );
808
- if (!query.ok) return { error: "simauth e" };
809
- const querybody = await query.json();
786
+ const querybody = query.data;
810
787
  if (querybody.status == "4071") {
811
788
  return { error: "waiting", body: querybody };
812
789
  } else if (querybody.status == "2000") {
@@ -820,35 +797,27 @@ var loginSim = {
820
797
  };
821
798
 
822
799
  // src/modules/user_collect.ts
800
+ import axios11 from "axios";
823
801
  var getUserCollect = async (pacmtoken, page = 1, size = 20) => {
824
- const res = await fetch(
825
- `https://app.c.nf.migu.cn/user/h5/user/collection/v1.0?pageNo=${page}&type=1&OPType=03&pageSize=${size}&resourceType=2021`,
826
- {
827
- method: "GET",
828
- headers: {
829
- "Cookie": `pacmtoken=${pacmtoken}`
830
- }
802
+ const res = await axios11.get(`https://app.c.nf.migu.cn/user/h5/user/collection/v1.0?pageNo=${page}&type=1&OPType=03&pageSize=${size}&resourceType=2021`, {
803
+ headers: {
804
+ "Cookie": `pacmtoken=${pacmtoken}`
831
805
  }
832
- );
833
- const newPacmToken = getSetCookieValue(res.headers, "pacmtoken");
834
- const data = await res.json();
835
- return { data, pacmtoken: newPacmToken };
806
+ });
807
+ const newPacmToken = getSetCookieValueFromObject(res.headers, "pacmtoken");
808
+ return { data: res.data, newPacmToken };
836
809
  };
837
810
 
838
811
  // src/modules/user_myList.ts
812
+ import axios12 from "axios";
839
813
  var getUserMyList = async (pacmtoken, queryType = 0, page = 1, size = 20) => {
840
- const res = await fetch(
841
- `https://app.c.nf.migu.cn/user/h5/my-music-list/v1.0?queryType=${queryType}&pageNo=${page}&pageSize=${size}`,
842
- {
843
- method: "GET",
844
- headers: {
845
- "Cookie": `pacmtoken=${pacmtoken}`
846
- }
814
+ const res = await axios12.get(`https://app.c.nf.migu.cn/user/h5/my-music-list/v1.0?queryType=${queryType}&pageNo=${page}&pageSize=${size}`, {
815
+ headers: {
816
+ "Cookie": `pacmtoken=${pacmtoken}`
847
817
  }
848
- );
849
- const newPacmToken = getSetCookieValue(res.headers, "pacmtoken");
850
- const data = await res.json();
851
- return { data, pacmtoken: newPacmToken };
818
+ });
819
+ const newPacmToken = getSetCookieValueFromObject(res.headers, "pacmtoken");
820
+ return { data: res.data, newPacmToken };
852
821
  };
853
822
 
854
823
  // src/modules/singer_similar.ts
@@ -871,6 +840,7 @@ var getSimilarSongRecommend = async (contentId = "") => {
871
840
  };
872
841
 
873
842
  // src/modules/login_oneclick.ts
843
+ import axios13 from "axios";
874
844
  import crypto2 from "crypto";
875
845
  var nav = {
876
846
  "platform": "iPhone",
@@ -959,19 +929,18 @@ var YDRZ = {
959
929
  "businessType": optparams.businessType,
960
930
  "userInformations": this.getUserInfo()
961
931
  };
962
- const res = await fetch(
932
+ const res = await axios13.post(
963
933
  "https://verify.cmpassport.com/h5/getPreMobile",
934
+ requestData,
964
935
  {
965
- method: "POST",
966
936
  headers: {
967
937
  "Referer": "https://passport.migu.cn/",
968
938
  "Origin": "https://passport.migu.cn"
969
- },
970
- body: JSON.stringify(requestData)
939
+ }
971
940
  }
972
941
  );
973
- if (!res.ok) return;
974
- const json = await res.json(), token = json.body?.token || "";
942
+ if (!res.data) return;
943
+ const json = res.data, token = json?.token || "";
975
944
  if (!token) return;
976
945
  return token;
977
946
  }
@@ -1002,9 +971,8 @@ var genInternetSign = async () => {
1002
971
  key = encodeURIComponent(key);
1003
972
  const signature = md5(key);
1004
973
  const url = `https://passport.migu.cn/api/genInternetSign?preSign=${preSign}&msgid=${msgId}&systemtime=${time}&sourceid=220029&signature=${signature}`;
1005
- const res = await fetch(url);
1006
- if (!res.ok) return void 0;
1007
- const data = await res.json();
974
+ const res = await axios13.get(url);
975
+ const data = res.data;
1008
976
  if (!data || data.status !== 2e3) return void 0;
1009
977
  const rsaSign = data.result?.rsaSign || "";
1010
978
  return rsaSign;
@@ -1019,18 +987,16 @@ var getSTToken = async (uniToken) => {
1019
987
  "isFirst": 1
1020
988
  };
1021
989
  const form = URLParams($);
1022
- const res = await fetch(
990
+ const res = await axios13.post(
1023
991
  "https://passport.migu.cn/authn/uniTokenValidate",
1024
992
  {
1025
- method: "POST",
1026
993
  headers: {
1027
994
  "content-type": "application/x-www-form-urlencoded; charset=UTF-8"
1028
- },
1029
- body: form
995
+ }
1030
996
  }
1031
997
  );
1032
- if (!res.ok) return { error: "fetch uni e" };
1033
- const json = await res.json(), status = json.status?.toString() || "", token = json.result?.token || "", msisdn = json.result?.msisdn || "";
998
+ if (!res.data) return { error: "fetch uni e" };
999
+ const json = res.data, status = json.status?.toString() || "", token = json.result?.token || "", msisdn = json.result?.msisdn || "";
1034
1000
  if (status !== "2000") return { error: "status e" };
1035
1001
  return { token, msisdn, status };
1036
1002
  };
@@ -1062,6 +1028,7 @@ var loginOneClick = {
1062
1028
  };
1063
1029
 
1064
1030
  // src/modules/login_phone.ts
1031
+ import axios14 from "axios";
1065
1032
  function randomString3() {
1066
1033
  const random = Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
1067
1034
  return random.toLowerCase();
@@ -1090,10 +1057,9 @@ var loginPhone = {
1090
1057
  $.fingerPrintDetail = fakeFingerprint;
1091
1058
  $._ = (/* @__PURE__ */ new Date()).getTime().toString();
1092
1059
  const query = URLParams($);
1093
- const res = await fetch(
1060
+ const res = await axios14.get(
1094
1061
  `https://passport.migu.cn/login/dynamicpassword?${query}`,
1095
1062
  {
1096
- method: "GET",
1097
1063
  headers: {
1098
1064
  "Host": "passport.migu.cn",
1099
1065
  "Referer": "https://passport.migu.cn/login",
@@ -1101,8 +1067,7 @@ var loginPhone = {
1101
1067
  }
1102
1068
  }
1103
1069
  );
1104
- if (!res.ok) return { error: "gmc e" };
1105
- const data = await res.json();
1070
+ const data = res.data;
1106
1071
  return data;
1107
1072
  },
1108
1073
  //登陆
@@ -1130,21 +1095,19 @@ var loginPhone = {
1130
1095
  $.fingerPrint = fakeFingerprint;
1131
1096
  $.fingerPrintDetail = fakeFingerprint;
1132
1097
  const form = URLParams($);
1133
- const res = await fetch(
1098
+ const res = await axios14.post(
1134
1099
  `https://passport.migu.cn/authn/dynamicpassword`,
1100
+ form,
1135
1101
  {
1136
- method: "POST",
1137
1102
  headers: {
1138
1103
  "Host": "passport.migu.cn",
1139
1104
  "Content-Type": "application/x-www-form-urlencoded",
1140
1105
  "Referer": "https://passport.migu.cn/login",
1141
1106
  "Origin": "https://passport.migu.cn"
1142
- },
1143
- body: form
1107
+ }
1144
1108
  }
1145
1109
  );
1146
- if (!res.ok) return { error: "gmc e" };
1147
- const data = await res.json();
1110
+ const data = res.data;
1148
1111
  return data;
1149
1112
  }
1150
1113
  };
@@ -1175,16 +1138,103 @@ var getNinanByDate = async (date) => {
1175
1138
  };
1176
1139
 
1177
1140
  // src/modules/recommend_radio_all.ts
1141
+ import axios15 from "axios";
1178
1142
  var getRadioRecommendAll = async (pacmtoken = "") => {
1179
- return await h5fetch(
1143
+ const res = await axios15.get(
1180
1144
  `https://app.c.nf.migu.cn/pc/bmw/page-data/music-radio/v1.0?templateVersion=1`,
1181
1145
  {
1182
- method: "GET",
1183
1146
  headers: {
1184
1147
  "Cookie": `pacmtoken=${pacmtoken}`
1185
1148
  }
1186
1149
  }
1187
1150
  );
1151
+ const newPacmToken = getSetCookieValueFromObject(res.headers, "pacmtoken");
1152
+ return { data: res.data, newPacmToken };
1153
+ };
1154
+
1155
+ // src/modules/svideo_info.ts
1156
+ var getSVideoInfo = async (contentIds) => {
1157
+ const contentIdList = contentIds.split(",");
1158
+ contentIdList.map((item) => {
1159
+ return "6000," + item;
1160
+ }).join("|");
1161
+ return await h5fetch(`https://app.c.nf.migu.cn/resource/video-info/by-id/v1.0?requestParams=${contentIdList}`);
1162
+ };
1163
+
1164
+ // src/modules/svideo_search.ts
1165
+ var searchSVideo = async (text, page = 1) => {
1166
+ return await h5fetch(
1167
+ `https://app.c.nf.migu.cn/bmw/hot-search/search/videos/v1.0?pageIndex=${page}&text=${text}`,
1168
+ {
1169
+ headers: {
1170
+ "deviceid": getDeviceId()
1171
+ }
1172
+ }
1173
+ );
1174
+ };
1175
+
1176
+ // src/modules/svideo_searchSuggest.ts
1177
+ var getSVideoSearchSuggest = async (text) => {
1178
+ return await h5fetch(`https://app.c.nf.migu.cn/resource-dataloader/search-suggest/search/v1.0?text=${text}`);
1179
+ };
1180
+
1181
+ // src/modules/svideo_url.ts
1182
+ var getSVideoUrl = async (contentIds, formatType = "HQ") => {
1183
+ contentIds = contentIds.replace(/,/g, "|");
1184
+ return await h5fetch(`https://app.c.nf.migu.cn/strategy/short-video/play/v1.0?contentIds=${contentIds}&formatType=${formatType}`);
1185
+ };
1186
+
1187
+ // src/modules/svideo_userContent.ts
1188
+ var getSVideoUserContent = async (videoUserId, nextPageId = "") => {
1189
+ return await h5fetch(`https://app.c.nf.migu.cn/user/i/user-content-list/v1.0?nextPageId=${nextPageId}&videoUserId=${videoUserId}`);
1190
+ };
1191
+
1192
+ // src/modules/vrbt_opNum.ts
1193
+ var getVrbtOpNum = async (contentIds) => {
1194
+ return await h5fetch(`https://app.c.nf.migu.cn/resource/vrbt/opnum/v1.0?resourceType=M&contentIds=${contentIds}`);
1195
+ };
1196
+
1197
+ // src/modules/vrbt_url.ts
1198
+ var getVrbtUrl = async (contentIds) => {
1199
+ contentIds = contentIds.replace(/,/g, "|");
1200
+ return await h5fetch(
1201
+ `https://app.c.nf.migu.cn/strategy/vrbt/play/v1.0?contentIds=${contentIds}`,
1202
+ {
1203
+ headers: {
1204
+ "channel": "014X031"
1205
+ }
1206
+ }
1207
+ );
1208
+ };
1209
+
1210
+ // src/modules/lyric.ts
1211
+ import axios16 from "axios";
1212
+ var getLyric = async (contentId) => {
1213
+ if (contentId === "") return { error: "contentId is empty!", success: false };
1214
+ const res = await axios16.get(`https://app.c.nf.migu.cn/resource/song/by-contentids/v2.0?contentId=${contentId}`);
1215
+ const code = res.data.code.toString() || "";
1216
+ const data = res.data.data || [];
1217
+ if (code !== "000000") return {
1218
+ success: false,
1219
+ status: res.status,
1220
+ error: res.data.info || res.data
1221
+ };
1222
+ if (data.length === 0) return { error: "data.length = 0 !", success: false, data };
1223
+ const lrcUrl = data[0].lrcUrl || "";
1224
+ if (lrcUrl === "") return { error: "lrcUrl is empty!", success: false, data };
1225
+ const lrcRes = await axios16.get(lrcUrl);
1226
+ if (lrcRes.status !== 200) return {
1227
+ success: false,
1228
+ status: lrcRes.status,
1229
+ error: "lrcRes.status !== 200 !",
1230
+ data
1231
+ };
1232
+ const lrc = lrcRes.data || "";
1233
+ return {
1234
+ success: true,
1235
+ lrc,
1236
+ lrcUrl
1237
+ };
1188
1238
  };
1189
1239
 
1190
1240
  // src/utils/index.ts
@@ -1227,6 +1277,7 @@ export {
1227
1277
  getAlbumSong,
1228
1278
  getComment,
1229
1279
  getDeviceId,
1280
+ getLyric,
1230
1281
  getMVRecommend,
1231
1282
  getMvHls,
1232
1283
  getMvInfo,
@@ -1244,6 +1295,10 @@ export {
1244
1295
  getRankInfo,
1245
1296
  getRecommendPlaylist,
1246
1297
  getResourceInfo,
1298
+ getSVideoInfo,
1299
+ getSVideoSearchSuggest,
1300
+ getSVideoUrl,
1301
+ getSVideoUserContent,
1247
1302
  getSceneRecommend,
1248
1303
  getSearchDefault,
1249
1304
  getSearchHot,
@@ -1264,6 +1319,8 @@ export {
1264
1319
  getUserHomePage,
1265
1320
  getUserMyList,
1266
1321
  getVersion,
1322
+ getVrbtOpNum,
1323
+ getVrbtUrl,
1267
1324
  loginNP,
1268
1325
  loginOneClick,
1269
1326
  loginPhone,
@@ -1274,12 +1331,13 @@ export {
1274
1331
  searchAlbum,
1275
1332
  searchConcert,
1276
1333
  searchLrc,
1334
+ searchMv,
1277
1335
  searchRbt,
1336
+ searchSVideo,
1278
1337
  searchSinger,
1279
1338
  searchSong,
1280
1339
  searchSuggest,
1281
1340
  searchTicket,
1282
- searchVideo,
1283
1341
  ua
1284
1342
  };
1285
1343
  //# sourceMappingURL=index.js.map