fix: map search result fields songmid->id, singer->artists for QZv2 Music model
This commit is contained in:
@@ -156,13 +156,13 @@ function handleSearchResult(rawList) {
|
||||
if (s.sq) { types.push({ type: 'flac', size: '' }); _types.flac = { size: '' }; }
|
||||
if (s.hr) { types.push({ type: 'hires', size: '' }); _types.hires = { size: '' }; }
|
||||
list.push({
|
||||
singer: formatSingerName(s.ar, 'name'),
|
||||
artists: formatSingerName(s.ar, 'name'),
|
||||
name: s.name,
|
||||
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),
|
||||
songmid: s.id,
|
||||
id: s.id,
|
||||
img: s.al && s.al.picUrl ? s.al.picUrl : '',
|
||||
lrc: null,
|
||||
types: types,
|
||||
@@ -195,7 +195,7 @@ function search(str, page, limit, retryNum) {
|
||||
// ===== 播放链接 =====
|
||||
function getUrl(songInfo, type) {
|
||||
var q = type || '128k';
|
||||
var songId = songInfo.songmid || songInfo.id || '';
|
||||
var songId = songInfo.id || '';
|
||||
var ceruKey = process.env.ceru_key || '';
|
||||
var headers = { 'User-Agent': 'QZMusic/2.0' };
|
||||
if (ceruKey) headers['X-API-Key'] = ceruKey;
|
||||
@@ -214,10 +214,10 @@ function getPic(songInfo) {
|
||||
if (songInfo.img) return Promise.resolve(songInfo.img);
|
||||
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.songmid,
|
||||
'Referer': 'https://music.163.com/song?id=' + songInfo.id,
|
||||
'Origin': 'https://music.163.com',
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}, querystring.stringify(weapi({ c: '[{"id":' + songInfo.songmid + '}]', ids: '[' + songInfo.songmid + ']' })))
|
||||
}, querystring.stringify(weapi({ c: '[{"id":' + songInfo.id + '}]', ids: '[' + songInfo.id + ']' })))
|
||||
.then(function(res) {
|
||||
if (res.body && res.body.songs && res.body.songs.length) return res.body.songs[0].al.picUrl;
|
||||
return '';
|
||||
@@ -227,7 +227,7 @@ function getPic(songInfo) {
|
||||
|
||||
// ===== 歌词 =====
|
||||
function getLyric(songInfo) {
|
||||
var songmid = songInfo.songmid || '';
|
||||
var songmid = songInfo.id || '';
|
||||
return requestUrl('https://music.163.com/api/song/lyric?id=' + songmid + '&lv=1&kv=1&tv=-1', 'GET', {
|
||||
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36',
|
||||
'Referer': 'https://music.163.com/song?id=' + songmid
|
||||
@@ -248,13 +248,13 @@ function musicDetail(songmid) {
|
||||
if (res.body && res.body.songs && res.body.songs.length) {
|
||||
var s = res.body.songs[0];
|
||||
return {
|
||||
singer: formatSingerName(s.ar, 'name'),
|
||||
artists: formatSingerName(s.ar, 'name'),
|
||||
name: s.name,
|
||||
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),
|
||||
songmid: s.id,
|
||||
id: s.id,
|
||||
img: s.al && s.al.picUrl ? s.al.picUrl : '',
|
||||
lrc: null,
|
||||
types: [],
|
||||
@@ -352,7 +352,7 @@ module.exports = {
|
||||
hotSearch: { getList: hotSearch },
|
||||
leaderboard: { getBoards: leaderboard },
|
||||
songList: songList,
|
||||
singer: singer,
|
||||
artists: singer,
|
||||
album: album,
|
||||
getLyric: getLyric,
|
||||
getPic: getPic,
|
||||
|
||||
Reference in New Issue
Block a user