From 552307bda814d1d7f639d9ffd21186a3c1907ac4 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Thu, 13 Apr 2023 12:03:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- publish/changeLog.md | 5 + src/main/modules/userApi/renderer/preload.js | 2 +- src/renderer/utils/musicSdk/mg/comment.js | 2 +- src/renderer/utils/musicSdk/mg/leaderboard.js | 80 +------------- src/renderer/utils/musicSdk/mg/lyric.js | 9 +- src/renderer/utils/musicSdk/mg/musicInfo.js | 100 ++++++++++++++++++ src/renderer/utils/musicSdk/mg/musicSearch.js | 72 +++++-------- src/renderer/utils/musicSdk/mg/songId.js | 47 ++++---- src/renderer/utils/musicSdk/mg/songList.js | 72 +------------ 9 files changed, 168 insertions(+), 221 deletions(-) create mode 100644 src/renderer/utils/musicSdk/mg/musicInfo.js diff --git a/publish/changeLog.md b/publish/changeLog.md index 484a502d..84906383 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -2,12 +2,17 @@ - 优化对系统Media Session的支持,现在切歌不会再会导致信息丢失的问题了 - 启用桌面歌词时,取消对歌词窗口的聚焦 +- 增加kg歌单歌曲flac24bit显示(@helloplhm-qwq) +- 增加tx源热门评论图片显示(@Folltoshe) ### 修复 - 修复启用全局快捷键时与Media Session注册冲突的问题,启用全局快捷键时,不再注册媒体控制快捷键 +- 修复搜索不显示时长的问题(@Folltoshe) +- 修复评论加载失败的问题(@Folltoshe) ### 其他 +- 自定义源API utils对象新增`zlib.inflate`与`zlib.deflate`方法,API版本更新到 v1.3.0 - 更新kg、tx、wy等平台排行榜列表 - 更新 electron 到 v22.3.5 diff --git a/src/main/modules/userApi/renderer/preload.js b/src/main/modules/userApi/renderer/preload.js index 34940e7e..c32787e9 100644 --- a/src/main/modules/userApi/renderer/preload.js +++ b/src/main/modules/userApi/renderer/preload.js @@ -253,7 +253,7 @@ contextBridge.exposeInMainWorld('lx', { }, }, }, - version: '1.2.1', + version: '1.3.0', // removeEvent(eventName, handler) { // if (!eventNames.includes(eventName)) return Promise.reject(new Error('The event is not supported: ' + eventName)) // let handlers diff --git a/src/renderer/utils/musicSdk/mg/comment.js b/src/renderer/utils/musicSdk/mg/comment.js index e5a412f4..9fcdde9e 100644 --- a/src/renderer/utils/musicSdk/mg/comment.js +++ b/src/renderer/utils/musicSdk/mg/comment.js @@ -1,5 +1,5 @@ import { httpFetch } from '../../request' -import { getSongId } from './songId' +import getSongId from './songId' import { dateFormat2 } from '../../index' export default { diff --git a/src/renderer/utils/musicSdk/mg/leaderboard.js b/src/renderer/utils/musicSdk/mg/leaderboard.js index 0c801fc0..9905884d 100644 --- a/src/renderer/utils/musicSdk/mg/leaderboard.js +++ b/src/renderer/utils/musicSdk/mg/leaderboard.js @@ -1,5 +1,5 @@ import { httpFetch } from '../../request' -import { sizeFormate } from '../../index' +import { filterMusicInfoData } from './musicInfo' // const boardList = [{ id: 'mg__27553319', name: '咪咕尖叫新歌榜', bangid: '27553319' }, { id: 'mg__27186466', name: '咪咕尖叫热歌榜', bangid: '27186466' }, { id: 'mg__27553408', name: '咪咕尖叫原创榜', bangid: '27553408' }, { id: 'mg__23189800', name: '咪咕港台榜', bangid: '23189800' }, { id: 'mg__23189399', name: '咪咕内地榜', bangid: '23189399' }, { id: 'mg__19190036', name: '咪咕欧美榜', bangid: '19190036' }, { id: 'mg__23189813', name: '咪咕日韩榜', bangid: '23189813' }, { id: 'mg__23190126', name: '咪咕彩铃榜', bangid: '23190126' }, { id: 'mg__15140045', name: '咪咕KTV榜', bangid: '15140045' }, { id: 'mg__15140034', name: '咪咕网络榜', bangid: '15140034' }, { id: 'mg__23217754', name: 'MV榜', bangid: '23217754' }, { id: 'mg__23218151', name: '新专辑榜', bangid: '23218151' }, { id: 'mg__21958042', name: 'iTunes榜', bangid: '21958042' }, { id: 'mg__21975570', name: 'billboard榜', bangid: '21975570' }, { id: 'mg__22272815', name: '台湾Hito中文榜', bangid: '22272815' }, { id: 'mg__22272904', name: '中国TOP排行榜', bangid: '22272904' }, { id: 'mg__22272943', name: '韩国Melon榜', bangid: '22272943' }, { id: 'mg__22273437', name: '英国UK榜', bangid: '22273437' }] @@ -81,82 +81,6 @@ export default { const requestObj = httpFetch(url) return requestObj.promise }, - getSinger(singers) { - let arr = [] - singers.forEach(singer => { - arr.push(singer.name) - }) - return arr.join('、') - }, - filterData(rawData) { - // console.log(JSON.stringify(rawData)) - // console.log(rawData) - let ids = new Set() - const list = [] - rawData.forEach(({ objectInfo: item }) => { - if (ids.has(item.copyrightId)) return - ids.add(item.copyrightId) - - const types = [] - const _types = {} - item.newRateFormats && item.newRateFormats.forEach(type => { - let size - switch (type.formatType) { - case 'PQ': - size = sizeFormate(type.size ?? type.androidSize) - types.push({ type: '128k', size }) - _types['128k'] = { - size, - } - break - case 'HQ': - size = sizeFormate(type.size ?? type.androidSize) - types.push({ type: '320k', size }) - _types['320k'] = { - size, - } - break - case 'SQ': - size = sizeFormate(type.size ?? type.androidSize) - types.push({ type: 'flac', size }) - _types.flac = { - size, - } - break - case 'ZQ': - size = sizeFormate(type.size ?? type.androidSize) - types.push({ type: 'flac24bit', size }) - _types.flac24bit = { - size, - } - break - } - }) - - const intervalTest = /(\d\d:\d\d)$/.test(item.length) - - list.push({ - singer: this.getSinger(item.artists), - name: item.songName, - albumName: item.album, - albumId: item.albumId, - songmid: item.songId, - copyrightId: item.copyrightId, - source: 'mg', - interval: intervalTest ? RegExp.$1 : null, - img: item.albumImgs && item.albumImgs.length ? item.albumImgs[0].img : null, - lrc: null, - lrcUrl: item.lrcUrl, - mrcUrl: item.mrcUrl, - trcUrl: item.trcUrl, - otherSource: null, - types, - _types, - typeUrl: {}, - }) - }) - return list - }, filterBoardsData(rawList) { // console.log(rawList) let list = [] @@ -204,7 +128,7 @@ export default { return this.getData(this.getUrl(bangid, page)).then(({ statusCode, body }) => { // console.log(body) if (statusCode !== 200 || body.code !== this.successCode) return this.getList(bangid, page, retryNum) - const list = this.filterData(body.columnInfo.contents) + const list = filterMusicInfoData(body.columnInfo.contents.map(m => m.objectInfo)) return { total: list.length, list, diff --git a/src/renderer/utils/musicSdk/mg/lyric.js b/src/renderer/utils/musicSdk/mg/lyric.js index 7a211944..540a2e9e 100644 --- a/src/renderer/utils/musicSdk/mg/lyric.js +++ b/src/renderer/utils/musicSdk/mg/lyric.js @@ -1,5 +1,5 @@ import { httpFetch } from '../../request' -import musicSearch from './musicSearch' +import { getMusicInfo } from './musicInfo' import { decrypt } from './mrc' const mrcTools = { @@ -75,11 +75,8 @@ const mrcTools = { }, getMusicInfo(songInfo) { return songInfo.mrcUrl == null - ? musicSearch.search(`${songInfo.name} ${songInfo.singer || ''}`.trim(), 1, 25).then(({ list }) => { - const targetSong = list.find(s => s.copyrightId == songInfo.copyrightId) - return targetSong ? { lrcUrl: targetSong.lrcUrl, mrcUrl: targetSong.mrcUrl, trcUrl: targetSong.trcUrl } : Promise.reject('获取歌词失败') - }) - : Promise.resolve({ lrcUrl: songInfo.lrcUrl, mrcUrl: songInfo.mrcUrl, trcUrl: songInfo.trcUrl }) + ? getMusicInfo(songInfo.copyrightId) + : songInfo }, getLyric(songInfo) { return { diff --git a/src/renderer/utils/musicSdk/mg/musicInfo.js b/src/renderer/utils/musicSdk/mg/musicInfo.js new file mode 100644 index 00000000..6194498b --- /dev/null +++ b/src/renderer/utils/musicSdk/mg/musicInfo.js @@ -0,0 +1,100 @@ +import { httpFetch } from '../../request' +import { sizeFormate } from '../../index' + +const getSinger = (singers) => { + let arr = [] + singers.forEach(singer => { + arr.push(singer.name) + }) + return arr.join('、') +} + +export const filterMusicInfoData = (rawList) => { + // console.log(rawList) + let ids = new Set() + const list = [] + rawList.forEach(item => { + if (ids.has(item.songId)) return + ids.add(item.songId) + const types = [] + const _types = {} + item.newRateFormats?.forEach(type => { + let size + switch (type.formatType) { + case 'PQ': + size = sizeFormate(type.size ?? type.androidSize) + types.push({ type: '128k', size }) + _types['128k'] = { + size, + } + break + case 'HQ': + size = sizeFormate(type.size ?? type.androidSize) + types.push({ type: '320k', size }) + _types['320k'] = { + size, + } + break + case 'SQ': + size = sizeFormate(type.size ?? type.androidSize) + types.push({ type: 'flac', size }) + _types.flac = { + size, + } + break + case 'ZQ': + size = sizeFormate(type.size ?? type.androidSize) + types.push({ type: 'flac24bit', size }) + _types.flac24bit = { + size, + } + break + } + }) + + const intervalTest = /(\d\d:\d\d)$/.test(item.length) + + list.push({ + singer: getSinger(item.artists), + name: item.songName, + albumName: item.album, + albumId: item.albumId, + songmid: item.songId, + copyrightId: item.copyrightId, + source: 'mg', + interval: intervalTest ? RegExp.$1 : null, + img: item.albumImgs?.length ? item.albumImgs[0].img : null, + lrc: null, + lrcUrl: item.lrcUrl, + mrcUrl: item.mrcUrl, + trcUrl: item.trcUrl, + otherSource: null, + types, + _types, + typeUrl: {}, + }) + }) + // console.log(list) + return list +} + +export const getMusicInfos = (copyrightIds, retry = 0) => { + if (++retry > 2) return Promise.reject(new Error('Failed to get music info try max')) + return httpFetch('https://c.musicapp.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?resourceType=2', { + method: 'POST', + form: { + resourceId: copyrightIds.join('|'), + }, + }).promise.then(({ body }) => { + if (!body) return getMusicInfos(copyrightIds, retry) + if (body.code !== '000000') return Promise.reject(new Error('Failed to get music info')) + return filterMusicInfoData(body.resource) + }) +} + +export const getMusicInfo = (copyrightId) => { + return getMusicInfos([copyrightId]).then(([musicInfo]) => { + if (musicInfo) return musicInfo + throw new Error('failed') + }) +} diff --git a/src/renderer/utils/musicSdk/mg/musicSearch.js b/src/renderer/utils/musicSdk/mg/musicSearch.js index cee4f57f..e5cc0c24 100644 --- a/src/renderer/utils/musicSdk/mg/musicSearch.js +++ b/src/renderer/utils/musicSdk/mg/musicSearch.js @@ -2,6 +2,13 @@ import { httpFetch } from '../../request' import { sizeFormate, formatPlayTime } from '../../index' import { toMD5 } from '../utils' +const sign = (time, str) => { + const deviceId = '963B7AA0D21511ED807EE5846EC87D20' + const signatureMd5 = '6cdc72a439cef99a3418d2a78aa28c73' + const sign = toMD5(`${str}${signatureMd5}yyapp2d16148780a1dcc7408e06336b98cfd50${deviceId}${time}`) + return { sign, deviceId } +} + export default { limit: 20, total: 0, @@ -11,6 +18,9 @@ export default { // 旧版API // musicSearch(str, page, limit) { // const searchRequest = httpFetch(`http://pd.musicapp.migu.cn/MIGUM2.0/v1.0/content/search_all.do?ua=Android_migu&version=5.0.1&text=${encodeURIComponent(str)}&pageNo=${page}&pageSize=${limit}&searchSwitch=%7B%22song%22%3A1%2C%22album%22%3A0%2C%22singer%22%3A0%2C%22tagSong%22%3A0%2C%22mvSong%22%3A0%2C%22songlist%22%3A0%2C%22bestShow%22%3A1%7D`, { + // searchRequest = httpFetch(`http://pd.musicapp.migu.cn/MIGUM2.0/v1.0/content/search_all.do?ua=Android_migu&version=5.0.1&text=${encodeURIComponent(str)}&pageNo=${page}&pageSize=${limit}&searchSwitch=%7B%22song%22%3A1%2C%22album%22%3A0%2C%22singer%22%3A0%2C%22tagSong%22%3A0%2C%22mvSong%22%3A0%2C%22songlist%22%3A0%2C%22bestShow%22%3A1%7D`, { + // searchRequest = httpFetch(`http://jadeite.migu.cn:7090/music_search/v2/search/searchAll?sid=4f87090d01c84984a11976b828e2b02c18946be88a6b4c47bcdc92fbd40762db&isCorrect=1&isCopyright=1&searchSwitch=%7B%22song%22%3A1%2C%22album%22%3A0%2C%22singer%22%3A0%2C%22tagSong%22%3A1%2C%22mvSong%22%3A0%2C%22bestShow%22%3A1%2C%22songlist%22%3A0%2C%22lyricSong%22%3A0%7D&pageSize=${limit}&text=${encodeURIComponent(str)}&pageNo=${page}&sort=0`, { + // searchRequest = httpFetch(`https://app.c.nf.migu.cn/MIGUM2.0/v1.0/content/search_all.do?isCopyright=1&isCorrect=1&pageNo=${page}&pageSize=${limit}&searchSwitch={%22song%22:1,%22album%22:0,%22singer%22:0,%22tagSong%22:0,%22mvSong%22:0,%22songlist%22:0,%22bestShow%22:0}&sort=0&text=${encodeURIComponent(str)}`) // // searchRequest = httpFetch(`http://jadeite.migu.cn:7090/music_search/v2/search/searchAll?sid=4f87090d01c84984a11976b828e2b02c18946be88a6b4c47bcdc92fbd40762db&isCorrect=1&isCopyright=1&searchSwitch=%7B%22song%22%3A1%2C%22album%22%3A0%2C%22singer%22%3A0%2C%22tagSong%22%3A1%2C%22mvSong%22%3A0%2C%22bestShow%22%3A1%2C%22songlist%22%3A0%2C%22lyricSong%22%3A0%7D&pageSize=${limit}&text=${encodeURIComponent(str)}&pageNo=${page}&sort=0`, { // headers: { // // sign: 'c3b7ae985e2206e97f1b2de8f88691e2', @@ -101,8 +111,8 @@ export default { musicSearch(str, page, limit) { const time = Date.now().toString() - const signData = this.signWithSearch(time, str) - const searchRequest = httpFetch(`https://jadeite.migu.cn/music_search/v3/search/searchAll?pageNo=${page}&pageSize=${limit}&sort=0&text=${encodeURI(str)}&searchSwitch={"song":1}&isCopyright=1&isCorrect=1`, { + const signData = sign(time, str) + const searchRequest = httpFetch(`https://jadeite.migu.cn/music_search/v3/search/searchAll?isCorrect=1&isCopyright=1&searchSwitch=%7B%22song%22%3A1%2C%22album%22%3A0%2C%22singer%22%3A0%2C%22tagSong%22%3A1%2C%22mvSong%22%3A0%2C%22bestShow%22%3A1%2C%22songlist%22%3A0%2C%22lyricSong%22%3A0%7D&pageSize=${limit}&text=${encodeURIComponent(str)}&pageNo=${page}&sort=0`, { headers: { uiVersion: 'A_music_3.6.1', deviceId: signData.deviceId, @@ -121,29 +131,14 @@ export default { }) return arr.join('、') }, - async getMusicInfo(copyrightIds) { - return httpFetch('https://c.musicapp.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?resourceType=2', { - method: 'POST', - formData: { resourceId: copyrightIds }, - }).promise.then(({ body }) => { - if (body.code !== '000000') return Promise.reject(new Error('Failed to get music info.')) - return body.resource - }) - }, - signWithSearch(time, str) { - const deviceId = '963B7AA0D21511ED807EE5846EC87D16' - const signatureMd5 = '6cdc72a439cef99a3418d2a78aa28c73' - const sign = toMD5(`${str}${signatureMd5}yyapp2d16148780a1dcc7408e06336b98cfd50${deviceId}${time}`) - return { sign, deviceId } - }, filterData(rawData) { // console.log(rawData) - const list = new Map() + const list = [] const ids = new Set() rawData.forEach(item => { item.forEach(data => { - if (ids.has(data.copyrightId) || !data.songId || !data.copyrightId) return + if (!data.songId || !data.copyrightId || ids.has(data.copyrightId)) return ids.add(data.copyrightId) const types = [] @@ -182,22 +177,23 @@ export default { } }) - list.set(data.songId, { + let img = data.img3 || data.img2 || data.img1 || null + if (img && !/https?:/.test(data.img3)) img = 'http://d.musicapp.migu.cn' + img + + list.push({ singer: this.getSinger(data.singerList), name: data.name, albumName: data.album, albumId: data.albumId, - songmid: data.copyrightId, - songId: data.songId, + songmid: data.songId, copyrightId: data.copyrightId, source: 'mg', interval: formatPlayTime(data.duration), - img: /https?:/.test(data.img3) ? data.img3 : 'http://d.musicapp.migu.cn' + data.img3, + img, lrc: null, lrcUrl: data.lrcUrl, mrcUrl: data.mrcurl, trcUrl: data.trcUrl, - otherSource: null, types, _types, typeUrl: {}, @@ -206,47 +202,29 @@ export default { }) return list }, - async handleResult(rawData) { - // console.log(rawData) - const list = [] - const datas = this.filterData(rawData) - if (!datas) throw new Error('Failed to filter data') - const songInfo = await this.getMusicInfo([...datas.keys()].join('|')) - songInfo.forEach(item => { - let data = datas.get(item.songId) - if (!data) return - list.push({ - ...data, - lrcUrl: item.lrcUrl, - mrcUrl: item.mrcUrl, - trcUrl: item.trcUrl, - }) - }) - return list - }, search(str, page = 1, limit, retryNum = 0) { if (++retryNum > 3) return Promise.reject(new Error('try max num')) if (limit == null) limit = this.limit // http://newlyric.kuwo.cn/newlyric.lrc?62355680 - return this.musicSearch(str, page, limit).then(async result => { + return this.musicSearch(str, page, limit).then(result => { // console.log(result) if (!result || result.code !== '000000') return Promise.reject(new Error(result ? result.info : '搜索失败')) - const songResultData = result.songResultData || { result: [], totalCount: 0 } + const songResultData = result.songResultData || { resultList: [], totalCount: 0 } - let list = await this.handleResult(songResultData.resultList) + let list = this.filterData(songResultData.resultList) if (list == null) return this.search(str, page, limit, retryNum) this.total = parseInt(songResultData.totalCount) this.page = page this.allPage = Math.ceil(this.total / limit) - return Promise.resolve({ + return { list, allPage: this.allPage, limit, total: this.total, source: 'mg', - }) + } }) }, } diff --git a/src/renderer/utils/musicSdk/mg/songId.js b/src/renderer/utils/musicSdk/mg/songId.js index ca99b676..25197c28 100644 --- a/src/renderer/utils/musicSdk/mg/songId.js +++ b/src/renderer/utils/musicSdk/mg/songId.js @@ -1,22 +1,31 @@ -import { httpFetch } from '../../request' +// import { httpFetch } from '../../request' +import { getMusicInfo } from './musicInfo' -export const getSongId = async(musicInfo, retry = 0) => { - if (musicInfo.songmid != musicInfo.copyrightId) return musicInfo.songmid - if (++retry > 2) return Promise.reject(new Error('max retry')) - - const requestObj = httpFetch(`https://app.c.nf.migu.cn/MIGUM2.0/v2.0/content/listen-url?netType=00&resourceType=2&songId=${musicInfo.copyrightId}&toneFlag=PQ`, { - headers: { - 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', - channel: '0146921', - }, - }) - - return requestObj.promise.then(({ body }) => { - console.log(body) - if (!body || body.code !== '000000') return this.getSongId(musicInfo, retry) - const id = body.data.songItem.songId - if (!id) throw new Error('failed') - return id - }) +const getSongId = async(mInfo) => { + if (mInfo.songmid != mInfo.copyrightId) return mInfo.songmid + const musicInfo = await getMusicInfo(mInfo.copyrightId) + return musicInfo.songmid } + +// export const getSongId = async(musicInfo, retry = 0) => { +// if (musicInfo.songmid != musicInfo.copyrightId) return musicInfo.songmid +// if (++retry > 2) return Promise.reject(new Error('max retry')) + +// const requestObj = httpFetch(`https://app.c.nf.migu.cn/MIGUM2.0/v2.0/content/listen-url?netType=00&resourceType=2&songId=${musicInfo.copyrightId}&toneFlag=PQ`, { +// headers: { +// 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', +// channel: '0146921', +// }, +// }) + +// return requestObj.promise.then(({ body }) => { +// console.log(body) +// if (!body || body.code !== '000000') return this.getSongId(musicInfo, retry) +// const id = body.data.songItem.songId +// if (!id) throw new Error('failed') +// return id +// }) +// } + +export default getSongId diff --git a/src/renderer/utils/musicSdk/mg/songList.js b/src/renderer/utils/musicSdk/mg/songList.js index 070b779b..5b0984ee 100644 --- a/src/renderer/utils/musicSdk/mg/songList.js +++ b/src/renderer/utils/musicSdk/mg/songList.js @@ -1,5 +1,6 @@ import { httpFetch } from '../../request' -import { sizeFormate, dateFormat } from '../../index' +import { dateFormat } from '../../index' +import { filterMusicInfoData } from './musicInfo' // const tagData = { code: '000000', info: 'SUCCESS', columnInfo: { columnTitle: '分类', columnId: '15244430', columnPid: '15031270', opNumItem: { playNum: 0, playNumDesc: '0', keepNum: 0, keepNumDesc: '0', commentNum: 0, commentNumDesc: '0', shareNum: 0, shareNumDesc: '0', orderNumByWeek: 0, orderNumByWeekDesc: '0', orderNumByTotal: 0, orderNumByTotalDesc: '0', thumbNum: 0, thumbNumDesc: '0', followNum: 0, followNumDesc: '0', subscribeNum: 0, subscribeNumDesc: '0', livePlayNum: 0, livePlayNumDesc: '0', popularNum: 0, popularNumDesc: '0', bookingNum: 0, bookingNumDesc: '0' }, contentsCount: 6, columnStatus: 1, columnCreateTime: '2016-11-10 10:53:05.077', columntype: 2011, contents: [{ contentId: '18464615', relationType: 2011, objectInfo: { columnTitle: '热门', columnId: '18464615', columnPid: '15244430', opNumItem: { playNum: 0, playNumDesc: '0', keepNum: 0, keepNumDesc: '0', commentNum: 0, commentNumDesc: '0', shareNum: 0, shareNumDesc: '0', orderNumByWeek: 0, orderNumByWeekDesc: '0', orderNumByTotal: 0, orderNumByTotalDesc: '0', thumbNum: 0, thumbNumDesc: '0', followNum: 0, followNumDesc: '0', subscribeNum: 0, subscribeNumDesc: '0', livePlayNum: 0, livePlayNumDesc: '0', popularNum: 0, popularNumDesc: '0', bookingNum: 0, bookingNumDesc: '0' }, contentsCount: 8, columnStatus: 1, columnCreateTime: '2017-02-20 16:09:13.400', columntype: 2011, contents: [{ contentId: '1000001672', relationType: 4034, objectInfo: { tagId: '1000001672', tagName: '流行', resourceType: '2034' }, relationSort: 9 }, { contentId: '1003449727', relationType: 4034, objectInfo: { tagId: '1003449727', tagName: '厂牌', resourceType: '2034' }, relationSort: 8 }, { contentId: '1000001795', relationType: 4034, objectInfo: { tagId: '1000001795', tagName: '伤感', resourceType: '2034' }, relationSort: 7 }, { contentId: '1001076080', relationType: 4034, objectInfo: { tagId: '1001076080', tagName: '电影', resourceType: '2034' }, relationSort: 6 }, { contentId: '1000001675', relationType: 4034, objectInfo: { tagId: '1000001675', tagName: '中国风', resourceType: '2034' }, relationSort: 5 }, { contentId: '1000001635', relationType: 4034, objectInfo: { tagId: '1000001635', tagName: '经典老歌', resourceType: '2034' }, relationSort: 4 }, { contentId: '1000001831', relationType: 4034, objectInfo: { tagId: '1000001831', tagName: '翻唱', resourceType: '2034' }, relationSort: 3 }, { contentId: '1000001762', relationType: 4034, objectInfo: { tagId: '1000001762', tagName: '国语', resourceType: '2034' }, relationSort: 1 }], dataVersion: '1620410266029', customizedPicUrls: [] }, relationSort: 6 }, { contentId: '15244503', relationType: 2011, objectInfo: { columnTitle: '主题', columnId: '15244503', columnPid: '15244430', opNumItem: { playNum: 0, playNumDesc: '0', keepNum: 0, keepNumDesc: '0', commentNum: 0, commentNumDesc: '0', shareNum: 0, shareNumDesc: '0', orderNumByWeek: 0, orderNumByWeekDesc: '0', orderNumByTotal: 0, orderNumByTotalDesc: '0', thumbNum: 0, thumbNumDesc: '0', followNum: 0, followNumDesc: '0', subscribeNum: 0, subscribeNumDesc: '0', livePlayNum: 0, livePlayNumDesc: '0', popularNum: 0, popularNumDesc: '0', bookingNum: 0, bookingNumDesc: '0' }, contentsCount: 23, columnStatus: 1, columnCreateTime: '2016-11-10 10:54:10.261', columntype: 2011, contents: [{ contentId: '1003449727', relationType: 4034, objectInfo: { tagId: '1003449727', tagName: '厂牌', resourceType: '2034' }, relationSort: 29 }, { contentId: '1001076080', relationType: 4034, objectInfo: { tagId: '1001076080', tagName: '电影', resourceType: '2034' }, relationSort: 28 }, { contentId: '1001076078', relationType: 4034, objectInfo: { tagId: '1001076078', tagName: '电视剧', resourceType: '2034' }, relationSort: 27 }, { contentId: '1001076083', relationType: 4034, objectInfo: { tagId: '1001076083', tagName: '综艺', resourceType: '2034' }, relationSort: 26 }, { contentId: '1000001827', relationType: 4034, objectInfo: { tagId: '1000001827', tagName: 'KTV', resourceType: '2034' }, relationSort: 23 }, { contentId: '1000001698', relationType: 4034, objectInfo: { tagId: '1000001698', tagName: '爱情', resourceType: '2034' }, relationSort: 22 }, { contentId: '1000001635', relationType: 4034, objectInfo: { tagId: '1000001635', tagName: '经典老歌', resourceType: '2034' }, relationSort: 21 }, { contentId: '1001076096', relationType: 4034, objectInfo: { tagId: '1001076096', tagName: '网络热歌', resourceType: '2034' }, relationSort: 20 }, { contentId: '1000001780', relationType: 4034, objectInfo: { tagId: '1000001780', tagName: '儿童歌曲', resourceType: '2034' }, relationSort: 19 }, { contentId: '1000587702', relationType: 4034, objectInfo: { tagId: '1000587702', tagName: '广场舞', resourceType: '2034' }, relationSort: 18 }, { contentId: '1000587717', relationType: 4034, objectInfo: { tagId: '1000587717', tagName: '70后', resourceType: '2034' }, relationSort: 17 }, { contentId: '1000587718', relationType: 4034, objectInfo: { tagId: '1000587718', tagName: '80后', resourceType: '2034' }, relationSort: 16 }, { contentId: '1000587726', relationType: 4034, objectInfo: { tagId: '1000587726', tagName: '90后', resourceType: '2034' }, relationSort: 15 }, { contentId: '1000001670', relationType: 4034, objectInfo: { tagId: '1000001670', tagName: '红歌', resourceType: '2034' }, relationSort: 14 }, { contentId: '1000587698', relationType: 4034, objectInfo: { tagId: '1000587698', tagName: '游戏', resourceType: '2034' }, relationSort: 13 }, { contentId: '1000587706', relationType: 4034, objectInfo: { tagId: '1000587706', tagName: '动漫', resourceType: '2034' }, relationSort: 12 }, { contentId: '1000001675', relationType: 4034, objectInfo: { tagId: '1000001675', tagName: '中国风', resourceType: '2034' }, relationSort: 11 }, { contentId: '1000587712', relationType: 4034, objectInfo: { tagId: '1000587712', tagName: '青春校园', resourceType: '2034' }, relationSort: 10 }, { contentId: '1000587673', relationType: 4034, objectInfo: { tagId: '1000587673', tagName: '小清新', resourceType: '2034' }, relationSort: 9 }, { contentId: '1000093902', relationType: 4034, objectInfo: { tagId: '1000093902', tagName: 'DJ舞曲', resourceType: '2034' }, relationSort: 7 }, { contentId: '1000093963', relationType: 4034, objectInfo: { tagId: '1000093963', tagName: '广告', resourceType: '2034' }, relationSort: 6 }, { contentId: '1000001831', relationType: 4034, objectInfo: { tagId: '1000001831', tagName: '翻唱', resourceType: '2034' }, relationSort: 2 }, { contentId: '1003449726', relationType: 4034, objectInfo: { tagId: '1003449726', tagName: '读书', resourceType: '2034' }, relationSort: 1 }], dataVersion: '1620410266055', customizedPicUrls: [] }, relationSort: 5 }, { contentId: '15244509', relationType: 2011, objectInfo: { columnTitle: '风格', columnId: '15244509', columnPid: '15244430', opNumItem: { playNum: 0, playNumDesc: '0', keepNum: 0, keepNumDesc: '0', commentNum: 0, commentNumDesc: '0', shareNum: 0, shareNumDesc: '0', orderNumByWeek: 0, orderNumByWeekDesc: '0', orderNumByTotal: 0, orderNumByTotalDesc: '0', thumbNum: 0, thumbNumDesc: '0', followNum: 0, followNumDesc: '0', subscribeNum: 0, subscribeNumDesc: '0', livePlayNum: 0, livePlayNumDesc: '0', popularNum: 0, popularNumDesc: '0', bookingNum: 0, bookingNumDesc: '0' }, contentsCount: 12, columnStatus: 1, columnCreateTime: '2016-11-10 10:54:57.257', columntype: 2011, contents: [{ contentId: '1000001672', relationType: 4034, objectInfo: { tagId: '1000001672', tagName: '流行', resourceType: '2034' }, relationSort: 14 }, { contentId: '1000001808', relationType: 4034, objectInfo: { tagId: '1000001808', tagName: 'R&B', resourceType: '2034' }, relationSort: 13 }, { contentId: '1000001809', relationType: 4034, objectInfo: { tagId: '1000001809', tagName: '嘻哈', resourceType: '2034' }, relationSort: 12 }, { contentId: '1000001674', relationType: 4034, objectInfo: { tagId: '1000001674', tagName: '摇滚', resourceType: '2034' }, relationSort: 11 }, { contentId: '1000001682', relationType: 4034, objectInfo: { tagId: '1000001682', tagName: '电子', resourceType: '2034' }, relationSort: 10 }, { contentId: '1000001852', relationType: 4034, objectInfo: { tagId: '1000001852', tagName: '电子舞曲', resourceType: '2034' }, relationSort: 9 }, { contentId: '1000001681', relationType: 4034, objectInfo: { tagId: '1000001681', tagName: '爵士', resourceType: '2034' }, relationSort: 6 }, { contentId: '1000001683', relationType: 4034, objectInfo: { tagId: '1000001683', tagName: '乡村', resourceType: '2034' }, relationSort: 5 }, { contentId: '1000001851', relationType: 4034, objectInfo: { tagId: '1000001851', tagName: '蓝调', resourceType: '2034' }, relationSort: 4 }, { contentId: '1000001775', relationType: 4034, objectInfo: { tagId: '1000001775', tagName: '民谣', resourceType: '2034' }, relationSort: 3 }, { contentId: '1000001807', relationType: 4034, objectInfo: { tagId: '1000001807', tagName: '纯音乐', resourceType: '2034' }, relationSort: 2 }, { contentId: '1000001783', relationType: 4034, objectInfo: { tagId: '1000001783', tagName: '古典', resourceType: '2034' }, relationSort: 1 }], dataVersion: '1620410266033', customizedPicUrls: [] }, relationSort: 4 }, { contentId: '18464665', relationType: 2011, objectInfo: { columnTitle: '语种', columnId: '18464665', columnPid: '15244430', opNumItem: { playNum: 0, playNumDesc: '0', keepNum: 0, keepNumDesc: '0', commentNum: 0, commentNumDesc: '0', shareNum: 0, shareNumDesc: '0', orderNumByWeek: 0, orderNumByWeekDesc: '0', orderNumByTotal: 0, orderNumByTotalDesc: '0', thumbNum: 0, thumbNumDesc: '0', followNum: 0, followNumDesc: '0', subscribeNum: 0, subscribeNumDesc: '0', livePlayNum: 0, livePlayNumDesc: '0', popularNum: 0, popularNumDesc: '0', bookingNum: 0, bookingNumDesc: '0' }, contentsCount: 6, columnStatus: 1, columnCreateTime: '2017-02-20 16:07:16.566', columntype: 2011, contents: [{ contentId: '1000001762', relationType: 4034, objectInfo: { tagId: '1000001762', tagName: '国语', resourceType: '2034' }, relationSort: 6 }, { contentId: '1000001763', relationType: 4034, objectInfo: { tagId: '1000001763', tagName: '粤语', resourceType: '2034' }, relationSort: 5 }, { contentId: '1000001766', relationType: 4034, objectInfo: { tagId: '1000001766', tagName: '英语', resourceType: '2034' }, relationSort: 4 }, { contentId: '1000001599', relationType: 4034, objectInfo: { tagId: '1000001599', tagName: '韩语', resourceType: '2034' }, relationSort: 3 }, { contentId: '1000001767', relationType: 4034, objectInfo: { tagId: '1000001767', tagName: '日语', resourceType: '2034' }, relationSort: 2 }, { contentId: '1003449724', relationType: 4034, objectInfo: { tagId: '1003449724', tagName: '小语种', resourceType: '2034' }, relationSort: 1 }], dataVersion: '1620410266036', customizedPicUrls: [] }, relationSort: 3 }, { contentId: '18464583', relationType: 2011, objectInfo: { columnTitle: '心情', columnId: '18464583', columnPid: '15244430', opNumItem: { playNum: 0, playNumDesc: '0', keepNum: 0, keepNumDesc: '0', commentNum: 0, commentNumDesc: '0', shareNum: 0, shareNumDesc: '0', orderNumByWeek: 0, orderNumByWeekDesc: '0', orderNumByTotal: 0, orderNumByTotalDesc: '0', thumbNum: 0, thumbNumDesc: '0', followNum: 0, followNumDesc: '0', subscribeNum: 0, subscribeNumDesc: '0', livePlayNum: 0, livePlayNumDesc: '0', popularNum: 0, popularNumDesc: '0', bookingNum: 0, bookingNumDesc: '0' }, contentsCount: 13, columnStatus: 1, columnCreateTime: '2017-02-20 15:59:03.412', columntype: 2011, contents: [{ contentId: '1000587677', relationType: 4034, objectInfo: { tagId: '1000587677', tagName: '幸福', resourceType: '2034' }, relationSort: 15 }, { contentId: '1000587710', relationType: 4034, objectInfo: { tagId: '1000587710', tagName: '治愈', resourceType: '2034' }, relationSort: 14 }, { contentId: '1000001703', relationType: 4034, objectInfo: { tagId: '1000001703', tagName: '思念', resourceType: '2034' }, relationSort: 13 }, { contentId: '1000587667', relationType: 4034, objectInfo: { tagId: '1000587667', tagName: '期待', resourceType: '2034' }, relationSort: 12 }, { contentId: '1000001700', relationType: 4034, objectInfo: { tagId: '1000001700', tagName: '励志', resourceType: '2034' }, relationSort: 11 }, { contentId: '1000001694', relationType: 4034, objectInfo: { tagId: '1000001694', tagName: '欢快', resourceType: '2034' }, relationSort: 10 }, { contentId: '1002600588', relationType: 4034, objectInfo: { tagId: '1002600588', tagName: '叛逆', resourceType: '2034' }, relationSort: 9 }, { contentId: '1002600585', relationType: 4034, objectInfo: { tagId: '1002600585', tagName: '宣泄', resourceType: '2034' }, relationSort: 8 }, { contentId: '1000001696', relationType: 4034, objectInfo: { tagId: '1000001696', tagName: '怀旧', resourceType: '2034' }, relationSort: 7 }, { contentId: '1000587679', relationType: 4034, objectInfo: { tagId: '1000587679', tagName: '减压', resourceType: '2034' }, relationSort: 6 }, { contentId: '1000001699', relationType: 4034, objectInfo: { tagId: '1000001699', tagName: '寂寞', resourceType: '2034' }, relationSort: 5 }, { contentId: '1002600579', relationType: 4034, objectInfo: { tagId: '1002600579', tagName: '忧郁', resourceType: '2034' }, relationSort: 4 }, { contentId: '1000001795', relationType: 4034, objectInfo: { tagId: '1000001795', tagName: '伤感', resourceType: '2034' }, relationSort: 3 }], dataVersion: '1620410266187', customizedPicUrls: [] }, relationSort: 2 }, { contentId: '18464638', relationType: 2011, objectInfo: { columnTitle: '场景', columnId: '18464638', columnPid: '15244430', opNumItem: { playNum: 0, playNumDesc: '0', keepNum: 0, keepNumDesc: '0', commentNum: 0, commentNumDesc: '0', shareNum: 0, shareNumDesc: '0', orderNumByWeek: 0, orderNumByWeekDesc: '0', orderNumByTotal: 0, orderNumByTotalDesc: '0', thumbNum: 0, thumbNumDesc: '0', followNum: 0, followNumDesc: '0', subscribeNum: 0, subscribeNumDesc: '0', livePlayNum: 0, livePlayNumDesc: '0', popularNum: 0, popularNumDesc: '0', bookingNum: 0, bookingNumDesc: '0' }, contentsCount: 13, columnStatus: 1, columnCreateTime: '2017-02-20 16:02:59.711', columntype: 2011, contents: [{ contentId: '1000587689', relationType: 4034, objectInfo: { tagId: '1000587689', tagName: '清晨', resourceType: '2034' }, relationSort: 21 }, { contentId: '1000587690', relationType: 4034, objectInfo: { tagId: '1000587690', tagName: '夜晚', resourceType: '2034' }, relationSort: 20 }, { contentId: '1000587688', relationType: 4034, objectInfo: { tagId: '1000587688', tagName: '睡前安眠', resourceType: '2034' }, relationSort: 19 }, { contentId: '1003449726', relationType: 4034, objectInfo: { tagId: '1003449726', tagName: '读书', resourceType: '2034' }, relationSort: 18 }, { contentId: '1003449723', relationType: 4034, objectInfo: { tagId: '1003449723', tagName: '下午·茶', resourceType: '2034' }, relationSort: 16 }, { contentId: '1000093923', relationType: 4034, objectInfo: { tagId: '1000093923', tagName: '驾车', resourceType: '2034' }, relationSort: 15 }, { contentId: '1003449615', relationType: 4034, objectInfo: { tagId: '1003449615', tagName: '运动', resourceType: '2034' }, relationSort: 13 }, { contentId: '1000587694', relationType: 4034, objectInfo: { tagId: '1000587694', tagName: '散步', resourceType: '2034' }, relationSort: 12 }, { contentId: '1000001749', relationType: 4034, objectInfo: { tagId: '1000001749', tagName: '旅行', resourceType: '2034' }, relationSort: 11 }, { contentId: '1000587686', relationType: 4034, objectInfo: { tagId: '1000587686', tagName: '夜店', resourceType: '2034' }, relationSort: 10 }, { contentId: '1002600606', relationType: 4034, objectInfo: { tagId: '1002600606', tagName: '派对', resourceType: '2034' }, relationSort: 9 }, { contentId: '1000001634', relationType: 4034, objectInfo: { tagId: '1000001634', tagName: '咖啡馆', resourceType: '2034' }, relationSort: 3 }, { contentId: '1000587692', relationType: 4034, objectInfo: { tagId: '1000587692', tagName: '瑜伽', resourceType: '2034' }, relationSort: 1 }], dataVersion: '1620846028994', customizedPicUrls: [] }, relationSort: 1 }], dataVersion: '1620846028941', customizedPicUrls: [] } } @@ -84,7 +85,7 @@ export default { // console.log(JSON.stringify(body)) // console.log(body) return { - list: this.filterListDetail(body.list), + list: filterMusicInfoData(body.list), page, limit: this.limit_song, total: body.totalCount, @@ -154,73 +155,6 @@ export default { return listData }) }, - filterListDetail(rawList) { - // console.log(rawList) - let ids = new Set() - const list = [] - rawList.forEach(item => { - if (ids.has(item.songId)) return - ids.add(item.songId) - const types = [] - const _types = {} - item.newRateFormats && item.newRateFormats.forEach(type => { - let size - switch (type.formatType) { - case 'PQ': - size = sizeFormate(type.size ?? type.androidSize) - types.push({ type: '128k', size }) - _types['128k'] = { - size, - } - break - case 'HQ': - size = sizeFormate(type.size ?? type.androidSize) - types.push({ type: '320k', size }) - _types['320k'] = { - size, - } - break - case 'SQ': - size = sizeFormate(type.size ?? type.androidSize) - types.push({ type: 'flac', size }) - _types.flac = { - size, - } - break - case 'ZQ': - size = sizeFormate(type.size ?? type.androidSize) - types.push({ type: 'flac24bit', size }) - _types.flac24bit = { - size, - } - break - } - }) - - const intervalTest = /(\d\d:\d\d)$/.test(item.length) - - list.push({ - singer: item.singer, - name: item.songName, - albumName: item.album, - albumId: item.albumId, - songmid: item.songId, - copyrightId: item.copyrightId, - source: 'mg', - interval: intervalTest ? RegExp.$1 : null, - img: item.albumImgs && item.albumImgs.length ? item.albumImgs[0].img : null, - lrc: null, - lrcUrl: item.lrcUrl, - mrcUrl: item.mrcUrl, - trcUrl: item.trcUrl, - otherSource: null, - types, - _types, - typeUrl: {}, - }) - }) - return list - }, // 获取列表数据 getList(sortId, tagId, page, tryNum = 0) {