fix: revert getUrl to 2 params (songInfo, type); fix all search fields to pic/mPic/sPic/qualities

This commit is contained in:
TRAE Bot
2026-07-05 16:12:55 +00:00
parent 2bc804187a
commit 827231bf23
6 changed files with 20 additions and 22 deletions

View File

@@ -138,7 +138,7 @@ function search(str, page, limit, retryNum) {
}
// ===== 播放链接 =====
function getUrl(source, songInfo, type) {
function getUrl(songInfo, type) {
var q = (type === 'standard' ? '128k' : type === 'exhigh' ? '320k' : type === 'lossless' || type === 'hires' || type === 'jymaster' ? 'flac' : type) || '128k';
var songId = songInfo.id || '';
if (!songId) return Promise.resolve('');

View File

@@ -130,10 +130,11 @@ function handleSearchResult(rawList) {
var item = rawList[i];
if (!item.file || !item.file.media_mid) continue;
var qualities = {};
if (item.file.size_128mp3) qualities.standard = String(item.file.size_128mp3);
if (item.file.size_320mp3) qualities.exhigh = String(item.file.size_320mp3);
if (item.file.size_flac) qualities.lossless = String(item.file.size_flac);
if (item.file.size_hires) qualities.hires = String(item.file.size_hires);
var file = item.file;
if (file.size_128mp3 !== 0) qualities.standard = String(file.size_128mp3 || '');
if (file.size_320mp3 !== 0) qualities.exhigh = String(file.size_320mp3 || '');
if (file.size_flac !== 0) qualities.lossless = String(file.size_flac || '');
if (file.size_hires !== 0) qualities.hires = String(file.size_hires || '');
var albumId = '';
var albumName = '';
if (item.album) { albumName = item.album.name; albumId = item.album.mid; }
@@ -146,15 +147,16 @@ function handleSearchResult(rawList) {
var picUrl = albumId ? 'https://y.gtimg.cn/music/photo_new/T002R500x500M000' + albumId + '.jpg' : (item.singer && item.singer.length ? 'https://y.gtimg.cn/music/photo_new/T001R500x500M000' + item.singer[0].mid + '.jpg' : '');
list.push({
id: item.mid,
songId: item.id,
name: item.name + (item.title_extra || ''),
artists: singerName,
source: 'tx',
interval: formatPlayTime(item.interval),
pic: picUrl,
mPic: picUrl,
sPic: picUrl,
albumName: albumName,
albumId: albumId,
interval: formatPlayTime(item.interval),
qualities: qualities
});
}
@@ -175,9 +177,9 @@ function search(str, page, limit, retryNum) {
}
// ===== 播放链接 =====
function getUrl(source, songInfo, type) {
function getUrl(songInfo, type) {
var q = (type === 'standard' ? '128k' : type === 'exhigh' ? '320k' : type === 'lossless' || type === 'hires' || type === 'jymaster' ? 'flac' : type) || '128k';
var songId = songInfo.id || '';
var songId = songInfo.id || songInfo.songId || '';
var ceruKey = CERU_KEY || '';
var headers = { 'User-Agent': 'QZMusic/2.0' };
if (ceruKey) headers['X-API-Key'] = ceruKey;
@@ -193,6 +195,7 @@ function getUrl(source, songInfo, type) {
// ===== 封面图 =====
function getPic(songInfo) {
if (songInfo.pic) return Promise.resolve(songInfo.pic);
if (songInfo.img) return Promise.resolve(songInfo.img);
var albumId = songInfo.albumId || '';
if (albumId) return Promise.resolve('https://y.gtimg.cn/music/photo_new/T002R500x500M000' + albumId + '.jpg');
return Promise.resolve('');
@@ -227,16 +230,11 @@ function musicDetail(songmid) {
if (t.singer && t.singer.length) { var ns = []; for (var j = 0; j < t.singer.length; j++) ns.push(t.singer[j].name); singerName = ns.join('、'); }
var picUrl = albumId ? 'https://y.gtimg.cn/music/photo_new/T002R500x500M000' + albumId + '.jpg' : '';
return {
id: t.mid,
name: t.name,
artists: singerName,
source: 'tx',
pic: picUrl,
mPic: picUrl,
sPic: picUrl,
albumName: t.album ? t.album.name : '',
albumId: albumId,
interval: formatPlayTime(t.interval),
id: t.mid, songId: t.id,
name: t.name, artists: singerName,
albumName: t.album ? t.album.name : '', albumId: albumId,
source: 'tx', interval: formatPlayTime(t.interval),
pic: picUrl, mPic: picUrl, sPic: picUrl,
qualities: {}
};
}

View File

@@ -119,7 +119,7 @@ function search(str, page, limit, retryNum) {
}
// ===== 播放链接 =====
function getUrl(source, songInfo, type) {
function getUrl(songInfo, type) {
var q = (type === 'standard' ? '128k' : type === 'exhigh' ? '320k' : type === 'lossless' || type === 'hires' || type === 'jymaster' ? 'flac' : type) || '128k';
var songId = songInfo.id || '';
var ceruKey = CERU_KEY || '';

View File

@@ -197,7 +197,7 @@ function search(str, page, limit, retryNum) {
}
// ===== 播放链接 =====
function getUrl(source, songInfo, type) {
function getUrl(songInfo, type) {
var q = (type === 'standard' ? '128k' : type === 'exhigh' ? '320k' : type === 'lossless' || type === 'hires' || type === 'jymaster' ? 'flac' : type) || '128k';
var songId = songInfo.id || '';
var ceruKey = CERU_KEY || '';

View File

@@ -109,7 +109,7 @@ function search(str, page, limit, retryNum) {
}
// ===== 播放链接 =====
function getUrl(source, songInfo, type) {
function getUrl(songInfo, type) {
var q = (type === 'standard' ? '128k' : type === 'exhigh' ? '320k' : type === 'lossless' || type === 'hires' || type === 'jymaster' ? 'flac' : type) || '128k';
var songId = songInfo.id || '';
var ceruKey = CERU_KEY || '';

View File

@@ -109,7 +109,7 @@ function search(str, page, limit, retryNum) {
}
// ===== 播放链接 =====
function getUrl(source, songInfo, type) {
function getUrl(songInfo, type) {
var q = (type === 'standard' ? '128k' : type === 'exhigh' ? '320k' : type === 'lossless' || type === 'hires' || type === 'jymaster' ? 'flac' : type) || '128k';
var songId = songInfo.id || '';
var ceruKey = CERU_KEY || '';