fix: search results use pic/mPic/sPic/qualities (QZv2 format) instead of img/types/_types
This commit is contained in:
@@ -148,26 +148,25 @@ function handleSearchResult(rawList) {
|
||||
var item = rawList[i];
|
||||
if (!item.baseInfo || !item.baseInfo.simpleSongData) continue;
|
||||
var s = item.baseInfo.simpleSongData;
|
||||
var types = [];
|
||||
var _types = {};
|
||||
if (s.h && s.h.br >= 320000) { types.push({ type: '320k', size: '' }); _types['320k'] = { size: '' }; }
|
||||
else if (s.m && s.m.br >= 192000) { types.push({ type: '192k', size: '' }); _types['192k'] = { size: '' }; }
|
||||
else if (s.l) { types.push({ type: '128k', size: '' }); _types['128k'] = { size: '' }; }
|
||||
if (s.sq) { types.push({ type: 'flac', size: '' }); _types.flac = { size: '' }; }
|
||||
if (s.hr) { types.push({ type: 'hires', size: '' }); _types.hires = { size: '' }; }
|
||||
var qualities = {};
|
||||
if (s.l && s.l.size) qualities.standard = String(s.l.size);
|
||||
if (s.m && s.m.size) qualities.standard = String(s.m.size);
|
||||
if (s.h && s.h.size) qualities.exhigh = String(s.h.size);
|
||||
if (s.sq && s.sq.size) qualities.lossless = String(s.sq.size);
|
||||
if (s.hr && s.hr.size) qualities.hires = String(s.hr.size);
|
||||
var picUrl = s.al && s.al.picUrl ? s.al.picUrl : '';
|
||||
list.push({
|
||||
artists: formatSingerName(s.ar, 'name'),
|
||||
id: s.id,
|
||||
name: s.name,
|
||||
artists: formatSingerName(s.ar, 'name'),
|
||||
source: 'wy',
|
||||
pic: picUrl,
|
||||
mPic: picUrl,
|
||||
sPic: picUrl,
|
||||
albumName: s.al && s.al.name ? s.al.name : '',
|
||||
albumId: s.al && s.al.id ? s.al.id : '',
|
||||
source: 'wy',
|
||||
interval: formatPlayTime((s.dt || 0) / 1000),
|
||||
id: s.id,
|
||||
img: s.al && s.al.picUrl ? s.al.picUrl : '',
|
||||
lrc: null,
|
||||
types: types,
|
||||
_types: _types,
|
||||
typeUrl: {}
|
||||
qualities: qualities
|
||||
});
|
||||
}
|
||||
return list;
|
||||
@@ -211,7 +210,7 @@ function getUrl(songInfo, type) {
|
||||
|
||||
// ===== 封面图 =====
|
||||
function getPic(songInfo) {
|
||||
if (songInfo.img) return Promise.resolve(songInfo.img);
|
||||
if (songInfo.pic) return Promise.resolve(songInfo.pic);
|
||||
return requestUrl('https://music.163.com/weapi/v3/song/detail', 'POST', {
|
||||
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36',
|
||||
'Referer': 'https://music.163.com/song?id=' + songInfo.id,
|
||||
@@ -247,19 +246,19 @@ function musicDetail(songmid) {
|
||||
.then(function(res) {
|
||||
if (res.body && res.body.songs && res.body.songs.length) {
|
||||
var s = res.body.songs[0];
|
||||
var picUrl = s.al && s.al.picUrl ? s.al.picUrl : '';
|
||||
return {
|
||||
artists: formatSingerName(s.ar, 'name'),
|
||||
id: s.id,
|
||||
name: s.name,
|
||||
artists: formatSingerName(s.ar, 'name'),
|
||||
source: 'wy',
|
||||
pic: picUrl,
|
||||
mPic: picUrl,
|
||||
sPic: picUrl,
|
||||
albumName: s.al && s.al.name ? s.al.name : '',
|
||||
albumId: s.al && s.al.id ? s.al.id : '',
|
||||
source: 'wy',
|
||||
interval: formatPlayTime((s.dt || 0) / 1000),
|
||||
id: s.id,
|
||||
img: s.al && s.al.picUrl ? s.al.picUrl : '',
|
||||
lrc: null,
|
||||
types: [],
|
||||
_types: {},
|
||||
typeUrl: {}
|
||||
qualities: {}
|
||||
};
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user