This commit is contained in:
Folltoshe 2023-04-26 20:22:43 +08:00
parent 7728085238
commit a039bab339
14 changed files with 154 additions and 203 deletions

View File

@ -1,10 +1,26 @@
import { dateFormat } from '@common/utils/common'
import { dateFormat, decodeName } from '@common/utils/common'
export * from '@common/utils/renderer'
export * from '@common/utils/nodejs'
export * from '@common/utils/common'
export * from '@common/utils/tools'
/**
*
* @param singers
* @param obj
* @param join
*/
export const getSingerName = (singers: [], obj = 'name', join = '、') => {
const singer: string[] = []
singers.forEach(item => {
let name = item[obj]
if (!name) return
singer.push(name)
})
return decodeName(singer.join(join))
}
/**
*
*/

View File

@ -1,5 +1,5 @@
import { httpFetch } from '../../request'
import { decodeName, formatPlayTime, sizeFormate } from '../../index'
import { decodeName, formatPlayTime, sizeFormate, getSingerName } from '../../index'
let boardList = [{ id: 'kg__8888', name: 'TOP500', bangid: '8888' }, { id: 'kg__6666', name: '飙升榜', bangid: '6666' }, { id: 'kg__59703', name: '蜂鸟流行音乐榜', bangid: '59703' }, { id: 'kg__52144', name: '抖音热歌榜', bangid: '52144' }, { id: 'kg__52767', name: '快手热歌榜', bangid: '52767' }, { id: 'kg__24971', name: 'DJ热歌榜', bangid: '24971' }, { id: 'kg__23784', name: '网络红歌榜', bangid: '23784' }, { id: 'kg__44412', name: '说唱先锋榜', bangid: '44412' }, { id: 'kg__31308', name: '内地榜', bangid: '31308' }, { id: 'kg__33160', name: '电音榜', bangid: '33160' }, { id: 'kg__31313', name: '香港地区榜', bangid: '31313' }, { id: 'kg__51341', name: '民谣榜', bangid: '51341' }, { id: 'kg__54848', name: '台湾地区榜', bangid: '54848' }, { id: 'kg__31310', name: '欧美榜', bangid: '31310' }, { id: 'kg__33162', name: 'ACG新歌榜', bangid: '33162' }, { id: 'kg__31311', name: '韩国榜', bangid: '31311' }, { id: 'kg__31312', name: '日本榜', bangid: '31312' }, { id: 'kg__49225', name: '80后热歌榜', bangid: '49225' }, { id: 'kg__49223', name: '90后热歌榜', bangid: '49223' }, { id: 'kg__49224', name: '00后热歌榜', bangid: '49224' }, { id: 'kg__33165', name: '粤语金曲榜', bangid: '33165' }, { id: 'kg__33166', name: '欧美金曲榜', bangid: '33166' }, { id: 'kg__33163', name: '影视金曲榜', bangid: '33163' }, { id: 'kg__51340', name: '伤感榜', bangid: '51340' }, { id: 'kg__35811', name: '会员专享榜', bangid: '35811' }, { id: 'kg__37361', name: '雷达榜', bangid: '37361' }, { id: 'kg__21101', name: '分享榜', bangid: '21101' }, { id: 'kg__46910', name: '综艺新歌榜', bangid: '46910' }, { id: 'kg__30972', name: '酷狗音乐人原创榜', bangid: '30972' }, { id: 'kg__60170', name: '闽南语榜', bangid: '60170' }, { id: 'kg__65234', name: '儿歌榜', bangid: '65234' }, { id: 'kg__4681', name: '美国BillBoard榜', bangid: '4681' }, { id: 'kg__25028', name: 'Beatport电子舞曲榜', bangid: '25028' }, { id: 'kg__4680', name: '英国单曲榜', bangid: '4680' }, { id: 'kg__38623', name: '韩国Melon音乐榜', bangid: '38623' }, { id: 'kg__42807', name: 'joox本地热歌榜', bangid: '42807' }, { id: 'kg__36107', name: '小语种热歌榜', bangid: '36107' }, { id: 'kg__4673', name: '日本公信榜', bangid: '4673' }, { id: 'kg__46868', name: '日本SPACE SHOWER榜', bangid: '46868' }, { id: 'kg__42808', name: 'KKBOX风云榜', bangid: '42808' }, { id: 'kg__60171', name: '越南语榜', bangid: '60171' }, { id: 'kg__60172', name: '泰语榜', bangid: '60172' }, { id: 'kg__59895', name: 'R&B榜', bangid: '59895' }, { id: 'kg__59896', name: '摇滚榜', bangid: '59896' }, { id: 'kg__59897', name: '爵士榜', bangid: '59897' }, { id: 'kg__59898', name: '乡村音乐榜', bangid: '59898' }, { id: 'kg__59900', name: '纯音乐榜', bangid: '59900' }, { id: 'kg__59899', name: '古典榜', bangid: '59899' }, { id: 'kg__22603', name: '5sing音乐榜', bangid: '22603' }, { id: 'kg__21335', name: '繁星音乐榜', bangid: '21335' }, { id: 'kg__33161', name: '古风新歌榜', bangid: '33161' }]
@ -8,7 +8,7 @@ export default {
list: [
{
id: 'kgtop500',
name: '酷狗TOP500',
name: 'TOP500',
bangid: '8888',
},
{
@ -126,7 +126,7 @@ export default {
}
}
return {
singer: decodeName(this.getSinger(item.authors)),
singer: getSingerName(item.authors, 'author_name'),
name: decodeName(item.songname),
albumName: decodeName(item.remark),
albumId: item.album_id,

View File

@ -6,93 +6,105 @@ export default {
total: 0,
page: 0,
allPage: 1,
filterSongData(rawData) {
musicSearch(str, page, limit) {
const sign = signatureParams(`userid=0&area_code=1&appid=1005&dopicfull=1&page=${page}&token=0&privilegefilter=0&requestid=0&pagesize=${limit}&user_labels=&clienttime=0&sec_aggre=1&iscorrection=1&uuid=0&mid=0&keyword=${str}&dfid=-&clientver=11409&platform=AndroidFilter&tag=`, 3)
return createHttpFetch(`https://gateway.kugou.com/complexsearch/v3/search/song?userid=0&area_code=1&appid=1005&dopicfull=1&page=${page}&token=0&privilegefilter=0&requestid=0&pagesize=${limit}&user_labels=&clienttime=0&sec_aggre=1&iscorrection=1&uuid=0&mid=0&dfid=-&clientver=11409&platform=AndroidFilter&tag=&keyword=${encodeURIComponent(str)}&signature=${sign}`, {
headers: {
'User-Agent': 'Android712-AndroidPhone-8983-18-0-COMMENT-wifi',
},
}).then(body => body)
},
filterList(raw) {
let ids = new Set()
const list = []
const filterList = (raw) => {
if (ids.has(raw.Audioid)) return
ids.add(raw.Audioid)
raw.forEach(item => {
if (ids.has(item.Audioid)) return
ids.add(item.Audioid)
const types = []
const _types = {}
if (raw.FileSize !== 0) {
let size = sizeFormate(raw.FileSize)
types.push({ type: '128k', size, hash: raw.FileHash })
if (item.FileSize !== 0) {
let size = sizeFormate(item.FileSize)
types.push({ type: '128k', size, hash: item.FileHash })
_types['128k'] = {
size,
hash: raw.FileHash,
hash: item.FileHash,
}
}
if (raw.HQ) {
let size = sizeFormate(raw.HQ.FileSize)
types.push({ type: '320k', size, hash: raw.HQ.Hash })
if (item.HQ) {
let size = sizeFormate(item.HQ.FileSize)
types.push({ type: '320k', size, hash: item.HQ.Hash })
_types['320k'] = {
size,
hash: raw.HQ.Hash,
hash: item.HQ.Hash,
}
}
if (raw.SQ) {
let size = sizeFormate(raw.SQ.FileSize)
types.push({ type: 'flac', size, hash: raw.SQ.Hash })
if (item.SQ) {
let size = sizeFormate(item.SQ.FileSize)
types.push({ type: 'flac', size, hash: item.SQ.Hash })
_types.flac = {
size,
hash: raw.SQ.Hash,
hash: item.SQ.Hash,
}
}
if (raw.Res) {
let size = sizeFormate(raw.Res.FileSize)
types.push({ type: 'flac24bit', size, hash: raw.Res.Hash })
if (item.Res) {
let size = sizeFormate(item.Res.FileSize)
types.push({ type: 'flac24bit', size, hash: item.Res.Hash })
_types.flac24bit = {
size,
hash: raw.Res.Hash,
hash: item.Res.Hash,
}
}
list.push({
singer: decodeName(raw.SingerName),
name: decodeName(raw.OriSongName),
albumName: decodeName(raw.AlbumName),
albumId: raw.AlbumID,
songmid: raw.Audioid,
singer: decodeName(item.SingerName),
name: decodeName(item.OriSongName),
albumName: decodeName(item.AlbumName),
albumId: item.AlbumID,
songmid: item.Audioid,
source: 'kg',
interval: formatPlayTime(raw.Duration),
_interval: raw.Duration,
interval: formatPlayTime(item.Duration),
_interval: item.Duration,
img: null,
lrc: null,
otherSource: null,
hash: raw.FileHash,
hash: item.FileHash,
types,
_types,
typeUrl: {},
})
}
rawData.forEach(item => {
filterList(item)
if (item.Grp) item.Grp.forEach(e => filterList(e))
})
return list
},
async search(str, page = 1, limit, retryNum = 0) {
handleResult(rawData) {
const rawList = []
rawData.forEach(item => {
rawList.push(item)
if (item.Grp) item.Grp.forEach(e => rawList.push(e))
})
return this.filterList(rawList)
},
search(str, page = 1, limit, retryNum = 0) {
if (++retryNum > 3) return Promise.reject(new Error('try max num'))
if (limit == null) limit = this.limit
const sign = signatureParams(`userid=0&area_code=1&appid=1005&dopicfull=1&page=${page}&token=0&privilegefilter=0&requestid=0&pagesize=${limit}&user_labels=&clienttime=0&sec_aggre=1&iscorrection=1&uuid=0&mid=0&keyword=${str}&dfid=-&clientver=11409&platform=AndroidFilter&tag=`, 3)
const searchResult = await createHttpFetch(`https://gateway.kugou.com/complexsearch/v3/search/song?userid=0&area_code=1&appid=1005&dopicfull=1&page=${page}&token=0&privilegefilter=0&requestid=0&pagesize=${limit}&user_labels=&clienttime=0&sec_aggre=1&iscorrection=1&uuid=0&mid=0&dfid=-&clientver=11409&platform=AndroidFilter&tag=&keyword=${encodeURIComponent(str)}&signature=${sign}`)
return this.musicSearch(str, page, limit).then(data => {
let list = this.handleResult(data.lists)
if (!list) return this.search(str, page, limit, retryNum)
let list = this.filterSongData(searchResult.lists)
if (!list) return this.search(str, page, limit, retryNum)
this.total = data.total
this.page = page
this.allPage = Math.ceil(this.total / limit)
this.total = searchResult.total
this.page = page
this.allPage = Math.ceil(this.total / limit)
return Promise.resolve({
list,
allPage: this.allPage,
limit,
total: this.total,
source: 'kg',
return Promise.resolve({
list,
allPage: this.allPage,
limit,
total: this.total,
source: 'kg',
})
})
},
}

View File

@ -1,5 +1,5 @@
import { httpFetch } from '../../request'
import { decodeName, formatPlayTime, sizeFormate, dateFormat } from '../../index'
import { decodeName, formatPlayTime, sizeFormate, dateFormat, getSingerName } from '../../index'
import { signatureParams, createHttpFetch } from './util'
import { getMusicInfosByList } from './musicInfo'
import album from './album'
@ -170,19 +170,6 @@ export default {
return `http://www2.kugou.kugou.com/yueku/v9/special/single/${id}-5-9999.html`
},
/**
* 格式化歌手
* @param {*} list
* @param {*} join
*/
getSinger(list, joinText = '、') {
const singers = []
list.forEach(item => {
if (!item.name) return
singers.push(item.name)
})
return singers ? singers.join(joinText) : ''
},
/**
* 格式化播放数量
* @param {*} num
@ -424,10 +411,9 @@ export default {
break
}
})
const singers = this.getSinger(item.singerinfo)
list.push({
singer: singers ? decodeName(singers) : decodeName(item.name).split(' - ')[0].replace(/&/g, '、'),
singer: getSingerName(item.singerinfo, 'name') || decodeName(item.name).split(' - ')[0].replace(/&/g, '、'),
name: decodeName(item.name).split(' - ')[1],
albumName: decodeName(item.albuminfo.name),
albumId: item.albuminfo.id,

View File

@ -1,14 +1,6 @@
import { sizeFormate } from '../../index'
import { sizeFormate, getSingerName } from '../../index'
import { createHttpFetch } from './util'
const getSinger = (singers) => {
let arr = []
singers?.forEach(singer => {
arr.push(singer.name)
})
return arr.join('、')
}
const createGetMusicInfosTask = (ids, resType = 2) => {
let list = ids
let tasks = []
@ -72,7 +64,7 @@ export const filterMusicInfoList = (rawList) => {
const intervalTest = /(\d\d:\d\d)$/.test(item.length)
list.push({
singer: getSinger(item.artists),
singer: getSingerName(item.artists, 'name'),
name: item.songName,
albumName: item.album,
albumId: item.albumId,

View File

@ -1,4 +1,4 @@
import { sizeFormate, formatPlayTime } from '../../index'
import { sizeFormate, formatPlayTime, getSingerName } from '../../index'
import { toMD5 } from '../utils'
import { createHttpFetch } from './util'
@ -13,24 +13,32 @@ export default {
page: 0,
allPage: 1,
deviceId: '963B7AA0D21511ED807EE5846EC87D20',
getSinger(singers) {
let arr = []
singers.forEach(singer => {
arr.push(singer.name)
})
return arr.join('、')
musicSearch(str, page, limit) {
// 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)}`)
const timeStr = Date.now().toString()
const signResult = searchSign(timeStr, str, this.deviceId)
return createHttpFetch(`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: this.deviceId,
timestamp: timeStr,
sign: signResult,
channel: '0146921',
'User-Agent': 'Mozilla/5.0 (Linux; U; Android 11.0.0; zh-cn; MI 11 Build/OPR1.170623.032) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30',
},
}).then(body => body)
},
filterSongData(rawData) {
const list = []
filterList(raw) {
const ids = new Set()
const list = []
rawData.forEach(data => {
if (!data.songId || !data.copyrightId || ids.has(data.copyrightId)) return
ids.add(data.copyrightId)
raw.forEach(item => {
if (!item.songId || !item.copyrightId || ids.has(item.copyrightId)) return
ids.add(item.copyrightId)
const types = []
const _types = {}
data.audioFormats && data.audioFormats.forEach(type => {
item.audioFormats && item.audioFormats.forEach(type => {
let size
switch (type.formatType) {
case 'PQ':
@ -64,66 +72,55 @@ export default {
}
})
let img = data.img3 || data.img2 || data.img1 || null
if (img && !/https?:/.test(data.img3)) img = 'http://d.musicapp.migu.cn' + img
let img = item.img3 || item.img2 || item.img1 || null
if (img && !/https?:/.test(item.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.songId,
copyrightId: data.copyrightId,
singer: getSingerName(item.singerList, 'name'),
name: item.name,
albumName: item.album,
albumId: item.albumId,
songmid: item.songId,
copyrightId: item.copyrightId,
source: 'mg',
interval: formatPlayTime(data.duration),
interval: formatPlayTime(item.duration),
img,
lrc: null,
lrcUrl: data.lrcUrl,
mrcUrl: data.mrcurl,
trcUrl: data.trcUrl,
lrcUrl: item.lrcUrl,
mrcUrl: item.mrcurl,
trcUrl: item.trcUrl,
types,
_types,
typeUrl: {},
})
})
return list
},
// 旧版API
// 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)}`)
async search(str, page = 1, limit, retryNum = 0) {
handleResult(rawData) {
return this.filterList(rawData.flat())
},
search(str, page = 1, limit, retryNum = 0) {
if (++retryNum > 3) return Promise.reject(new Error('try max num'))
if (limit == null) limit = this.limit
const timeStr = Date.now().toString()
const signResult = searchSign(timeStr, str, this.deviceId)
const searchResult = await createHttpFetch(`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: this.deviceId,
timestamp: timeStr,
sign: signResult,
channel: '0146921',
'User-Agent': 'Mozilla/5.0 (Linux; U; Android 11.0.0; zh-cn; MI 11 Build/OPR1.170623.032) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30',
},
return this.musicSearch(str, page, limit).then(data => {
const songResultData = data.songResultData || { resultList: [], totalCount: 0 }
let list = this.handleResult(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({
list,
allPage: this.allPage,
limit,
total: this.total,
source: 'mg',
})
})
const songResultData = searchResult.songResultData || { resultList: [], totalCount: 0 }
let list = this.filterSongData(songResultData.resultList.flat())
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 {
list,
allPage: this.allPage,
limit,
total: this.total,
source: 'mg',
}
},
}

View File

@ -85,7 +85,7 @@ export default {
// console.log(JSON.stringify(body))
// console.log(body)
return {
list: filterMusicInfoData(body.list),
list: filterMusicInfoList(body.list),
page,
limit: this.limit_song,
total: body.totalCount,

View File

@ -1,5 +1,5 @@
import { httpFetch } from '../../request'
import { formatPlayTime, sizeFormate } from '../../index'
import { formatPlayTime, sizeFormate, getSingerName } from '../../index'
let boardList = [{ id: 'tx__4', name: '流行指数榜', bangid: '4' }, { id: 'tx__26', name: '热歌榜', bangid: '26' }, { id: 'tx__27', name: '新歌榜', bangid: '27' }, { id: 'tx__62', name: '飙升榜', bangid: '62' }, { id: 'tx__58', name: '说唱榜', bangid: '58' }, { id: 'tx__57', name: '喜力电音榜', bangid: '57' }, { id: 'tx__28', name: '网络歌曲榜', bangid: '28' }, { id: 'tx__5', name: '内地榜', bangid: '5' }, { id: 'tx__3', name: '欧美榜', bangid: '3' }, { id: 'tx__59', name: '香港地区榜', bangid: '59' }, { id: 'tx__16', name: '韩国榜', bangid: '16' }, { id: 'tx__60', name: '抖快榜', bangid: '60' }, { id: 'tx__29', name: '影视金曲榜', bangid: '29' }, { id: 'tx__17', name: '日本榜', bangid: '17' }, { id: 'tx__52', name: '腾讯音乐人原创榜', bangid: '52' }, { id: 'tx__36', name: 'K歌金曲榜', bangid: '36' }, { id: 'tx__61', name: '台湾地区榜', bangid: '61' }, { id: 'tx__63', name: 'DJ舞曲榜', bangid: '63' }, { id: 'tx__64', name: '综艺新歌榜', bangid: '64' }, { id: 'tx__65', name: '国风热歌榜', bangid: '65' }, { id: 'tx__67', name: '听歌识曲榜', bangid: '67' }, { id: 'tx__72', name: '动漫音乐榜', bangid: '72' }, { id: 'tx__73', name: '游戏音乐榜', bangid: '73' }, { id: 'tx__75', name: '有声榜', bangid: '75' }, { id: 'tx__131', name: '校园音乐人排行榜', bangid: '131' }]
@ -104,13 +104,6 @@ export default {
const requestDataObj = httpFetch(url)
return requestDataObj.promise
},
getSinger(singers) {
let arr = []
singers.forEach(singer => {
arr.push(singer.name)
})
return arr.join('、')
},
filterData(rawList) {
// console.log(rawList)
return rawList.map(item => {
@ -146,7 +139,7 @@ export default {
}
// types.reverse()
return {
singer: this.getSinger(item.singer),
singer: getSingerName(item.singer, 'name'),
name: item.name,
albumName: item.album.name,
albumId: item.album.mid,

View File

@ -1,13 +1,5 @@
import { httpFetch } from '../../request'
import { formatPlayTime, sizeFormate } from '../../index'
const getSinger = (singers) => {
let arr = []
singers.forEach(singer => {
arr.push(singer.name)
})
return arr.join('、')
}
import { formatPlayTime, sizeFormate, getSingerName } from '../../index'
export default (songmid) => {
const requestObj = httpFetch('https://u.y.qq.com/cgi-bin/musicu.fcg', {
@ -76,7 +68,7 @@ export default (songmid) => {
albumId = item.album.mid
}
return {
singer: getSinger(item.singer),
singer: getSingerName(item.singer, 'name'),
name: item.name,
albumName,
albumId,

View File

@ -1,7 +1,5 @@
// import '../../polyfill/array.find'
import { httpFetch } from '../../request'
import { formatPlayTime, sizeFormate } from '../../index'
import { formatPlayTime, sizeFormate, getSingerName } from '../../index'
// import { debug } from '../../utils/env'
// import { formatSinger } from './util'
@ -52,13 +50,6 @@ export default {
return body.req.data
})
},
getSinger(singers) {
let arr = []
singers.forEach(singer => {
arr.push(singer.name)
})
return arr.join('、')
},
handleResult(rawList) {
// console.log(rawList)
const list = []
@ -104,7 +95,7 @@ export default {
albumId = item.album.mid
}
list.push({
singer: this.getSinger(item.singer),
singer: getSingerName(item.singer, 'name'),
name: item.name,
albumName,
albumId,

View File

@ -1,5 +1,5 @@
import { httpFetch } from '../../request'
import { decodeName, formatPlayTime, sizeFormate, dateFormat } from '../../index'
import { decodeName, formatPlayTime, sizeFormate, dateFormat, getSingerName } from '../../index'
export default {
_requestObj_tags: null,
@ -232,13 +232,6 @@ export default {
},
}
},
getSinger(singers) {
let arr = []
singers.forEach(singer => {
arr.push(singer.name)
})
return arr.join('、')
},
filterListDetail(rawList) {
// console.log(rawList)
return rawList.map(item => {
@ -274,7 +267,7 @@ export default {
}
// types.reverse()
return {
singer: this.getSinger(item.singer),
singer: getSingerName(item.singer, 'name'),
name: item.name,
albumName: item.album.name,
albumId: item.album.mid,

View File

@ -1,16 +1,9 @@
import { httpFetch } from '../../request'
import { weapi } from './utils/crypto'
import { formatPlayTime, sizeFormate } from '../../index'
import { formatPlayTime, sizeFormate, getSingerName } from '../../index'
// https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/module/song_detail.js
export default {
getSinger(singers) {
let arr = []
singers?.forEach(singer => {
arr.push(singer.name)
})
return arr.join('、')
},
filterList({ songs, privileges }) {
// console.log(songs, privileges)
const list = []
@ -71,7 +64,7 @@ export default {
})
} else {
list.push({
singer: this.getSinger(item.ar),
singer: getSingerName(item.ar, 'name'),
name: item.name ?? '',
albumName: item.al?.name,
albumId: item.al?.id,

View File

@ -1,6 +1,6 @@
// import { httpFetch } from '../../request'
// import { weapi } from './utils/crypto'
import { sizeFormate, formatPlayTime } from '../../index'
import { sizeFormate, formatPlayTime, getSingerName } from '../../index'
// import musicDetailApi from './musicDetail'
import { eapiRequest } from './utils/index'
@ -19,13 +19,6 @@ export default {
})
return searchRequest.promise.then(({ body }) => body)
},
getSinger(singers) {
let arr = []
singers.forEach(singer => {
arr.push(singer.name)
})
return arr.join('、')
},
handleResult(rawList) {
// console.log(rawList)
if (!rawList) return []
@ -66,7 +59,7 @@ export default {
types.reverse()
return {
singer: this.getSinger(item.ar),
singer: getSingerName(item.ar, 'name'),
name: item.name,
albumName: item.al.name,
albumId: item.al.id,

View File

@ -5,7 +5,7 @@
import { weapi, linuxapi } from './utils/crypto'
import { httpFetch } from '../../request'
import { formatPlayTime, sizeFormate, dateFormat } from '../../index'
import { formatPlayTime, sizeFormate, dateFormat, getSingerName } from '../../index'
import musicDetailApi from './musicDetail'
import { eapiRequest } from './utils/index'
@ -40,13 +40,6 @@ export default {
if (num > 10000) return parseInt(num / 1000) / 10 + '万'
return num
},
getSinger(singers) {
let arr = []
singers?.forEach(singer => {
arr.push(singer.name)
})
return arr.join('、')
},
async handleParseId(link, retryNum = 0) {
if (retryNum > 2) throw new Error('link try max num')
@ -198,7 +191,7 @@ export default {
})
} else {
list.push({
singer: this.getSinger(item.ar),
singer: getSingerName(item.ar, 'name'),
name: item.name ?? '',
albumName: item.al?.name,
albumId: item.al?.id,