修复咪咕源无法搜索的问题
parent
0c9c3c61fc
commit
d4d6b9c9aa
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
### 修复
|
### 修复
|
||||||
|
|
||||||
|
- 修复咪咕源无法搜索的问题
|
||||||
- 修复更新弹窗底部文字颜色没有适配当前主题颜色的问题
|
- 修复更新弹窗底部文字颜色没有适配当前主题颜色的问题
|
||||||
- 修复导入设置窗口大小、代理设置不立即生效的问题
|
- 修复导入设置窗口大小、代理设置不立即生效的问题
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// import '../../polyfill/array.find'
|
// import '../../polyfill/array.find'
|
||||||
// import jshtmlencode from 'js-htmlencode'
|
// import jshtmlencode from 'js-htmlencode'
|
||||||
import { httpFetch } from '../../request'
|
import { httpFetch } from '../../request'
|
||||||
import { sizeFormate } from '../../index'
|
// import { sizeFormate } from '../../index'
|
||||||
// import { debug } from '../../utils/env'
|
// import { debug } from '../../utils/env'
|
||||||
// import { formatSinger } from './util'
|
// import { formatSinger } from './util'
|
||||||
|
|
||||||
|
@ -13,7 +13,8 @@ export default {
|
||||||
allPage: 1,
|
allPage: 1,
|
||||||
musicSearch(str, page) {
|
musicSearch(str, page) {
|
||||||
if (searchRequest && searchRequest.cancelHttp) searchRequest.cancelHttp()
|
if (searchRequest && searchRequest.cancelHttp) searchRequest.cancelHttp()
|
||||||
searchRequest = httpFetch(`https://app.c.nf.migu.cn/MIGUM2.0/v1.0/content/search_all.do?isCopyright=1&isCorrect=1&pageNo=${page}&pageSize=${this.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://m.music.migu.cn/migu/remoting/scr_search_tag?rows=${this.limit}&type=2&keyword=${encodeURIComponent(str)}&pgc=${page}`)
|
||||||
|
// searchRequest = httpFetch(`https://app.c.nf.migu.cn/MIGUM2.0/v1.0/content/search_all.do?isCopyright=1&isCorrect=1&pageNo=${page}&pageSize=${this.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)}`)
|
||||||
return searchRequest.promise.then(({ body }) => body)
|
return searchRequest.promise.then(({ body }) => body)
|
||||||
},
|
},
|
||||||
getSinger(singers) {
|
getSinger(singers) {
|
||||||
|
@ -32,54 +33,80 @@ export default {
|
||||||
ids.add(item.id)
|
ids.add(item.id)
|
||||||
const types = []
|
const types = []
|
||||||
const _types = {}
|
const _types = {}
|
||||||
item.rateFormats && item.rateFormats.forEach(type => {
|
types.push({ type: '128k' })
|
||||||
let size
|
_types['128k'] = {}
|
||||||
switch (type.formatType) {
|
if (item.hasHQqq) {
|
||||||
case 'PQ':
|
types.push({ type: '320k' })
|
||||||
size = sizeFormate(type.size)
|
_types['320k'] = {}
|
||||||
types.push({ type: '128k', size })
|
|
||||||
_types['128k'] = {
|
|
||||||
size,
|
|
||||||
}
|
}
|
||||||
break
|
if (item.hasSQqq) {
|
||||||
case 'HQ':
|
types.push({ type: 'flac' })
|
||||||
size = sizeFormate(type.size)
|
_types.flac = {}
|
||||||
types.push({ type: '320k', size })
|
|
||||||
_types['320k'] = {
|
|
||||||
size,
|
|
||||||
}
|
}
|
||||||
break
|
// item.rateFormats && item.rateFormats.forEach(type => {
|
||||||
case 'SQ':
|
// let size
|
||||||
size = sizeFormate(type.size)
|
// switch (type.formatType) {
|
||||||
types.push({ type: 'flac', size })
|
// case 'PQ':
|
||||||
_types.flac = {
|
// size = sizeFormate(type.size)
|
||||||
size,
|
// types.push({ type: '128k', size })
|
||||||
}
|
// _types['128k'] = {
|
||||||
break
|
// size,
|
||||||
}
|
// }
|
||||||
})
|
// break
|
||||||
|
// case 'HQ':
|
||||||
const albumNInfo = item.albums && item.albums.length ? {
|
// size = sizeFormate(type.size)
|
||||||
id: item.albums[0].id,
|
// types.push({ type: '320k', size })
|
||||||
name: item.albums[0].name,
|
// _types['320k'] = {
|
||||||
} : {}
|
// size,
|
||||||
|
// }
|
||||||
|
// break
|
||||||
|
// case 'SQ':
|
||||||
|
// size = sizeFormate(type.size)
|
||||||
|
// types.push({ type: 'flac', size })
|
||||||
|
// _types.flac = {
|
||||||
|
// size,
|
||||||
|
// }
|
||||||
|
// break
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
list.push({
|
list.push({
|
||||||
singer: this.getSinger(item.singers),
|
singer: item.singerName.replace(', ', '、'),
|
||||||
name: item.name,
|
name: item.songName,
|
||||||
albumName: albumNInfo.name,
|
albumName: item.albumName,
|
||||||
albumId: albumNInfo.id,
|
albumId: item.albumId,
|
||||||
songmid: item.id,
|
songmid: item.id,
|
||||||
copyrightId: item.copyrightId,
|
copyrightId: item.copyrightId,
|
||||||
source: 'mg',
|
source: 'mg',
|
||||||
interval: null,
|
interval: null,
|
||||||
img: item.imgItems && item.imgItems.length ? item.imgItems[0].img : null,
|
img: item.cover,
|
||||||
lrc: null,
|
lrc: null,
|
||||||
lrcUrl: item.lyricUrl,
|
// lrcUrl: item.lyrics,
|
||||||
types,
|
types,
|
||||||
_types,
|
_types,
|
||||||
typeUrl: {},
|
typeUrl: {},
|
||||||
})
|
})
|
||||||
|
// const albumNInfo = item.albums && item.albums.length ? {
|
||||||
|
// id: item.albums[0].id,
|
||||||
|
// name: item.albums[0].name,
|
||||||
|
// } : {}
|
||||||
|
|
||||||
|
// list.push({
|
||||||
|
// singer: this.getSinger(item.singers),
|
||||||
|
// name: item.name,
|
||||||
|
// albumName: albumNInfo.name,
|
||||||
|
// albumId: albumNInfo.id,
|
||||||
|
// songmid: item.id,
|
||||||
|
// copyrightId: item.copyrightId,
|
||||||
|
// source: 'mg',
|
||||||
|
// interval: null,
|
||||||
|
// img: item.imgItems && item.imgItems.length ? item.imgItems[0].img : null,
|
||||||
|
// lrc: null,
|
||||||
|
// lrcUrl: item.lyricUrl,
|
||||||
|
// types,
|
||||||
|
// _types,
|
||||||
|
// typeUrl: {},
|
||||||
|
// })
|
||||||
})
|
})
|
||||||
return list
|
return list
|
||||||
},
|
},
|
||||||
|
@ -87,12 +114,13 @@ export default {
|
||||||
if (limit != null) this.limit = limit
|
if (limit != null) this.limit = limit
|
||||||
// http://newlyric.kuwo.cn/newlyric.lrc?62355680
|
// http://newlyric.kuwo.cn/newlyric.lrc?62355680
|
||||||
return this.musicSearch(str, page).then(result => {
|
return this.musicSearch(str, page).then(result => {
|
||||||
if (!result || result.code !== '000000') return this.search(str, page, { limit })
|
// console.log(result)
|
||||||
let list = this.handleResult(result.songResultData.resultList.flat())
|
if (!result || result.success !== true) return Promise.reject(new Error(result ? result.info : '搜索失败'))
|
||||||
|
let list = result.musics ? this.handleResult(result.musics) : []
|
||||||
|
|
||||||
if (list == null) return this.search(str, page, { limit })
|
if (list == null) return this.search(str, page, { limit })
|
||||||
|
|
||||||
this.total = parseInt(result.songResultData.totalCount)
|
this.total = parseInt(result.pgt)
|
||||||
this.page = page
|
this.page = page
|
||||||
this.allPage = Math.ceil(this.total / this.limit)
|
this.allPage = Math.ceil(this.total / this.limit)
|
||||||
|
|
||||||
|
@ -103,6 +131,22 @@ export default {
|
||||||
total: this.total,
|
total: this.total,
|
||||||
source: 'mg',
|
source: 'mg',
|
||||||
})
|
})
|
||||||
|
// if (!result || result.code !== '000000') return Promise.reject(new Error(result ? result.info : '搜索失败'))
|
||||||
|
// let list = this.handleResult(result.songResultData.resultList.flat())
|
||||||
|
|
||||||
|
// if (list == null) return this.search(str, page, { limit })
|
||||||
|
|
||||||
|
// this.total = parseInt(result.songResultData.totalCount)
|
||||||
|
// this.page = page
|
||||||
|
// this.allPage = Math.ceil(this.total / this.limit)
|
||||||
|
|
||||||
|
// return Promise.resolve({
|
||||||
|
// list,
|
||||||
|
// allPage: this.allPage,
|
||||||
|
// limit: this.limit,
|
||||||
|
// total: this.total,
|
||||||
|
// source: 'mg',
|
||||||
|
// })
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue