'更新'
This commit is contained in:
+5
-1
@@ -1,5 +1,6 @@
|
||||
const { API } = require('./config');
|
||||
const { fetchJSON } = require('./network');
|
||||
const { formatPersonNames } = require('./utils');
|
||||
|
||||
async function searchSongs(keyword, limit = 10) {
|
||||
const res = await fetchJSON(`${API.search}?keyword=${encodeURIComponent(keyword)}&limit=${limit}`);
|
||||
@@ -9,7 +10,10 @@ async function searchSongs(keyword, limit = 10) {
|
||||
}
|
||||
const songs = Array.isArray(res.data) ? res.data : (res.data?.songs || []);
|
||||
if (!songs.length) console.log('❌ 搜索无结果');
|
||||
return songs;
|
||||
return songs.map(song => ({
|
||||
...song,
|
||||
artists: formatPersonNames(song.artists),
|
||||
}));
|
||||
}
|
||||
|
||||
async function interactiveSearch(rl, ask) {
|
||||
|
||||
Reference in New Issue
Block a user