Skip to content

Commit

Permalink
修复wy源热搜词 (lyswhut#1403)
Browse files Browse the repository at this point in the history
* 修复wy源热搜词失效

* 添加更新日志

---------

Co-authored-by: lyswhut <[email protected]>
  • Loading branch information
Folltoshe and lyswhut authored Jun 8, 2023
1 parent fd2dca0 commit d93fbd6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
1 change: 1 addition & 0 deletions publish/changeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- 修复播放某些在线音频会没有声音的问题
- 修复改变播放速率时会导致歌词报错的问题
- 修复tx热门评论昵称被错误切割的问题 (#1397, By: @helloplhm-qwq, @Folltoshe)
- 修复wy源热搜词失效的问题(#1401, @Folltoshe
- 修复Deepin 20下启用桌面歌词时可能会导致桌面卡死的问题(#1288

### 其他
Expand Down
18 changes: 6 additions & 12 deletions src/renderer/utils/musicSdk/wy/hotSearch.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
import { httpFetch } from '../../request'
import { weapi } from './utils/crypto'
import { eapiRequest } from './utils/index'

export default {
_requestObj: null,
async getList(retryNum = 0) {
if (this._requestObj) this._requestObj.cancelHttp()
if (retryNum > 2) return Promise.reject(new Error('try max num'))

const _requestObj = httpFetch('https://music.163.com/weapi/search/hot', {
method: 'post',
headers: {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36',
origin: 'https://music.163.com',
},
form: weapi({ type: 1111 }),
const _requestObj = eapiRequest('/api/search/chart/detail', {
id: 'HOT_SEARCH_SONG#@#',
})
const { body, statusCode } = await _requestObj.promise
if (statusCode != 200 || body.code !== 200) throw new Error('获取热搜词失败')
// console.log(body)
return { source: 'wy', list: this.filterList(body.result.hots) }

return { source: 'wy', list: this.filterList(body.data.itemList) }
},
filterList(rawList) {
return rawList.map(item => item.first)
return rawList.map(item => item.searchWord)
},
}

0 comments on commit d93fbd6

Please sign in to comment.