refactor: 架构整固——分层单向化、全量 TypeScript、直接运行

- 移除 bd/mg 两平台及磁盘残留产物;清理 api-test 死脚本、musicSdk/message+options 死模块、infSign vendor
- musicSdk/ 改名 sdk/;src/common、src/auth、src/apis 整体移入 sdk/,依赖方向定为 src → sdk 严格单向
- src/ 手写 JS 全量转 .ts,删除 JS 类型垫片 modules.d.ts;源码 import 统一 .ts 后缀
- Node 原生类型剥离直接运行 .ts(engines >=22.18),取消 tsc 发射产物,tsc 仅类型检查(pnpm typecheck)
- 删除 kwdes 备用实现与 src/index.ts 转发垫片;测试移至 test/smoke-test.ts
- common/request.ts 补显式导出类型;修复 set-cookie 单值形态、ApiError 类字段等隐患

验证:tsc 零错误,smoke-test 41/41
This commit is contained in:
snowy-yang committed 2026-09-25 23:06:23 +08:00
1 parent c8c939aa32
commit 354df2e739
126 files changed
+413 -2942

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
// 各平台 URL 直连接口汇总
// 服务器环境固定使用内置直连接口(apiSource.value === 'internal')
// 外部聚合音源(sources/ 目录脚本)不走这里,由 sdk/api-source.ts 直接接入 source.ts
// 注意:index.js 为 tsc 就地发射产物(不入库);改逻辑只改本文件,然后 pnpm build
import kw from './kw.ts'
import kg from './kg.ts'
import tx from './tx.ts'
import wy from './wy.ts'
interface SongInfo {
songmid?: string
hash?: string
copyrightId?: string
[key: string]: any
}
interface MusicUrlResult {
type: string
url: string
}
interface ApiModule {
getMusicUrl?(songInfo: SongInfo, type: string): { promise: Promise<MusicUrlResult>; cancelHttp: () => void }
[key: string]: any
}
export default {
kw: kw as ApiModule,
kg: kg as ApiModule,
tx: tx as ApiModule,
wy: wy as ApiModule,
}
+86
View File
@@ -0,0 +1,86 @@
// 酷狗音乐 URL 获取(手机客户端通道)
// 接口: https://gateway.kugou.com/v5/url(x-router: trackercdn.kugou.com,android 签名)
// 登录后自动携带 token/userid(见 /login/kg);匿名仅能获取部分免费资源,
// VIP/受限资源会返回 status:2。quality: 128k→128, 320k→320, flac→flac, flac24bit→high
// 统一接口约定:apis('kg').getMusicUrl(songInfo, type) → { promise, cancelHttp }
// promise resolve → { type, url }
import crypto from 'node:crypto'
import { httpFetch } from '../common/request.ts'
import { getKgAuth } from '../auth/store.ts'
import { androidSign, getDevice } from '../auth/kg.ts'
const md5 = s => crypto.createHash('md5').update(s).digest('hex')
const SALT_KEY = '57ae12eb6890223e355ccfcb74edf70d'
const APPID = 1005
const CLIENTVER = 11430
const qualityMap = { '128k': '128', '320k': '320', flac: 'flac', flac24bit: 'high' }
export const getMusicUrl = (songInfo, type) => {
const requestObj = { cancelHttp() {}, promise: null as any }
const hash = (songInfo._types?.[type]?.hash || songInfo.hash || '').toLowerCase()
if (!hash) {
requestObj.promise = Promise.reject(new Error('缺少 hash'))
return requestObj
}
requestObj.cancelHttp = () => {} // 单次 GET,无需取消
requestObj.promise = (async() => {
const dev = getDevice()
const auth = getKgAuth()
const userid = Number(auth?.userid || 0)
const params: Record<string, any> = {
dfid: dev.dfid, mid: dev.mid, uuid: '-', appid: APPID, clientver: CLIENTVER,
clienttime: Math.floor(Date.now() / 1000),
album_id: Number(songInfo.albumId ?? 0),
area_code: 1,
hash,
ssa_flag: 'is_fromtrack',
version: CLIENTVER,
page_id: 151369488,
quality: qualityMap[type] ?? '128',
album_audio_id: Number(songInfo.songmid ?? 0),
behavior: 'play',
pid: 2,
cmd: 26,
pidversion: 3001,
IsFreePart: 0,
ppage_id: '463467626,350369493,788954147',
cdnBackup: 1,
module: '',
}
if (auth) {
params.token = auth.token
params.userid = userid
}
params.key = md5(`${hash}${SALT_KEY}${APPID}${dev.mid}${userid}`)
params.signature = androidSign(params)
const qs = Object.keys(params).map(k => `${k}=${encodeURIComponent(params[k])}`).join('&')
const r = await httpFetch(`https://gateway.kugou.com/v5/url?${qs}`, {
method: 'get',
headers: {
dfid: dev.dfid, mid: dev.mid, clienttime: String(params.clienttime),
'kg-rc': '1', 'kg-thash': '5d816a0', 'kg-rec': '1', 'kg-rf': 'B9EDA08A64250DEFFBCADDEE00F8F25F',
'x-router': 'trackercdn.kugou.com',
'User-Agent': 'Android15-1070-11083-46-0-DiscoveryDRADProtocol-wifi',
},
timeout: 15000,
}).promise
const body = r.body && typeof r.body === 'object' ? r.body : {}
if (body.status !== 1 || !Array.isArray(body.data)) {
throw new Error(body.error || (auth ? '获取失败' : '获取失败(该资源需要酷狗登录)'))
}
const item = body.data.find(d => d.url) ?? body.data[0]
const url = item?.url || item?.fallback
if (!url) throw new Error('获取失败')
return { type, url }
})()
return requestObj
}
export default { getMusicUrl }
+116
View File
@@ -0,0 +1,116 @@
// 酷我音乐 URL 获取(直连)
// 统一接口约定:apis('kw').getMusicUrl(songInfo, type) → { promise, cancelHttp }
// promise resolve → { type, url }
//
// 取流方案(按序回退):
// 1. antiserver.kuwo.cn/anti.s(convert_url3 老接口,无需 token,128k/320k 有效,
// 未登录时部分资源只返回试听片段)
// 2. www.kuwo.cn/api/v1/www/music/playUrl(需 csrf token,token 失效自动重取重试一次)
//
// 2026-09-19 实测结论(勿轻易改链):
// - mobi.kuwo.cn/mobi.s(DES 加密 query)已进防盗链蜜罐:
// 任意 rid(含不存在的)都返回 200 与 MP3 地址,但内容是《防盗链打击音频》假文件,
// 且响应无法与真实响应区分,故不接入默认链路;DES 实现可参考 UnblockNeteaseMusic 上游 kwDES。
// - playUrl 对新 token(Hm_Iuvt_* cookie)返回 "The request is illegal!"(要求签名),
// 首页也不再下发 kw_token,getToken 会失败——通道名存实亡,仅作最后回退。
// - flac 及以上音质各匿名通道均要求 VIP 登录态;接入酷我登录 token 后可重估 mobi.s。
import { httpFetch } from '../common/request.ts'
// 音质映射:128k → 128kmp3, 320k → 320kmp3, flac → flac(antiserver/mobi.s 用 mp3/flac 格式)
const qualityMap = {
'128k': { br: '128kmp3', format: 'mp3' },
'320k': { br: '320kmp3', format: 'mp3' },
flac: { br: 'flac', format: 'flac' },
flac24bit: { br: 'flac', format: 'flac' },
}
let token = ''
let tokenPromise: Promise<string> | null = null
/**
* 获取 kw csrf token(访问首页拿 cookie)
*/
const getToken = (retryNum = 0) => {
if (token) return Promise.resolve(token)
if (tokenPromise) return tokenPromise
tokenPromise = httpFetch('http://www.kuwo.cn/', {
method: 'get',
timeout: 15000,
}).promise.then(({ headers }) => {
tokenPromise = null
const match = ((headers['set-cookie'] as string[]) || []).join(';').match(/kw_token=(\w+)/)
if (!match) throw new Error('获取token失败')
token = match[1]
return token
}).catch(err => {
tokenPromise = null
if (retryNum > 2) throw err
return getToken(++retryNum)
})
return tokenPromise
}
/**
* 通过 antiserver 老接口获取(无需 token)
* @param {string} rid MUSIC_xxx
* @param {string} br 128kmp3 / 320kmp3 / flac
* @param {string} format mp3 / flac
*/
const getUrlByAntiServer = (rid, br, format) => {
return httpFetch(`http://antiserver.kuwo.cn/anti.s?type=convert_url3&rid=${rid}&format=${format}&response=url&br=${br}`, {
method: 'get',
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
},
timeout: 15000,
}).promise.then(({ statusCode, body }) => {
if (statusCode != 200 || typeof body != 'object' || body.code != 200 || !body.url) {
return Promise.reject(new Error(body?.msg || '获取失败'))
}
return body.url
})
}
/**
* 通过官方 playUrl 接口获取(需要 csrf token)
*/
const getUrlByPlayUrl = (songmid, br, retryNum = 0) => {
const requestObj = httpFetch(`http://www.kuwo.cn/api/v1/www/music/playUrl?mid=${songmid}&type=music&br=${br}`, {
method: 'get',
headers: {
csrf: token,
cookie: `kw_token=${token}`,
Referer: 'http://www.kuwo.cn/',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
},
timeout: 15000,
})
requestObj.promise = requestObj.promise.then(({ statusCode, body }) => {
if (statusCode != 200 || body.code != 200) {
// token 失效时重新获取再试一次
if (token && /token|403|401/.test(body?.msg || '') && retryNum == 0) {
token = ''
return getUrlByPlayUrl(songmid, br, ++retryNum).promise
}
return Promise.reject(new Error(body?.msg || '获取失败'))
}
if (!body.data?.url) return Promise.reject(new Error('获取失败'))
return body.data.url
})
return requestObj
}
export const getMusicUrl = (songInfo, type) => {
const requestObj = { cancelHttp() {}, promise: null as any }
const { br, format } = qualityMap[type] || qualityMap['128k']
const rid = `MUSIC_${songInfo.songmid}`
requestObj.promise = getUrlByAntiServer(rid, br, format).catch(() => {
// antiserver 无此音质(flac 常被拒)时回退官方接口
return getToken().then(() => getUrlByPlayUrl(songInfo.songmid, br).promise)
}).then(url => ({ type, url }))
return requestObj
}
export default { getMusicUrl }
+642
View File
@@ -0,0 +1,642 @@
// 外部聚合音源加载器(isolated-vm 硬隔离执行第三方脚本)
//
// 这是外部音源的唯一接入方式:在 isolated-vm 硬隔离沙箱中运行原始混淆脚本,
// 脚本的所有能力都经由本模块显式桥接的通道:
// - http:默认只放行脚本头部 SERVER_SCRIPT_CONFIG.apiUrl 同源请求,其余一律阻止
// - crypto / zlib / buffer:Node 侧实现,日志只记操作与长度,不记录密钥内容
// - 定时器 / console:桥接到 Node,随 isolate 销毁回收
// 对外接口:getMusicUrl(songInfo, type) → { promise, cancelHttp },与其它平台适配器一致。
// 脚本升版时只需替换 sources/ 目录下的脚本文件,无需改代码。
//
// 安全模型:
// - isolate 内存上限(memoryLimit),无 process/require/fs/网络直连能力
// - HTTP 出站默认拒绝(deny-all),白名单来自脚本自身声明的 apiUrl,可被 options 收紧或放宽
// - 每个音源 API 调用(on/send/request/utils/dispatch)都有日志,请求含耗时与状态
//
// 依赖:isolated-vm(未安装时工厂函数抛出明确错误)
// 用法:
// import { createIvmSource } from './source-ivm.ts'
// const source = await createIvmSource({ scriptPath }) // scriptPath 必填(sources/ 扫描逻辑见 source.js)
// const source = await createIvmSource({ scriptPath, http }) // http 可注入 mock 做离线测试
// await source.kw.getMusicUrl({ songmid: '123' }, '320k').promise
// await source.destroy()
//
// 已知边界(相对桌面端 preload 的差异):
// - source.request 回调的 resp 不含 raw/bytes(Buffer 无法跨隔离边界,实测脚本未使用)
// - formData 选项不支持(httpFetch 不支持 multipart)
// - updateAlert 事件仅记录到日志,不弹窗
import fs from 'node:fs'
import crypto from 'node:crypto'
import zlib from 'node:zlib'
import { httpFetch } from '../common/request.ts'
// 从脚本头部的 SERVER_SCRIPT_CONFIG 提取 apiUrl 声明,作为 HTTP 白名单缺省值。
// 兼容裸键(apiUrl:)与 JSON 风格("apiUrl":),并处理 \/ 转义
const extractAllowedOrigins = (script) => {
const origins: string[] = []
const re = /["']?apiUrl["']?\s*:\s*["'`]([^"'`\s]+)["'`]/g
let m
while ((m = re.exec(script))) {
try { origins.push(new URL(m[1].replace(/\\\//g, '/')).origin) } catch {}
}
return origins
}
const brief = (v, max = 72) => {
const s = typeof v === 'string' ? v : JSON.stringify(v) ?? String(v)
return s.length > max ? `${s.slice(0, max)}…(${s.length})` : s
}
// 从脚本头部注释解析 @name/@version 等(对齐音源脚本 currentScriptInfo)
const parseScriptInfo = (script, scriptPath) => {
const head = script.slice(0, 2000)
const pick = (key) => {
const m = new RegExp(`@${key}\\s+(.+)`).exec(head)
return m ? m[1].trim() : ''
}
return {
name: pick('name') || '未命名音源',
description: pick('description'),
version: pick('version') || '0',
author: pick('author'),
homepage: pick('homepage'),
rawScript: script,
path: scriptPath,
}
}
// 注入隔离环境的胶水层:提供音源脚本 API(globalThis.lx 为脚本契约名)、定时器、console、Bytes 包装。
// 与 Node 的数据交换一律走 JSON 字符串 / hex 字符串,避免跨隔离传输复杂对象。
const GLUE = `
'use strict'
var __currentDispatch = 0
var __pendingZlib = {}
var __timers = {}
// ---- Bytes 轻量包装(对齐 Buffer 的最小用法面)----
function __utf8Encode(str) {
var out = []
for (var i = 0; i < str.length; i++) {
var c = str.charCodeAt(i)
if (c >= 0xD800 && c <= 0xDBFF && i + 1 < str.length) {
var c2 = str.charCodeAt(i + 1)
if (c2 >= 0xDC00 && c2 <= 0xDFFF) { c = 0x10000 + ((c - 0xD800) << 10) + (c2 - 0xDC00); i++ }
}
if (c < 0x80) out.push(c)
else if (c < 0x800) out.push(0xC0 | (c >> 6), 0x80 | (c & 63))
else if (c < 0x10000) out.push(0xE0 | (c >> 12), 0x80 | ((c >> 6) & 63), 0x80 | (c & 63))
else out.push(0xF0 | (c >> 18), 0x80 | ((c >> 12) & 63), 0x80 | ((c >> 6) & 63), 0x80 | (c & 63))
}
return out
}
function __utf8Decode(bytes) {
var out = ''
for (var i = 0; i < bytes.length;) {
var b = bytes[i], cp
if (b < 0x80) { cp = b; i += 1 }
else if (b < 0xE0) { cp = ((b & 31) << 6) | (bytes[i + 1] & 63); i += 2 }
else if (b < 0xF0) { cp = ((b & 15) << 12) | ((bytes[i + 1] & 63) << 6) | (bytes[i + 2] & 63); i += 3 }
else { cp = ((b & 7) << 18) | ((bytes[i + 1] & 63) << 12) | ((bytes[i + 2] & 63) << 6) | (bytes[i + 3] & 63); i += 4 }
if (cp > 0xFFFF) { cp -= 0x10000; out += String.fromCharCode(0xD800 + (cp >> 10), 0xDC00 + (cp & 0x3FF)) }
else out += String.fromCharCode(cp)
}
return out
}
function __bytesToBase64(bytes) {
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', out = ''
for (var i = 0; i < bytes.length; i += 3) {
var b0 = bytes[i], b1 = bytes[i + 1], b2 = bytes[i + 2]
out += chars[b0 >> 2]
out += chars[((b0 & 3) << 4) | ((b1 === undefined ? 0 : b1) >> 4)]
out += b1 === undefined ? '=' : chars[((b1 & 15) << 2) | ((b2 === undefined ? 0 : b2) >> 6)]
out += b2 === undefined ? '=' : chars[b2 & 63]
}
return out
}
function __base64ToBytes(b64) {
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', out = []
b64 = String(b64).replace(/[^A-Za-z0-9+/]/g, '')
for (var i = 0; i < b64.length; i += 4) {
var n = (chars.indexOf(b64[i]) << 18) | (chars.indexOf(b64[i + 1]) << 12) |
((chars.indexOf(b64[i + 2]) & 63) << 6) | (chars.indexOf(b64[i + 3]) & 63)
out.push((n >> 16) & 255)
if (b64[i + 2] && b64[i + 2] !== '=') out.push((n >> 8) & 255)
if (b64[i + 3] && b64[i + 3] !== '=') out.push(n & 255)
}
return out
}
function __hexToBytes(hex) {
var out = []
for (var i = 0; i + 1 < hex.length; i += 2) out.push(parseInt(hex.substr(i, 2), 16))
return out
}
function __bytesToHex(bytes) {
var out = ''
for (var i = 0; i < bytes.length; i++) out += ((bytes[i] & 255) < 16 ? '0' : '') + (bytes[i] & 255).toString(16)
return out
}
globalThis.__Bytes = function (bytes) { this._b = bytes }
globalThis.__Bytes.prototype.length = 0
Object.defineProperty(globalThis.__Bytes.prototype, 'length', {
get: function () { return this._b.length },
})
globalThis.__Bytes.prototype.toString = function (enc) {
enc = String(enc || 'utf8').toLowerCase()
if (enc === 'hex') return __bytesToHex(this._b)
if (enc === 'base64') return __bytesToBase64(this._b)
if (enc === 'binary' || enc === 'latin1') {
var s = ''
for (var i = 0; i < this._b.length; i++) s += String.fromCharCode(this._b[i] & 255)
return s
}
return __utf8Decode(this._b)
}
globalThis.__Bytes.prototype.slice = function (start, end) {
return new __Bytes(this._b.slice(start || 0, end === undefined || end === null ? undefined : end))
}
globalThis.__Bytes.prototype.toJSON = function () { return this.toString('utf8') }
function __toHex(data) {
if (data instanceof __Bytes) return data.toString('hex')
if (typeof data === 'string') return __bytesToHex(__utf8Encode(data))
if (data && typeof data.length === 'number') {
var out = ''
for (var i = 0; i < data.length; i++) out += ((data[i] & 255) < 16 ? '0' : '') + (data[i] & 255).toString(16)
return out
}
return ''
}
function __fromAny(data, enc) {
if (data instanceof __Bytes) return new __Bytes(data._b.slice())
if (typeof data === 'string') {
enc = String(enc || 'utf8').toLowerCase()
if (enc === 'hex') return new __Bytes(__hexToBytes(data))
if (enc === 'base64') return new __Bytes(__base64ToBytes(data))
if (enc === 'binary' || enc === 'latin1') {
var out = []
for (var i = 0; i < data.length; i++) out.push(data.charCodeAt(i) & 255)
return new __Bytes(out)
}
return new __Bytes(__utf8Encode(data))
}
return new __Bytes(Array.prototype.slice.call(data || []))
}
// ---- console / 定时器桥接 ----
globalThis.console = {
log: function () { __log('[source] ' + Array.prototype.map.call(arguments, String).join(' ')) },
info: function () { __log('[source] ' + Array.prototype.map.call(arguments, String).join(' ')) },
warn: function () { __log('[source] ' + Array.prototype.map.call(arguments, String).join(' ')) },
error: function () { __log('[source] ' + Array.prototype.map.call(arguments, String).join(' ')) },
debug: function () {},
}
globalThis.setTimeout = function (fn, ms) {
var id = __newTimer(fn, Array.prototype.slice.call(arguments, 2), false)
__startTimer(id, Number(ms) || 0, false)
return id
}
globalThis.clearTimeout = function (id) { __clearTimer(id) }
globalThis.setInterval = function (fn, ms) {
var id = __newTimer(fn, [], true)
__startTimer(id, Number(ms) || 1, true)
return id
}
globalThis.clearInterval = function (id) { __clearTimer(id) }
function __newTimer(fn, args, interval) {
var id = Date.now() % 100000000 + Math.floor(Math.random() * 100000000)
__timers[id] = { fn: fn, args: args, interval: interval }
return id
}
function __clearTimer(id) {
if (__timers[id]) { delete __timers[id]; __stopTimer(id) }
}
globalThis.__fireTimer = function (id) {
var t = __timers[id]
if (!t) return
if (!t.interval) delete __timers[id]
try { t.fn.apply(undefined, t.args) } catch (e) { __log('timer error: ' + (e && e.message)) }
}
// ---- 音源脚本 preload API ----
// 注意:globalThis.lx 是第三方脚本依赖的 API 契约名(脚本内部调用 lx.on/source.request 等),
// 属于对外兼容接口而非命名残留,不可改动,否则脚本初始化直接失败。
var __EVENT_NAMES = { request: 'request', inited: 'inited', updateAlert: 'updateAlert' }
var __handlers = {}
globalThis.lx = {
EVENT_NAMES: __EVENT_NAMES,
version: '2.0.0',
env: 'desktop',
currentScriptInfo: __scriptInfo,
on: function (name, handler) {
if (name !== __EVENT_NAMES.request) return Promise.reject(new Error('The event is not supported: ' + name))
__handlers[name] = handler
__on(String(name))
return Promise.resolve()
},
send: function (name, data) {
if (name !== __EVENT_NAMES.inited && name !== __EVENT_NAMES.updateAlert) {
return Promise.reject(new Error('The event is not supported: ' + name))
}
var err = __send(String(name), JSON.stringify(data === undefined ? null : data))
return err ? Promise.reject(new Error(err)) : Promise.resolve()
},
request: function (url, options, callback) { return __sourceRequest(url, options, callback, __currentDispatch) },
utils: {
crypto: {
md5: function (str) { return __md5(str) },
randomBytes: function (size) { return new __Bytes(__hexToBytes(__randomBytesHex(size))) },
aesEncrypt: function (buffer, mode, key, iv) {
return new __Bytes(__hexToBytes(__aesEncryptHex(__toHex(buffer), String(mode), __toHex(key), __toHex(iv))))
},
rsaEncrypt: function (buffer, key) {
return new __Bytes(__hexToBytes(__rsaEncryptHex(__toHex(buffer), String(key))))
},
},
buffer: {
from: function (data, enc) {
__log('source.utils.buffer.from(' + (data instanceof __Bytes ? 'Bytes(' + data.length + ')' : typeof data + (data && data.length !== undefined ? '[' + data.length + ']' : '')) + (enc ? ',' + enc : '') + ')')
return __fromAny(data, enc)
},
bufToString: function (buf, format) {
__log('source.utils.buffer.bufToString(' + (buf && buf.length !== undefined ? buf.length + 'B' : typeof buf) + ',' + (format || 'utf8') + ')')
return buf.toString(format || 'utf8')
},
},
zlib: {
inflate: function (buf) { return __zlibAsync('inflate', buf) },
deflate: function (data) { return __zlibAsync('deflate', data) },
},
},
}
// 隔离环境内不依赖 ivm 全局:回调统一走「隔离内注册表 + 自增 id」,
// Node 侧通过 jail.get 拿到 __completeHttp 等入口反调
function __sourceRequest(url, options, callback, dispatchId) {
options = options || {}
var payload = {
method: options.method || 'get',
timeout: options.timeout,
headers: options.headers || null,
body: options.body === undefined || options.body === null ? null :
(typeof options.body === 'string' ? options.body : JSON.stringify(options.body)),
form: options.form ? JSON.stringify(options.form) : null,
}
var cbId = ++__seq
__pendingCbs[cbId] = callback
var reqId = __http(dispatchId | 0, String(url), JSON.stringify(payload), cbId)
return function () { __cancelHttp(reqId) }
}
var __pendingCbs = {}
globalThis.__completeHttp = function (cbId, errMsg, respJson, bodyJson) {
var cb = __pendingCbs[cbId]
if (!cb) return
delete __pendingCbs[cbId]
try {
if (errMsg) cb.call(lx, new Error(errMsg), null, null)
else cb.call(lx, null, respJson === null ? null : JSON.parse(respJson), bodyJson === null ? null : JSON.parse(bodyJson))
} catch (e) { __log('request callback error: ' + (e && e.message)) }
}
function __zlibAsync(op, data) {
return new Promise(function (resolve, reject) {
var opId = ++__seqCounter()
__pendingZlib[opId] = { resolve: resolve, reject: reject }
__zlib(opId, op, __toHex(data))
})
}
var __seq = 0
function __seqCounter() { return ++__seq }
globalThis.__zlibDone = function (opId, errMsg, valHex) {
var p = __pendingZlib[opId]
if (!p) return
delete __pendingZlib[opId]
if (errMsg) p.reject(new Error(errMsg))
else p.resolve(new __Bytes(__hexToBytes(valHex)))
}
// ---- 请求分发(Node 侧调用)----
// 注意:本函数必须不返回值(结果经 __dispatchResult 回传),
// 否则 apply 会尝试克隆隔离内 Promise 而报 "could not be cloned"
globalThis.__dispatch = function (dispatchId, payloadJson) {
var payload = JSON.parse(payloadJson)
__currentDispatch = dispatchId | 0
var p
try {
var handler = __handlers[__EVENT_NAMES.request]
if (!handler) p = Promise.reject(new Error('request handler 未注册'))
else p = Promise.resolve().then(function () { return handler(payload) })
} catch (e) {
p = Promise.reject(e)
}
__currentDispatch = 0
p.then(function (result) {
if (payload.action === 'musicUrl') return JSON.stringify({ ok: true, url: result === undefined ? null : String(result) })
return JSON.stringify({ ok: true, data: result === undefined ? null : result })
}, function (err) {
return JSON.stringify({ ok: false, message: err && err.message ? String(err.message) : String(err) })
}).then(function (resultJson) {
__dispatchResult(dispatchId | 0, resultJson)
}, function (err) {
__dispatchResult(dispatchId | 0, JSON.stringify({ ok: false, message: String(err && err.message || err) }))
})
}
`
/**
* 创建隔离执行的外部音源
* @param {object} [options]
* @param {string} options.scriptPath 音源脚本路径(必填,sources/ 目录扫描逻辑见 source.js)
* @param {Function} [options.http] http 实现,默认项目统一 httpFetch;测试可注入 mock
* @param {number} [options.memoryLimit] 隔离内存上限 MB,默认 256
* @param {number} [options.initTimeout] 等待脚本上报 inited 的超时 ms,默认 10000
* @param {number} [options.requestTimeout] 单次取流超时 ms,默认 15000
* @param {boolean|Function} [options.log] 日志开关;true(默认)输出到 console,可传自定义 (msg)=>void,false 关闭
* @param {string[]} [options.allowedOrigins] HTTP 白名单 origin;缺省取脚本 SERVER_SCRIPT_CONFIG.apiUrl 同源
* @param {Function} [options.httpFilter] 自定义放行判定 (url) => boolean;提供时优先于 origin 白名单
* @param {boolean} [options.allowAllHttp] 放行全部 http 请求(调试用,默认 false)
* @returns {{ env: string, scriptInfo: object, inited: object|null, apis: object, allowedOrigins: string[], destroy: Function }}
*/
export const createIvmSource = async({
scriptPath,
http: httpImpl = httpFetch,
memoryLimit = 256,
initTimeout = 10000,
requestTimeout = 15000,
log: logOption = true,
allowedOrigins,
httpFilter,
allowAllHttp = false,
}: Record<string, any> = {}) => {
let ivm
try {
ivm = (await import('isolated-vm')).default
} catch {
throw new Error('未安装 isolated-vm,无法启用隔离执行音源:pnpm add isolated-vm')
}
if (!scriptPath) throw new Error('缺少音源脚本路径 scriptPath(sources/ 目录扫描逻辑见 source.js)')
const script = fs.readFileSync(scriptPath, 'utf8')
const scriptInfo = parseScriptInfo(script, scriptPath)
// ---- 日志与 HTTP 白名单 ----
const log = typeof logOption === 'function'
? logOption
: logOption === false
? () => {}
: (msg) => console.log('[source-ivm]', msg)
const scriptOrigins = extractAllowedOrigins(script)
const origins = (allowedOrigins ?? scriptOrigins).map(o => String(o).replace(/\/+$/, ''))
const httpAllowed = (urlStr) => {
if (allowAllHttp) return true
if (httpFilter) return !!httpFilter(urlStr)
try { return origins.includes(new URL(urlStr).origin) } catch { return false }
}
log(`加载脚本 ${scriptPath}(http 白名单: ${origins.join(', ') || '(空, 全部阻止)'}${allowAllHttp ? ' + allowAllHttp' : ''}${httpFilter ? ' + httpFilter' : ''})`)
const isolate = new ivm.Isolate({ memoryLimit })
// afterEvaluate:每次外部调用返回后推进隔离内的微任务队列,否则脚本内的 Promise 链永远不会执行
const context = await isolate.createContext({ microtaskMode: 'afterEvaluate' })
const jail = context.global
// ---- Node 侧状态 ----
const state: Record<string, any> = {
inited: null,
updateAlerts: [],
onRegistered: null,
initWaiters: [],
}
const pendingDispatch = new Map() // dispatchId -> { resolve, reject }
const httpRequests = new Map() // reqId -> requestObj
const dispatchHttp = new Map() // dispatchId -> Set<requestObj>
const nodeTimers = new Map() // timerId -> timeout对象
let httpSeq = 0
let dispatchSeq = 0
let disposed = false
const forgetHttp = (reqId, dispatchId, requestObj) => {
httpRequests.delete(reqId)
const set = dispatchHttp.get(dispatchId)
if (set) { set.delete(requestObj); if (!set.size) dispatchHttp.delete(dispatchId) }
}
// jail.get 拿到的是 ivm.Function:apply 为同步调用(async 选项无效),
// 隔离内异步结果一律经回调(__dispatchResult/__completeHttp 等)传回
const safeApply = (fnRef, args) => {
if (disposed) return
try {
fnRef.apply(undefined, args)
} catch (err) {
log(`isolate 调用失败: ${(err as any)?.message}`)
}
}
// ---- 桥接回调(Node ← isolate)----
await jail.set('__log', new ivm.Callback((msg) => log(String(msg))))
await jail.set('__on', new ivm.Callback((name) => {
state.onRegistered = name
log(`source.on(${String(name)})`)
}))
await jail.set('__send', new ivm.Callback((name, dataJson) => {
let data = null
try { data = JSON.parse(dataJson) } catch {}
log(`source.send(${String(name)}) ${brief(dataJson ?? '')}`)
if (name === 'inited') {
state.inited = data
const waiters = state.initWaiters.splice(0)
waiters.forEach(w => w.resolve(data))
} else if (name === 'updateAlert') {
state.updateAlerts.push(data)
}
return '' // 非空字符串会以异常形式抛回 isolate
}))
await jail.set('__dispatchResult', new ivm.Callback((dispatchId, resultJson) => {
const p = pendingDispatch.get(dispatchId)
if (!p) return
pendingDispatch.delete(dispatchId)
let parsed
try { parsed = JSON.parse(resultJson) } catch (err) { p.reject(err); return }
if (parsed.ok) p.resolve(parsed)
else p.reject(new Error(parsed.message || '获取失败'))
}))
await jail.set('__md5', new ivm.Callback((str) => {
log(`source.utils.crypto.md5(${brief(str)})`)
return crypto.createHash('md5').update(String(str)).digest('hex')
}))
await jail.set('__randomBytesHex', new ivm.Callback((size) => {
log(`source.utils.crypto.randomBytes(${size})`)
return crypto.randomBytes(size).toString('hex')
}))
await jail.set('__aesEncryptHex', new ivm.Callback((hexBuf, mode, hexKey, hexIv) => {
log(`source.utils.crypto.aesEncrypt(${Buffer.from(hexBuf, 'hex').length}B, ${mode})`)
const cipher = crypto.createCipheriv(mode, Buffer.from(hexKey, 'hex'), Buffer.from(hexIv, 'hex'))
return Buffer.concat([cipher.update(Buffer.from(hexBuf, 'hex')), cipher.final()]).toString('hex')
}))
await jail.set('__rsaEncryptHex', new ivm.Callback((hexBuf, pemKey) => {
log(`source.utils.crypto.rsaEncrypt(${Buffer.from(hexBuf, 'hex').length}B, key=${brief(pemKey, 24)})`)
let buf = Buffer.from(hexBuf, 'hex')
buf = Buffer.concat([Buffer.alloc(128 - buf.length), buf])
return crypto.publicEncrypt({ key: pemKey, padding: crypto.constants.RSA_NO_PADDING }, buf).toString('hex')
}))
await jail.set('__zlib', new ivm.Callback((opId, op, hex) => {
log(`source.utils.zlib.${op}(${Buffer.from(hex, 'hex').length}B)`)
const buf = Buffer.from(hex, 'hex')
zlib[op](buf, (err, out) => {
safeApply(zlibDoneRef, [opId, err ? String(err.message) : null, err ? '' : out.toString('hex')])
})
}))
await jail.set('__http', new ivm.Callback((dispatchId, url, optionsJson, cbId) => {
const reqId = ++httpSeq
const opts = JSON.parse(optionsJson)
const method = String(opts.method || 'get').toUpperCase()
if (!httpAllowed(url)) {
log(`✋ source.request ${method} ${url} → 已阻止(不在白名单)`)
safeApply(completeHttpRef, [cbId, `http blocked by allowlist: ${url}`, null, null])
return reqId
}
log(`→ source.request ${method} ${brief(url, 120)}`)
const startedAt = Date.now()
const options: Record<string, any> = {
method: opts.method || 'get',
timeout: typeof opts.timeout === 'number' && opts.timeout > 0 ? opts.timeout : 15000,
}
if (opts.headers) options.headers = opts.headers
if (opts.body) options.body = opts.body
if (opts.form) options.form = JSON.parse(opts.form)
const requestObj = httpImpl(String(url), options)
httpRequests.set(reqId, requestObj)
if (!dispatchHttp.has(dispatchId)) dispatchHttp.set(dispatchId, new Set())
dispatchHttp.get(dispatchId).add(requestObj)
requestObj.promise.then(({ statusCode, statusMessage, headers, body }) => {
log(`← source.request ${method} ${brief(url, 80)} → ${statusCode}(${Date.now() - startedAt}ms)`)
forgetHttp(reqId, dispatchId, requestObj)
const resp = { statusCode, statusMessage: statusMessage || '', headers: headers || {}, body }
return safeApply(completeHttpRef, [cbId, null, JSON.stringify(resp), JSON.stringify(body === undefined ? null : body)])
}).catch(err => {
log(`← source.request ${method} ${brief(url, 80)} → 失败(${Date.now() - startedAt}ms)${err?.message ? ' ' + err.message : ''}`)
forgetHttp(reqId, dispatchId, requestObj)
return safeApply(completeHttpRef, [cbId, String(err && err.message || err), null, null])
})
return reqId
}))
await jail.set('__cancelHttp', new ivm.Callback((reqId) => {
const requestObj = httpRequests.get(reqId)
if (requestObj) requestObj.cancelHttp()
}))
await jail.set('__startTimer', new ivm.Callback((id, ms, interval) => {
const timerRef = interval
? setInterval(() => safeApply(fireTimerRef, [id]), Math.max(1, ms))
: setTimeout(() => safeApply(fireTimerRef, [id]), Math.max(0, ms))
if (interval && typeof timerRef.unref === 'function') timerRef.unref()
nodeTimers.set(id, timerRef)
}))
await jail.set('__stopTimer', new ivm.Callback((id) => {
const t = nodeTimers.get(id)
if (t) { clearTimeout(t); clearInterval(t); nodeTimers.delete(id) }
}))
// ---- 注入胶水层与脚本元信息,再加载目标脚本 ----
await jail.set('__scriptInfo', new ivm.ExternalCopy(scriptInfo).copyInto())
await jail.set('SCRIPT_MD5', crypto.createHash('md5').update(script).digest('hex'))
await context.eval(GLUE)
const fireTimerRef = await jail.get('__fireTimer')
const zlibDoneRef = await jail.get('__zlibDone')
const completeHttpRef = await jail.get('__completeHttp')
const dispatchRef = await jail.get('__dispatch')
await context.eval(script, { async: true, timeout: 15000 })
// ---- 对外 dispatch ----
const dispatch = (payload: any): { id: number; promise: Promise<any> } => {
if (disposed) return Promise.reject(new Error('isolate 已销毁')) as any
const id = ++dispatchSeq
return {
id,
promise: new Promise((resolve, reject) => {
pendingDispatch.set(id, { resolve, reject })
try {
dispatchRef.apply(undefined, [id, JSON.stringify(payload)])
} catch (err) {
if (pendingDispatch.delete(id)) reject(err)
}
}),
}
}
const getMusicUrlFor = (source) => (songInfo, type) => {
const requestObj = { cancelHttp() {}, promise: null as any }
const id = songInfo?.hash || songInfo?.songmid || '?'
const dispatched = dispatch({ source, action: 'musicUrl', info: { type, musicInfo: songInfo } })
const startedAt = Date.now()
log(`▶ getMusicUrl ${source}/${type} id=${id}(dispatch #${dispatched.id})`)
requestObj.cancelHttp = () => {
const set = dispatchHttp.get(dispatched.id)
if (set) [...set].forEach(r => r.cancelHttp())
}
requestObj.promise = new Promise((resolve, reject) => {
const timer = setTimeout(() => {
requestObj.cancelHttp()
pendingDispatch.delete(dispatched.id)
reject(new Error(`请求超时 (${requestTimeout}ms)`))
}, requestTimeout)
timer.unref?.()
dispatched.promise.then(result => {
clearTimeout(timer)
log(`✔ getMusicUrl ${source}/${type} 完成(${Date.now() - startedAt}ms)`)
if (!result.url) reject(new Error('响应无播放地址'))
else resolve({ type, url: result.url })
}, err => {
clearTimeout(timer)
log(`✖ getMusicUrl ${source}/${type} 失败(${Date.now() - startedAt}ms)${err?.message || ''}`)
reject(err)
})
})
return requestObj
}
// ---- 等待脚本 inited ----
const inited = await new Promise<any>((resolve, reject) => {
if (state.inited) return resolve(state.inited)
const waiter = { resolve, reject }
state.initWaiters.push(waiter)
const t = setTimeout(() => {
const i = state.initWaiters.indexOf(waiter)
if (i >= 0) state.initWaiters.splice(i, 1)
reject(new Error(`脚本 ${initTimeout}ms 内未上报 inited(handler 注册: ${state.onRegistered || '无'})`))
}, initTimeout)
t.unref?.()
}).catch(async err => {
await destroy()
throw err
})
// 按脚本上报的 sources 生成分平台接口(过滤 local 这类服务器侧无意义条目仍保留键,但 local 无 qualitys)
const reportedSources = inited?.sources && typeof inited.sources === 'object' ? Object.keys(inited.sources) : []
const sources = reportedSources.length ? reportedSources : ['kw', 'kg', 'tx', 'wy']
const apis = {}
for (const s of sources) apis[s] = { getMusicUrl: getMusicUrlFor(s) }
function destroy() {
if (disposed) return Promise.resolve()
disposed = true
for (const t of nodeTimers.values()) { clearTimeout(t); clearInterval(t) }
nodeTimers.clear()
for (const r of httpRequests.values()) { try { r.cancelHttp() } catch {} }
httpRequests.clear()
dispatchHttp.clear()
for (const p of pendingDispatch.values()) p.reject(new Error('isolate 已销毁'))
pendingDispatch.clear()
for (const w of state.initWaiters.splice(0)) w.reject(new Error('isolate 已销毁'))
try { isolate.dispose() } catch {}
return Promise.resolve()
}
return {
env: 'isolated-vm',
scriptInfo: { name: scriptInfo.name, version: scriptInfo.version, author: scriptInfo.author, path: scriptPath },
inited,
apis,
allowedOrigins: origins,
...apis,
destroy,
}
}
export default { createIvmSource }
+76
View File
@@ -0,0 +1,76 @@
// 外部聚合音源统一入口(isolated-vm 懒加载封装)
// 内部委托 source-ivm.ts 在硬隔离沙箱中执行音源脚本。
// 首次调用 getMusicUrl 时才加载并初始化隔离环境,后续复用同一实例。
// 统一接口约定:source.kw.getMusicUrl(songInfo, type) → { promise, cancelHttp },resolve → { type, url }
//
// 脚本来源(优先级):
// 1. 环境变量 SOURCE_SCRIPT_PATH 指定的脚本文件
// 2. sources/ 目录下按文件名排序的第一个 .js(脚本文件不入库,见 .gitignore)
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { createIvmSource } from './source-ivm.ts'
export const SOURCES = ['kw', 'kg', 'tx', 'wy']
const SOURCES_DIR = fileURLToPath(new URL('../../sources/', import.meta.url))
const resolveScriptPath = () => {
const custom = process.env.SOURCE_SCRIPT_PATH
if (custom) return custom
if (!fs.existsSync(SOURCES_DIR)) {
throw new Error(`音源目录不存在: ${SOURCES_DIR}(将脚本放入 sources/ 目录,或用 SOURCE_SCRIPT_PATH 指定)`)
}
const files = fs.readdirSync(SOURCES_DIR).filter(f => f.toLowerCase().endsWith('.js')).sort()
if (!files.length) {
throw new Error('sources/ 目录下没有 .js 音源脚本(将脚本放入该目录,或用 SOURCE_SCRIPT_PATH 指定)')
}
if (files.length > 1) {
console.log(`[source] sources/ 下有 ${files.length} 个脚本,使用 ${files[0]}(可用 SOURCE_SCRIPT_PATH 指定)`)
}
return path.join(SOURCES_DIR, files[0])
}
let sharedPromise: Promise<any> | null = null
const getShared = () => {
if (!sharedPromise) {
// 配置可经环境变量调整,与项目其它适配器保持一致风格
sharedPromise = createIvmSource({
scriptPath: resolveScriptPath(),
log: process.env.SOURCE_LOG !== '0',
allowAllHttp: process.env.SOURCE_ALLOW_ALL_HTTP === '1',
}).catch(err => {
sharedPromise = null // 失败允许下次重试
throw err
})
}
return sharedPromise
}
const apiFor = (source) => ({
getMusicUrl(songInfo, type) {
const requestObj = { cancelHttp() {}, promise: null as any }
let inner: any = null
requestObj.cancelHttp = () => inner?.cancelHttp()
requestObj.promise = (async () => {
const api = await getShared()
if (!api[source]) throw new Error(`脚本不支持的平台: ${source}`)
inner = api[source].getMusicUrl(songInfo, type)
return inner.promise
})()
return requestObj
},
})
// 兼容导出:sdk/api-source.ts 以 createApi(source) 方式接入聚合音源
export const createApi = apiFor
const sourceApi: Record<string, any> = {}
for (const s of SOURCES) sourceApi[s] = apiFor(s)
// 预热:提前触发脚本加载与初始化(可选调用)
sourceApi.init = getShared
export default sourceApi
+87
View File
@@ -0,0 +1,87 @@
// QQ音乐 URL 获取(直连)
// 接口: https://u.y.qq.com/cgi-bin/musicu.fcg
// 方法: vkey.GetVkeyServer.CgiGetVkey
// 取流方案:
// 按请求音质组 filename 链一次请求(M500{media_mid}.mp3 / M800{media_mid}.mp3 / F000{media_mid}.flac),
// 响应 midurlinfo 与 filename 一一对应,取第一个有 purl 的(即最高可用音质);
// 始终附带 C400{songmid}.m4a 保底(匿名可取的 128k)。
// 登录 cookie(uin + qm_keyst,见 /login/tx)可解锁 320k/无损。
// 统一接口约定:apis('tx').getMusicUrl(songInfo, type) → { promise, cancelHttp }
// promise resolve → { type, url }(type 为实际命中的音质,可能低于请求值)
import { httpFetch } from '../common/request.ts'
import { getTxAuth } from '../auth/store.ts'
// 音质 → [文件前缀, 扩展名](flac24bit 暂走 flac 通道,命中即返回)
const prefixMap = {
'128k': ['M500', 'mp3'],
'320k': ['M800', 'mp3'],
flac: ['F000', 'flac'],
flac24bit: ['F000', 'flac'],
}
// 降级链:高音质无版权/VIP 受限时逐级回退
const chainMap = {
'128k': ['128k'],
'320k': ['320k', '128k'],
flac: ['flac', '320k', '128k'],
flac24bit: ['flac', '320k', '128k'],
}
export const getMusicUrl = (songInfo, type) => {
const requestObj = { cancelHttp() {}, promise: null as any }
const mediaMid = songInfo.strMediaMid || songInfo.songmid
const entries: any[] = []
for (const t of chainMap[type] || chainMap['128k']) {
const [prefix, ext] = prefixMap[t]
entries.push({ filename: `${prefix}${mediaMid}.${ext}`, type: t })
}
entries.push({ filename: `C400${songInfo.songmid}.m4a`, type: '128k' })
const auth = getTxAuth()
const uin = auth?.uin || '0'
const data = {
comm: { ct: '19', cv: '1859', uin },
req: {
module: 'vkey.GetVkeyServer',
method: 'CgiGetVkey',
param: {
guid: '7342827269',
songmid: [songInfo.songmid],
filename: entries.map(e => e.filename),
songtype: [0],
uin,
loginflag: 1,
platform: '20',
needNewCode: 1,
},
},
}
requestObj.promise = httpFetch('https://u.y.qq.com/cgi-bin/musicu.fcg', {
method: 'post',
headers: {
'User-Agent': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)',
Referer: 'https://y.qq.com/',
...(auth ? { cookie: auth.cookie } : {}),
},
body: data,
timeout: 15000,
}).promise.then(({ statusCode, body }) => {
if (statusCode != 200 || body.code != 0 || body.req?.code != 0) {
return Promise.reject(new Error('获取失败'))
}
const data = body.req.data
const sip = data.sip?.[0] || 'http://aqqmusic.tc.qq.com/'
const infos = data.midurlinfo || []
const idx = infos.findIndex(info => info.purl)
if (idx >= 0) {
return { type: entries[idx]?.type || '128k', url: `${sip}${infos[idx].purl}` }
}
// 全部受限(VIP 歌匿名)时回退试听地址(服务器返回的 128k m4a 试听文件)
if (data.testfile2g) return { type: '128k', url: `${sip}${data.testfile2g}` }
return Promise.reject(new Error('获取失败'))
})
return requestObj
}
export default { getMusicUrl }
+48
View File
@@ -0,0 +1,48 @@
// 网易云音乐 URL 获取(直连)
// 接口: https://interface3.music.163.com/eapi/song/enhance/player/url/v1(eapi 加密请求,响应为明文 JSON)
// 音质: 128k → standard, 320k → exhigh, flac → lossless
// 统一接口约定:apis('wy').getMusicUrl(songInfo, type) → { promise, cancelHttp }
// promise resolve → { type, url }
import { httpFetch } from '../common/request.ts'
// crypto.js 为 tsc 就地发射产物(源 sdk/wy/utils/crypto.ts);统一走 .js,避免同进程出现 .ts/.js 双实例
import { eapi } from '../wy/utils/crypto.ts'
import { getWyCookie } from '../auth/store.ts'
const levelMap = {
'128k': 'standard',
'320k': 'exhigh',
flac: 'lossless',
flac24bit: 'hires',
}
export const getMusicUrl = (songInfo, type) => {
const requestObj = { cancelHttp() {}, promise: null as any }
const data = {
ids: `[${songInfo.songmid}]`,
level: levelMap[type] || 'standard',
encodeType: 'flac',
}
const cookie = getWyCookie()
const request = httpFetch('https://interface3.music.163.com/eapi/song/enhance/player/url/v1', {
method: 'post',
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
origin: 'https://music.163.com',
...(cookie ? { cookie } : {}),
},
form: eapi('/api/song/enhance/player/url/v1', data),
timeout: 15000,
})
requestObj.promise = request.promise.then(({ statusCode, body }) => {
if (statusCode != 200 || body.code != 200) {
return Promise.reject(new Error('获取失败'))
}
const item = body.data?.[0]
if (!item?.url) return Promise.reject(new Error('获取失败'))
return { type, url: item.url }
})
return requestObj
}
export default { getMusicUrl }