修复kg最新评论无法获取的问题(@helloplhm-qwq)

pull/1072/merge
lyswhut 2024-03-02 15:04:05 +08:00
parent 3c28c4861b
commit 03781ea692
3 changed files with 14 additions and 5 deletions

View File

@ -5,14 +5,15 @@
### 优化
- 主题设置默认折叠其他主题以优化进入设置界面时的性能
- 不再丢弃kg源逐行歌词
- 不再丢弃kg源逐行歌词@helloplhm-qwq
- 支持kw源排行榜显示大小revert @Folltoshe #1460
### 修复
- 修复某些情况下歌曲加载时间过长时不会自动跳到下一首的问题
- 修复mg歌词在某些情况下获取失败的问题#1783
- 修复mg歌单搜索
- 修复mg歌单搜索@helloplhm-qwq
- 修复kg最新评论无法获取的问题@helloplhm-qwq
- 修复更新超时弹窗在非更新阶段意外弹出的问题(#1797
### 其他

View File

@ -1,6 +1,7 @@
import { httpFetch } from '../../request'
import { decodeName, dateFormat2 } from '../../index'
import { signatureParams } from './util'
import { getMusicInfoRaw } from './musicInfo'
export default {
_requestObj: null,
@ -8,8 +9,11 @@ export default {
async getComment({ hash }, page = 1, limit = 20) {
if (this._requestObj) this._requestObj.cancelHttp()
const res_id = (await getMusicInfoRaw(hash)).classification?.[0]?.res_id
if (!res_id) throw new Error('获取评论失败')
let timestamp = Date.now()
const params = `appid=1005&clienttime=${timestamp}&clienttoken=0&clientver=11409&code=fc4be23b4e972707f36b8a828a93ba8a&dfid=0&extdata=${hash}&kugouid=0&mid=16249512204336365674023395779019&mixsongid=0&p=${page}&pagesize=${limit}&uuid=0&ver=10`
const params = `appid=1005&clienttime=${timestamp}&clienttoken=0&clientver=11409&code=fc4be23b4e972707f36b8a828a93ba8a&dfid=0&extdata=${hash}&kugouid=0&mid=16249512204336365674023395779019&mixsongid=${res_id}&p=${page}&pagesize=${limit}&uuid=0&ver=10`
const _requestObj = httpFetch(`http://m.comment.service.kugou.com/r/v1/rank/newest?${params}&signature=${signatureParams(params)}`, {
headers: {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.24',

View File

@ -13,7 +13,7 @@ const createGetMusicInfosTask = (hashs) => {
dfid: '-',
clienttime: Date.now(),
key: 'OIlwieks28dk2k092lksi2UIkp',
fields: 'album_info,author_name,audio_info,ori_audio_name,base,songname',
fields: 'album_info,author_name,audio_info,ori_audio_name,base,songname,classification',
}
let list = hashs
let tasks = []
@ -103,8 +103,12 @@ export const getMusicInfos = async(hashs) => {
return filterMusicInfoList(await Promise.all(createGetMusicInfosTask(hashs)).then(data => data.flat()))
}
export const getMusicInfoRaw = async(hash) => {
return Promise.all(createGetMusicInfosTask([{ hash }])).then(data => data.flat()[0])
}
export const getMusicInfo = async(hash) => {
return getMusicInfos([hash]).then(data => data[0])
return getMusicInfos([{ hash }]).then(data => data[0])
}
export const getMusicInfosByList = (list) => {