mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-05-23 22:37:41 +08:00
优化mg源打开歌单的链接兼容
This commit is contained in:
parent
1d81bc9c33
commit
12f788cd5e
@ -1,12 +1,3 @@
|
||||
### 优化
|
||||
|
||||
- 添加切换播放模式时的文字提示
|
||||
- 优化单首歌曲的添加弹窗操作,当选择当前歌曲已存在目标列表时(列表名灰色显示),会将当前歌曲从目标列表移除,否则将当前歌曲添加到目标列表,添加在弹窗内对歌曲的添加、移动、删除操作时的文字提示
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复mg源搜索失效的问题
|
||||
|
||||
### 移除
|
||||
|
||||
- 因wy源的歌单列表已没有“最新”排序的选项,所以现跟随移除wy源歌单列表按“最新”排序的按钮
|
||||
- 优化mg源打开歌单的链接兼容
|
||||
|
@ -7,11 +7,13 @@ export default {
|
||||
_requestObj_tags: null,
|
||||
_requestObj_list: null,
|
||||
_requestObj_listDetail: null,
|
||||
_requestObj_listDetailLink: null,
|
||||
_requestObj_listDetailInfo: null,
|
||||
limit_list: 10,
|
||||
limit_song: 10000,
|
||||
limit_song: 30,
|
||||
successCode: '000000',
|
||||
cachedDetailInfo: {},
|
||||
cachedUrl: {},
|
||||
sortList: [
|
||||
{
|
||||
name: '推荐',
|
||||
@ -119,11 +121,38 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
async getDetailUrl(link, page, retryNum = 0) {
|
||||
if (retryNum > 3) return Promise.reject(new Error('link try max num'))
|
||||
|
||||
if (this._requestObj_listDetailLink) this._requestObj_listDetailLink.cancelHttp()
|
||||
|
||||
this._requestObj_listDetailLink = httpFetch(link, {
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
|
||||
Referer: link,
|
||||
},
|
||||
})
|
||||
const { url: location, statusCode } = await this._requestObj_listDetailLink.promise
|
||||
// console.log(body, location)
|
||||
if (statusCode > 400) return this.getDetailUrl(link, page, ++retryNum)
|
||||
if (location) {
|
||||
this.cachedUrl[link] = location
|
||||
return this.getListDetail(location, page)
|
||||
}
|
||||
return Promise.reject(new Error('link get failed'))
|
||||
},
|
||||
|
||||
getListDetail(id, page) { // 获取歌曲列表内的音乐
|
||||
// https://h5.nf.migu.cn/app/v4/p/share/playlist/index.html?id=184187437&channel=0146921
|
||||
// http://c.migu.cn/00bTY6?ifrom=babddaadfde4ebeda289d671ab62f236
|
||||
if (/playlist\/index\.html\?/.test(id)) {
|
||||
id = id.replace(/.*(?:\?|&)id=(\d+)(?:&.*|$)/, '$1')
|
||||
} else if ((/[?&:/]/.test(id))) id = id.replace(this.regExps.listDetailLink, '$1')
|
||||
} else if (this.regExps.listDetailLink.test(id)) {
|
||||
id = id.replace(this.regExps.listDetailLink, '$1')
|
||||
} else if ((/[?&:/]/.test(id))) {
|
||||
const url = this.cachedUrl[id]
|
||||
return url ? this.getListDetail(url, page) : this.getDetailUrl(id, page)
|
||||
}
|
||||
|
||||
return Promise.all([
|
||||
this.getListDetailList(id, page),
|
||||
|
Loading…
x
Reference in New Issue
Block a user