fix: 网易云部分歌曲无法被搜索 (#2666)
* fix: 网易云部分歌曲无法被搜索 将搜索请求由原有 eapiRequest 改为通过 httpFetch 调用 /eapi/search/song/list/page 并使用 eapi 加密表单;调整导入(使用 eapi)、移除部分注释和冗余代码。更新结果解析以兼容新响应结构(使用 item.baseInfo.simpleSongData、result.data.resources 和 result.data.totalCount 等字段),并保留原有的分页与重试逻辑。 * update * update --------- Co-authored-by: lyswhut <lyswhut@qq.com>
This commit is contained in:
@@ -9,3 +9,4 @@
|
|||||||
|
|
||||||
- 修复音量条在调整音量时实际音量与显示的数值不一致的问题(#2606)
|
- 修复音量条在调整音量时实际音量与显示的数值不一致的问题(#2606)
|
||||||
- 修复某些情况下搜索框的搜索按钮布局错位的问题(#2622)
|
- 修复某些情况下搜索框的搜索按钮布局错位的问题(#2622)
|
||||||
|
- 修复 wyy 部分歌曲无法被搜索的问题(#2666, @ikun0014)
|
||||||
|
|||||||
@@ -10,12 +10,21 @@ export default {
|
|||||||
page: 0,
|
page: 0,
|
||||||
allPage: 1,
|
allPage: 1,
|
||||||
musicSearch(str, page, limit) {
|
musicSearch(str, page, limit) {
|
||||||
const searchRequest = eapiRequest('/api/cloudsearch/pc', {
|
// const searchRequest = eapiRequest('/api/cloudsearch/pc', {
|
||||||
s: str,
|
// s: str,
|
||||||
type: 1, // 1: 单曲, 10: 专辑, 100: 歌手, 1000: 歌单, 1002: 用户, 1004: MV, 1006: 歌词, 1009: 电台, 1014: 视频
|
// type: 1, // 1: 单曲, 10: 专辑, 100: 歌手, 1000: 歌单, 1002: 用户, 1004: MV, 1006: 歌词, 1009: 电台, 1014: 视频
|
||||||
limit,
|
// limit,
|
||||||
total: page == 1,
|
// total: page == 1,
|
||||||
|
// offset: limit * (page - 1),
|
||||||
|
// })
|
||||||
|
const searchRequest = eapiRequest('/api/search/song/list/page', {
|
||||||
|
keyword: str,
|
||||||
|
needCorrect: '1',
|
||||||
|
channel: 'typing',
|
||||||
offset: limit * (page - 1),
|
offset: limit * (page - 1),
|
||||||
|
scene: 'normal',
|
||||||
|
total: page == 1,
|
||||||
|
limit,
|
||||||
})
|
})
|
||||||
return searchRequest.promise.then(({ body }) => body)
|
return searchRequest.promise.then(({ body }) => body)
|
||||||
},
|
},
|
||||||
@@ -30,6 +39,7 @@ export default {
|
|||||||
// console.log(rawList)
|
// console.log(rawList)
|
||||||
if (!rawList) return []
|
if (!rawList) return []
|
||||||
return rawList.map(item => {
|
return rawList.map(item => {
|
||||||
|
item = item.baseInfo.simpleSongData
|
||||||
const types = []
|
const types = []
|
||||||
const _types = {}
|
const _types = {}
|
||||||
let size
|
let size
|
||||||
@@ -87,12 +97,12 @@ export default {
|
|||||||
return this.musicSearch(str, page, limit).then(result => {
|
return this.musicSearch(str, page, limit).then(result => {
|
||||||
// console.log(result)
|
// console.log(result)
|
||||||
if (!result || result.code !== 200) return this.search(str, page, limit, retryNum)
|
if (!result || result.code !== 200) return this.search(str, page, limit, retryNum)
|
||||||
let list = this.handleResult(result.result.songs || [])
|
let list = this.handleResult(result.data.resources || [])
|
||||||
// console.log(list)
|
// console.log(list)
|
||||||
|
|
||||||
if (list == null) return this.search(str, page, limit, retryNum)
|
if (list == null) return this.search(str, page, limit, retryNum)
|
||||||
|
|
||||||
this.total = result.result.songCount || 0
|
this.total = result.data.totalCount || 0
|
||||||
this.page = page
|
this.page = page
|
||||||
this.allPage = Math.ceil(this.total / this.limit)
|
this.allPage = Math.ceil(this.total / this.limit)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user