This commit is contained in:
Folltoshe 2023-04-28 19:51:17 +08:00
parent 25ce6b7c04
commit b3e125c352

View File

@ -147,24 +147,20 @@ export default {
cursorTools.setCursor(songmid, body.data.cursor, cursorInfo.orderType, cursorInfo.offset, page) cursorTools.setCursor(songmid, body.data.cursor, cursorInfo.orderType, cursorInfo.offset, page)
return { source: 'wy', comments: this.filterComment(body.data.comments), total: body.data.totalCount, page, limit, maxPage: Math.ceil(body.data.totalCount / limit) || 1 } return { source: 'wy', comments: this.filterComment(body.data.comments), total: body.data.totalCount, page, limit, maxPage: Math.ceil(body.data.totalCount / limit) || 1 }
}, },
async getHotComment({ songmid }, page = 1, limit = 10) { async getHotComment({ songmid }, page = 1, limit = 20) {
// 这个API每次最多获取10个
if (limit > 10) limit = 10
const id = idPrefix + songmid const id = idPrefix + songmid
if (this._requestObj2) this._requestObj2.cancelHttp() if (this._requestObj2) this._requestObj2.cancelHttp()
const _requestObj2 = httpFetch(`https://music.163.com/weapi/v1/resource/hotcomments/${id}`, { const _requestObj2 = httpFetch(`https://music.163.com/weapi/v1/resource/hotcomments/${id}`, {
method: 'POST', method: 'POST',
headers: { 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',
Refere: 'http://music.163.com/', Refere: 'http://music.163.com/',
}, },
form: weapi({ form: weapi({
rid: id, rid: id,
beforeTime: Date.now().toString(), beforeTime: Date.now().toString(),
offset: page === 1 ? 0 : (page - 1) * limit, offset: page === 1 ? 0 : (page - 1) * limit,
pageSize: limit, limit,
}), }),
}) })