fix: env from global.env; enhance wy leaderboard

This commit is contained in:
TRAE Bot
2026-07-05 12:11:37 +00:00
parent c39b5609dc
commit 04ab08a589

View File

@@ -310,8 +310,59 @@ function tipSearch(str) {
}
// ===== 榜单 =====
function leaderboard() {
return Promise.resolve([]);
var BOARD_LIST = [
{ id: '19723756', name: '飙升榜', source: 'wy' },
{ id: '3779629', name: '新歌榜', source: 'wy' },
{ id: '2884035', name: '原创榜', source: 'wy' },
{ id: '3778678', name: '热歌榜', source: 'wy' },
{ id: '1978921795', name: '云音乐电音榜', source: 'wy' },
{ id: '991319590', name: '云音乐说唱榜', source: 'wy' },
{ id: '5059633707', name: '云音乐摇滚榜', source: 'wy' },
{ id: '5059642708', name: '云音乐古风榜', source: 'wy' },
{ id: '5059644681', name: '云音乐民谣榜', source: 'wy' },
{ id: '180106', name: 'UK排行榜周榜', source: 'wy' },
{ id: '60198', name: '美国Billboard周榜', source: 'wy' },
{ id: '11641212', name: 'KTV唛榜', source: 'wy' },
{ id: '112463', name: 'iTunes榜', source: 'wy' },
{ id: '112504', name: '日本Oricon周榜', source: 'wy' },
{ id: '250341', name: '云音乐MV榜', source: 'wy' }
];
function leaderboardGetBoards() {
return Promise.resolve(BOARD_LIST);
}
function leaderboardGetList(id, page) {
if (!page) page = 1;
var limit = 1000;
var form = weapi({ id: id, n: limit, s: 8 });
return requestUrl('https://music.163.com/weapi/v3/playlist/detail', 'POST', {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36',
'Origin': 'https://music.163.com',
'Content-Type': 'application/x-www-form-urlencoded'
}, querystring.stringify(form)).then(function(res) {
if (!res.body || !res.body.playlist) return { list: [], total: 0, source: 'wy' };
var tracks = res.body.playlist.tracks || [];
var list = [];
for (var i = 0; i < tracks.length; i++) {
var item = tracks[i];
var picUrl = item.al && item.al.picUrl ? item.al.picUrl : '';
list.push({
id: item.id,
name: item.name,
artists: formatSingerName(item.ar, 'name'),
source: 'wy',
pic: picUrl,
mPic: picUrl,
sPic: picUrl,
albumName: item.al && item.al.name ? item.al.name : '',
albumId: item.al && item.al.id ? item.al.id : '',
interval: formatPlayTime((item.dt || 0) / 1000),
qualities: {}
});
}
return { list: list, total: list.length, source: 'wy', limit: limit, page: page };
}).catch(function() { return { list: [], total: 0, source: 'wy' }; });
}
// ===== 歌单 =====
@@ -352,9 +403,9 @@ module.exports = {
musicSearch: { search: search },
tipSearch: { search: tipSearch },
hotSearch: { getList: hotSearch },
leaderboard: { getBoards: leaderboard },
leaderboard: { getBoards: leaderboardGetBoards, getList: leaderboardGetList },
songList: songList,
artists: singer,
singer: singer,
album: album,
getLyric: getLyric,
getPic: getPic,