优化wy源歌单导入匹配

pull/590/head
lyswhut 2021-06-03 14:50:37 +08:00
parent 1648b0c2dd
commit b53fe2dd5e
2 changed files with 10 additions and 4 deletions

View File

@ -1,3 +1,3 @@
### 修复
### 优化
- 修复企鹅音乐搜索歌曲没有结果的问题
- 优化wy源歌单导入匹配

View File

@ -29,6 +29,7 @@ export default {
],
regExps: {
listDetailLink: /^.+(?:\?|&)id=(\d+)(?:&.*$|#.*$|$)/,
listDetailLink2: /^.+\/playlist\/(\d+)\/\d+\/.+$/,
},
/**
* 格式化播放数量
@ -63,9 +64,14 @@ export default {
if (tryNum > 2) return Promise.reject(new Error('try max num'))
if ((/[?&:/]/.test(id))) {
if (!this.regExps.listDetailLink.test(id)) id = await this.handleParseId(id)
if (this.regExps.listDetailLink.test(id)) {
id = id.replace(this.regExps.listDetailLink, '$1')
} else if (this.regExps.listDetailLink2.test(id)) {
id = id.replace(this.regExps.listDetailLink2, '$1')
} else {
id = await this.handleParseId(id)
}
// console.log(id)
id = id.replace(this.regExps.listDetailLink, '$1')
}
this._requestObj_listDetail = httpFetch('https://music.163.com/api/linux/forward', {