修复使用链接导入的歌单无法在我的列表打开原歌单详情页的问题
parent
65027fceba
commit
a363c5525b
|
@ -16,6 +16,7 @@
|
||||||
- 修复桌面歌词没有处理停止播放状态的问题
|
- 修复桌面歌词没有处理停止播放状态的问题
|
||||||
- 修复AppImage包无法运行的问题
|
- 修复AppImage包无法运行的问题
|
||||||
- 修复Windows任务栏缩略图工具栏控制按钮的歌曲收藏按钮状态更新问题
|
- 修复Windows任务栏缩略图工具栏控制按钮的歌曲收藏按钮状态更新问题
|
||||||
|
- 修复使用链接导入的歌单无法在我的列表打开原歌单详情页的问题
|
||||||
|
|
||||||
### 文档
|
### 文档
|
||||||
|
|
||||||
|
|
|
@ -720,7 +720,10 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
getDetailPageUrl(id) {
|
getDetailPageUrl(id) {
|
||||||
if (typeof id == 'string') id = id.replace('id_', '')
|
if (typeof id == 'string') {
|
||||||
|
if (/^https?:\/\//.test(id)) return id
|
||||||
|
id = id.replace('id_', '')
|
||||||
|
}
|
||||||
return `https://www.kugou.com/yy/special/single/${id}.html`
|
return `https://www.kugou.com/yy/special/single/${id}.html`
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,7 +308,8 @@ export default {
|
||||||
return Promise.all([this.getTag(), this.getHotTag()]).then(([tags, hotTag]) => ({ tags, hotTag, source: 'kw' }))
|
return Promise.all([this.getTag(), this.getHotTag()]).then(([tags, hotTag]) => ({ tags, hotTag, source: 'kw' }))
|
||||||
},
|
},
|
||||||
getDetailPageUrl(id) {
|
getDetailPageUrl(id) {
|
||||||
if (/^digest-/.test(id)) {
|
if ((/[?&:/]/.test(id))) id = id.replace(this.regExps.listDetailLink, '$1')
|
||||||
|
else if (/^digest-/.test(id)) {
|
||||||
let result = id.split('__')
|
let result = id.split('__')
|
||||||
id = result[1]
|
id = result[1]
|
||||||
}
|
}
|
||||||
|
|
|
@ -357,6 +357,11 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
getDetailPageUrl(id) {
|
getDetailPageUrl(id) {
|
||||||
|
if (/playlist\/index\.html\?/.test(id)) {
|
||||||
|
id = id.replace(/.*(?:\?|&)id=(\d+)(?:&.*|$)/, '$1')
|
||||||
|
} else if (this.regExps.listDetailLink.test(id)) {
|
||||||
|
id = id.replace(this.regExps.listDetailLink, '$1')
|
||||||
|
}
|
||||||
return `https://music.migu.cn/v3/music/playlist/${id}`
|
return `https://music.migu.cn/v3/music/playlist/${id}`
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,11 +185,7 @@ export default {
|
||||||
return location == null ? link : location
|
return location == null ? link : location
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取歌曲列表内的音乐
|
async getListId(id) {
|
||||||
async getListDetail(id, tryNum = 0) {
|
|
||||||
if (this._requestObj_listDetail) this._requestObj_listDetail.cancelHttp()
|
|
||||||
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
|
||||||
|
|
||||||
if ((/[?&:/]/.test(id))) {
|
if ((/[?&:/]/.test(id))) {
|
||||||
let regx = /\/\/i\.y\.qq\.com/.test(id) ? this.regExps.listDetailLink1 : this.regExps.listDetailLink2
|
let regx = /\/\/i\.y\.qq\.com/.test(id) ? this.regExps.listDetailLink1 : this.regExps.listDetailLink2
|
||||||
if (!regx.test(id)) {
|
if (!regx.test(id)) {
|
||||||
|
@ -200,6 +196,14 @@ export default {
|
||||||
id = id.replace(regx, '$1')
|
id = id.replace(regx, '$1')
|
||||||
// console.log(id)
|
// console.log(id)
|
||||||
}
|
}
|
||||||
|
return id
|
||||||
|
},
|
||||||
|
// 获取歌曲列表内的音乐
|
||||||
|
async getListDetail(id, tryNum = 0) {
|
||||||
|
if (this._requestObj_listDetail) this._requestObj_listDetail.cancelHttp()
|
||||||
|
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
||||||
|
|
||||||
|
id = await this.getListId(id)
|
||||||
|
|
||||||
this._requestObj_listDetail = httpFetch(this.getListDetailUrl(id), {
|
this._requestObj_listDetail = httpFetch(this.getListDetailUrl(id), {
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -293,7 +297,9 @@ export default {
|
||||||
return Promise.all([this.getTag(), this.getHotTag()]).then(([tags, hotTag]) => ({ tags, hotTag, source: 'tx' }))
|
return Promise.all([this.getTag(), this.getHotTag()]).then(([tags, hotTag]) => ({ tags, hotTag, source: 'tx' }))
|
||||||
},
|
},
|
||||||
|
|
||||||
getDetailPageUrl(id) {
|
async getDetailPageUrl(id) {
|
||||||
|
id = await this.getListId(id)
|
||||||
|
|
||||||
return `https://y.qq.com/n/ryqq/playlist/${id}`
|
return `https://y.qq.com/n/ryqq/playlist/${id}`
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,23 +51,24 @@ export default {
|
||||||
|
|
||||||
async handleParseId(link, retryNum = 0) {
|
async handleParseId(link, retryNum = 0) {
|
||||||
if (this._requestObj_listDetailLink) this._requestObj_listDetailLink.cancelHttp()
|
if (this._requestObj_listDetailLink) this._requestObj_listDetailLink.cancelHttp()
|
||||||
if (retryNum > 2) return Promise.reject(new Error('link try max num'))
|
if (retryNum > 2) throw new Error('link try max num')
|
||||||
|
|
||||||
this._requestObj_listDetailLink = httpFetch(link)
|
this._requestObj_listDetailLink = httpFetch(link)
|
||||||
const { headers: { location }, statusCode } = await this._requestObj_listDetailLink.promise
|
const { headers: { location }, statusCode } = await this._requestObj_listDetailLink.promise
|
||||||
// console.log(headers)
|
// console.log(headers)
|
||||||
if (statusCode > 400) return this.handleParseId(link, ++retryNum)
|
if (statusCode > 400) return this.handleParseId(link, ++retryNum)
|
||||||
return location == null ? link : location
|
const url = location == null ? link : location
|
||||||
|
return this.regExps.listDetailLink.test(url)
|
||||||
|
? url.replace(this.regExps.listDetailLink, '$1')
|
||||||
|
: url.replace(this.regExps.listDetailLink2, '$1')
|
||||||
},
|
},
|
||||||
|
|
||||||
async getListDetail(id, page, tryNum = 0) { // 获取歌曲列表内的音乐
|
async getListId(id) {
|
||||||
if (this._requestObj_listDetail) this._requestObj_listDetail.cancelHttp()
|
let cookie
|
||||||
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
|
||||||
|
|
||||||
if (/###/.test(id)) {
|
if (/###/.test(id)) {
|
||||||
const [url, token] = id.split('###')
|
const [url, token] = id.split('###')
|
||||||
id = url
|
id = url
|
||||||
this.cookie = `MUSIC_U=${token}`
|
cookie = `MUSIC_U=${token}`
|
||||||
}
|
}
|
||||||
if ((/[?&:/]/.test(id))) {
|
if ((/[?&:/]/.test(id))) {
|
||||||
if (this.regExps.listDetailLink.test(id)) {
|
if (this.regExps.listDetailLink.test(id)) {
|
||||||
|
@ -79,6 +80,14 @@ export default {
|
||||||
}
|
}
|
||||||
// console.log(id)
|
// console.log(id)
|
||||||
}
|
}
|
||||||
|
return { id, cookie }
|
||||||
|
},
|
||||||
|
async getListDetail(rawId, page, tryNum = 0) { // 获取歌曲列表内的音乐
|
||||||
|
if (this._requestObj_listDetail) this._requestObj_listDetail.cancelHttp()
|
||||||
|
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
||||||
|
|
||||||
|
const { id, cookie } = await this.getListId(rawId)
|
||||||
|
if (cookie) this.cookie = cookie
|
||||||
|
|
||||||
this._requestObj_listDetail = httpFetch('https://music.163.com/api/linux/forward', {
|
this._requestObj_listDetail = httpFetch('https://music.163.com/api/linux/forward', {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
@ -290,7 +299,8 @@ export default {
|
||||||
return Promise.all([this.getTag(), this.getHotTag()]).then(([tags, hotTag]) => ({ tags, hotTag, source: 'wy' }))
|
return Promise.all([this.getTag(), this.getHotTag()]).then(([tags, hotTag]) => ({ tags, hotTag, source: 'wy' }))
|
||||||
},
|
},
|
||||||
|
|
||||||
getDetailPageUrl(id) {
|
async getDetailPageUrl(rawId) {
|
||||||
|
const { id } = await this.getListId(rawId)
|
||||||
return `https://music.163.com/#/playlist?id=${id}`
|
return `https://music.163.com/#/playlist?id=${id}`
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -406,15 +406,15 @@ export default {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
openSourceDetailPage(index) {
|
async openSourceDetailPage(index) {
|
||||||
const { source, sourceListId } = this.userLists[index]
|
const { source, sourceListId } = this.userLists[index]
|
||||||
if (!sourceListId) return
|
if (!sourceListId) return
|
||||||
let url
|
let url
|
||||||
if (/board__/.test(sourceListId)) {
|
if (/board__/.test(sourceListId)) {
|
||||||
const id = sourceListId.replace(/board__/, '')
|
const id = sourceListId.replace(/board__/, '')
|
||||||
url = musicSdk[source].leaderboard.getDetailPageUrl(id)
|
url = musicSdk[source].leaderboard.getDetailPageUrl(id)
|
||||||
} else {
|
} else if (musicSdk[source].songList?.getDetailPageUrl) {
|
||||||
url = musicSdk[source].songList.getDetailPageUrl(sourceListId)
|
url = await musicSdk[source].songList.getDetailPageUrl(sourceListId)
|
||||||
}
|
}
|
||||||
if (!url) return
|
if (!url) return
|
||||||
openUrl(url)
|
openUrl(url)
|
||||||
|
|
Loading…
Reference in New Issue