fix: map search result fields songmid->id, singer->artists for QZv2 Music model
This commit is contained in:
@@ -90,13 +90,13 @@ function handleSearchResult(rawList) {
|
||||
var img = item.img || (item.albumImgs && item.albumImgs.length ? item.albumImgs[0].img : '');
|
||||
if (img && img.startsWith('/')) img = 'https://d.musicapp.migu.cn' + img;
|
||||
list.push({
|
||||
singer: item.artist || item.singerName || '',
|
||||
artists: item.artist || item.singerName || '',
|
||||
name: item.title || item.songName || '',
|
||||
albumName: item.album || item.albumName || '',
|
||||
albumId: item.albumId || '',
|
||||
source: 'mg',
|
||||
interval: item.length ? item.length.replace(/.*(\d\d:\d\d)$/, '$1') : '',
|
||||
songmid: item.copyrightId || item.id || '',
|
||||
id: item.copyrightId || item.id || '',
|
||||
songId: item.copyrightId || item.id || '',
|
||||
img: img,
|
||||
lrc: null,
|
||||
@@ -119,7 +119,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;
|
||||
@@ -140,7 +140,7 @@ function getPic(songInfo) {
|
||||
|
||||
// ===== 歌词 =====
|
||||
function getLyric(songInfo) {
|
||||
var copyrightId = songInfo.songmid || '';
|
||||
var copyrightId = songInfo.id || '';
|
||||
if (!copyrightId) return Promise.resolve('');
|
||||
return requestUrl('http://music.migu.cn/v3/api/music/audioPlayer/getLyric?copyrightId=' + encodeURIComponent(copyrightId), 'GET', {
|
||||
'User-Agent': 'Mozilla/5.0 (Linux; Android 10)',
|
||||
@@ -200,7 +200,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