index.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const axios_1 = require("axios");
  4. const headers = {
  5. "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.61",
  6. host: "studio-api.suno.ai"
  7. };
  8. async function getTopLists() {
  9. return [
  10. {
  11. title: "趋势榜",
  12. data: [
  13. {
  14. id: "1190bf92-10dc-4ce5-968a-7a377f37f984",
  15. title: "趋势榜 - 最近一天",
  16. },
  17. {
  18. id: "08a079b2-a63b-4f9c-9f29-de3c1864ddef",
  19. title: "趋势榜 - 最近一周",
  20. },
  21. {
  22. id: "845539aa-2a39-4cf5-b4ae-16d3fe159a77",
  23. title: "趋势榜 - 最近一月",
  24. },
  25. {
  26. id: "6943c7ee-cbc5-4f72-bc4e-f3371a8be9d5",
  27. title: "趋势榜 - 全部时间",
  28. },
  29. ],
  30. },
  31. {
  32. title: "最新榜",
  33. data: [
  34. {
  35. id: "cc14084a-2622-4c4b-8258-1f6b4b4f54b3",
  36. title: "最新榜",
  37. },
  38. ],
  39. },
  40. {
  41. title: "其他类别",
  42. data: [
  43. {
  44. id: "1ac7823f-8faf-474f-b14c-e4f7c7bb373f",
  45. title: "动物开会",
  46. },
  47. {
  48. id: '6713d315-3541-460d-8788-162cce241336',
  49. title: 'Lo-Fi'
  50. }
  51. ],
  52. },
  53. ];
  54. }
  55. async function getTopListDetail(topListItem) {
  56. const result = (await axios_1.default.get(`https://studio-api.suno.ai/api/playlist/${topListItem.id}/?page=0`, {
  57. headers
  58. })).data;
  59. return {
  60. isEnd: true,
  61. musicList: result.playlist_clips.map(it => {
  62. var _a, _b;
  63. const clip = it.clip;
  64. return {
  65. id: clip.id,
  66. url: clip.audio_url,
  67. artwork: clip.image_large_url || clip.image_url,
  68. duration: (_a = clip.metadata) === null || _a === void 0 ? void 0 : _a.duration,
  69. title: clip.title,
  70. artist: clip.display_name,
  71. userId: clip.user_id,
  72. rawLrc: (_b = clip.metadata) === null || _b === void 0 ? void 0 : _b.prompt
  73. };
  74. })
  75. };
  76. }
  77. async function getLyric(musicItem) {
  78. return {
  79. rawLrc: musicItem.rawLrc
  80. };
  81. }
  82. module.exports = {
  83. platform: "suno",
  84. version: "0.0.0",
  85. srcUrl: "https://gitee.com/maotoumao/MusicFreePlugins/raw/v0.1/dist/suno/index.js",
  86. cacheControl: "no-cache",
  87. getTopLists,
  88. getTopListDetail,
  89. getLyric
  90. };
  91. getTopListDetail({
  92. id: "1ac7823f-8faf-474f-b14c-e4f7c7bb373f",
  93. title: "最新榜",
  94. }).then(e => console.log(e.musicList[0]));