getSongUrl改为返回url

This commit is contained in:
史悦
2026-01-14 17:53:48 +08:00
parent e6a8f62bba
commit 87aa994365

View File

@@ -270,8 +270,15 @@
return { results: [], total: 0 };
}
},
getSongUrl: (id, source, br = '320k') => {
return `${API_BASE}?source=${source}&id=${id}&type=url&br=${br}`;
getSongUrl:async (id, source, br = '320k') => {
try {
const res = await fetch(`${API_BASE}?source=${source}&id=${id}&type=url&br=${br}`);
const data = await res.json();
return data.url;
} catch (e) {
console.error("Get song url failed", e);
return null;
}
},
getPicUrl: (id, source) => {
return `${API_BASE}?source=${source}&id=${id}&type=pic`;