支持wy热门评论翻页

pull/1353/head
lyswhut 2023-04-28 19:49:53 +08:00
parent e6f55804f4
commit f8ae906326
2 changed files with 9 additions and 10 deletions

View File

@ -6,6 +6,7 @@
- 增加tx源热门评论图片显示@Folltoshe
- 优化更新弹窗弹出时机
- 优化搜索框背景配色,使其适应高透明主题
- 支持wy热门评论翻页
### 修复

View File

@ -152,7 +152,7 @@ export default {
const id = 'R_SO_4_' + songmid
const _requestObj2 = httpFetch('https://music.163.com/weapi/comment/resource/comments/get', {
const _requestObj2 = httpFetch(`https://music.163.com/weapi/v1/resource/hotcomments/${id}`, {
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',
@ -160,20 +160,16 @@ export default {
Refere: 'http://music.163.com/',
},
form: weapi({
cursor: Date.now().toString(),
offset: 0,
orderType: 1,
pageNo: page,
pageSize: limit,
rid: id,
threadId: id,
limit,
offset: limit * page,
beforeTime: Date.now().toString(),
}),
})
const { body, statusCode } = await _requestObj2.promise
if (statusCode != 200 || body.code !== 200) throw new Error('获取热门评论失败')
// console.log(body)
const total = body.data.hotComments?.length ?? 0
return { source: 'wy', comments: this.filterComment(body.data.hotComments), total, page, limit, maxPage: 1 }
const total = body.total ?? 0
return { source: 'wy', comments: this.filterComment(body.hotComments), total, page, limit, maxPage: Math.ceil(total / limit) || 1 }
},
filterComment(rawList) {
return rawList.map(item => {
@ -182,6 +178,7 @@ export default {
text: item.content ? applyEmoji(item.content) : '',
time: item.time ? item.time : '',
timeStr: item.time ? dateFormat2(item.time) : '',
location: item.ipLocation?.location,
userName: item.user.nickname,
avatar: item.user.avatarUrl,
userId: item.user.userId,
@ -197,6 +194,7 @@ export default {
text: replyData.content ? applyEmoji(replyData.content) : '',
time: item.time,
timeStr: null,
location: replyData.ipLocation?.location,
userName: replyData.user.nickname,
avatar: replyData.user.avatarUrl,
userId: replyData.user.userId,