优化 tx 推荐歌单列表

This commit is contained in:
lyswhut
2026-09-16 21:18:54 +08:00
parent 950029884c
commit bb8d07274f
2 changed files with 85 additions and 40 deletions
+2 -3
View File
@@ -3,7 +3,6 @@
对于日常使用 LX Music 的人可以试试迁移到 Any Listen,若遇到任何问题可以发 issue 反馈。
Any Listen 的项目地址为 https://github.com/any-listen/any-listen
### 修复
### 优化
- 修复自定义主题编辑器的颜色选择器默认值显示异常的问题(#2957)
- 修复下载的 MP3 文件内嵌歌曲数据失败的问题(#2959)
- 优化 tx 推荐歌单列表
+81 -35
View File
@@ -10,9 +10,13 @@ export default {
limit_song: 100000,
successCode: 0,
sortList: [
{
name: '推荐',
id: -1,
},
{
name: '最热',
id: 5,
id: 3,
},
{
name: '最新',
@@ -30,8 +34,7 @@ export default {
},
tagsUrl: 'https://u.y.qq.com/cgi-bin/musicu.fcg?loginUin=0&hostUin=0&format=json&inCharset=utf-8&outCharset=utf-8&notice=0&platform=wk_v15.json&needNewCode=0&data=%7B%22tags%22%3A%7B%22method%22%3A%22get_all_categories%22%2C%22param%22%3A%7B%22qq%22%3A%22%22%7D%2C%22module%22%3A%22playlist.PlaylistAllCategoriesServer%22%7D%7D',
hotTagUrl: 'https://c.y.qq.com/node/pc/wk_v15/category_playlist.html',
getListUrl(sortId, id, page) {
if (id) {
getListUrl(id, page) {
id = parseInt(id)
return `https://u.y.qq.com/cgi-bin/musicu.fcg?loginUin=0&hostUin=0&format=json&inCharset=utf-8&outCharset=utf-8&notice=0&platform=wk_v15.json&needNewCode=0&data=${encodeURIComponent(JSON.stringify({
comm: { cv: 1602, ct: 20 },
@@ -48,15 +51,14 @@ export default {
module: 'playlist.PlayListCategoryServer',
},
}))}`
}
return `https://u.y.qq.com/cgi-bin/musicu.fcg?loginUin=0&hostUin=0&format=json&inCharset=utf-8&outCharset=utf-8&notice=0&platform=wk_v15.json&needNewCode=0&data=${encodeURIComponent(JSON.stringify({
comm: { cv: 1602, ct: 20 },
playlist: {
method: 'get_playlist_by_tag',
param: { id: 10000000, sin: this.limit_list * (page - 1), size: this.limit_list, order: sortId, cur_page: page },
module: 'playlist.PlayListPlazaServer',
},
}))}`
// return `https://u.y.qq.com/cgi-bin/musicu.fcg?loginUin=0&hostUin=0&format=json&inCharset=utf-8&outCharset=utf-8&data=${encodeURIComponent(JSON.stringify({
// comm: { cv: 1602, ct: 20 },
// playlist: {
// method: 'get_playlist_by_tag',
// param: { id: 10000000, sin: this.limit_list * (page - 1), size: this.limit_list, order: sortId, cur_page: page },
// module: 'playlist.PlayListPlazaServer',
// },
// }))}`
},
getListDetailUrl(id) {
return `https://c.y.qq.com/qzone/fcg-bin/fcg_ucc_getcdinfo_byids_cp.fcg?type=1&json=1&utf8=1&onlysong=0&new_format=1&disstid=${id}&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8&notice=0&platform=yqq.json&needNewCode=0`
@@ -112,41 +114,85 @@ export default {
}))
},
async getRecommendList(page) {
const { body } = await httpFetch(
`https://u.y.qq.com/cgi-bin/musicu.fcg?loginUin=0&hostUin=0&format=json&inCharset=utf-8&outCharset=utf-8&notice=0&platform=wk_v15.json&needNewCode=0&data=${encodeURIComponent(
JSON.stringify({
comm: { cv: 1602, ct: 20 },
playlist: {
module: 'music.playlist.PlaylistSquare',
method: 'GetRecommendWhole',
param: {
IsReqFeed: true,
FeedReq: {
From: (page - 1) * this.limit_list,
Size: this.limit_list,
},
},
},
}),
)}`,
).promise
if (body.code !== this.successCode) throw new Error('tx getRecommendList failed')
return {
list:
body.playlist.data.FeedRsp.List?.map(({ Playlist }) => ({
play_count: formatPlayCount(Playlist.basic.play_cnt),
id: String(Playlist.basic.tid),
author: decodeName(Playlist.basic.creator.nick),
name: decodeName(Playlist.basic.title),
time: Playlist.basic.modify_time ? dateFormat(Playlist.basic.modify_time * 1000, 'Y-M-D') : '',
img: Playlist.basic.cover.medium_url || Playlist.basic.cover.default_url,
total: Playlist.basic.song_cnt,
desc: decodeName(Playlist.basic.desc).replace(/<br>/g, '\n'),
source: 'tx',
})) || [],
total: body.playlist.data.FeedRsp.FromLimit,
limit: this.limit_list,
page,
source: 'tx',
}
},
// 获取列表数据
getList(sortId, tagId, page, tryNum = 0) {
if (this._requestObj_list) this._requestObj_list.cancelHttp()
if (tryNum > 2) return Promise.reject(new Error('try max num'))
if (!tagId) {
if (!tagId && sortId == -1) return this.getRecommendList(page)
tagId = sortId
}
this._requestObj_list = httpFetch(
this.getListUrl(sortId, tagId, page),
this.getListUrl(tagId, page),
)
// console.log(this.getListUrl(sortId, tagId, page))
return this._requestObj_list.promise.then(({ body }) => {
if (body.code !== this.successCode) return this.getList(sortId, tagId, page, ++tryNum)
return tagId ? this.filterList2(body.playlist.data, page) : this.filterList(body.playlist.data, page)
return this.filterList(body.playlist.data, page)
})
},
filterList(data, page) {
return {
list: data.v_playlist.map(item => ({
play_count: formatPlayCount(item.access_num),
id: String(item.tid),
author: item.creator_info.nick,
name: item.title,
time: item.modify_time ? dateFormat(item.modify_time * 1000, 'Y-M-D') : '',
img: item.cover_url_medium,
// grade: item.favorcnt / 10,
total: item.song_ids?.length,
desc: decodeName(item.desc).replace(/<br>/g, '\n'),
source: 'tx',
})),
total: data.total,
page,
limit: this.limit_list,
source: 'tx',
}
},
filterList2({ content }, page) {
// filterList(data, page) {
// return {
// list: data.v_playlist.map(item => ({
// play_count: formatPlayCount(item.access_num),
// id: String(item.tid),
// author: item.creator_info.nick,
// name: item.title,
// time: item.modify_time ? dateFormat(item.modify_time * 1000, 'Y-M-D') : '',
// img: item.cover_url_medium,
// // grade: item.favorcnt / 10,
// total: item.song_ids?.length,
// desc: decodeName(item.desc).replace(/<br>/g, '\n'),
// source: 'tx',
// })),
// total: data.total,
// page,
// limit: this.limit_list,
// source: 'tx',
// }
// },
filterList({ content }, page) {
// console.log(content.v_item)
return {
list: content.v_item.map(({ basic }) => ({