diff --git a/index.html b/index.html index 1eb437b..1c4bca4 100644 --- a/index.html +++ b/index.html @@ -231,6 +231,21 @@ { id: '6666', name: '飙升榜', cover: 'http://imge.kugou.com/mcommon/400/20150331/20150331161100806437.png' } ] }; + + try { + const res = await fetch(`${API_BASE}/api/?source=${source}&type=toplists`); + const data = await res.json(); + if (data.code === 200) { + // 兼容多种返回结构:data本身是数组,或者data.list是数组 + const list = Array.isArray(data.data) ? data.data : (data.data?.list || data.data?.topList || []); + if (Array.isArray(list) && list.length > 0) { + return list; + } + } + } catch (e) { + console.warn("Failed to fetch remote toplists, falling back to local list", e); + } + return predefinedLists[source] || []; }, getTopListSongs: async (id, source) => { @@ -328,7 +343,7 @@ {song.name}
{currentSong.artist}
++ {currentSong.artist} {currentSong.album ? `· ${currentSong.album}` : ''} +