修复潜在歌单更新失败的问题
parent
74afdb2a46
commit
0fe443c92a
|
@ -1,6 +1,6 @@
|
||||||
### 新增
|
### 新增
|
||||||
|
|
||||||
- 新增设置-播放设置-显示歌词罗马音,默认关闭,注:目前只有网易源能获取到罗马音歌词,如果你知道其他源的歌词罗马音获取方式,欢迎PR!
|
- 新增设置-播放设置-显示歌词罗马音,默认关闭,注:目前只有网易源能获取到罗马音歌词(得益于 Binaryify/NeteaseCloudMusicApi/pull/1523),如果你知道其他源的歌词罗马音获取方式,欢迎PR或开issue交流!
|
||||||
|
|
||||||
### 优化
|
### 优化
|
||||||
|
|
||||||
|
@ -13,3 +13,4 @@
|
||||||
- 修复关闭“显示切换动画”设置后,在应用启动时该设置没有被应用的问题
|
- 修复关闭“显示切换动画”设置后,在应用启动时该设置没有被应用的问题
|
||||||
- 修复原始歌词存在偏移时,歌词偏移设置的重置未按预期工作的问题
|
- 修复原始歌词存在偏移时,歌词偏移设置的重置未按预期工作的问题
|
||||||
- 修复长度大于一行的歌词在使用歌词调整播放进度时的时间不准问题
|
- 修复长度大于一行的歌词在使用歌词调整播放进度时的时间不准问题
|
||||||
|
- 修复潜在歌单更新失败的问题
|
||||||
|
|
|
@ -151,6 +151,7 @@ const mutations = {
|
||||||
state.text = text
|
state.text = text
|
||||||
},
|
},
|
||||||
setList(state, datas) {
|
setList(state, datas) {
|
||||||
|
if (!state.text) return
|
||||||
let source = state.sourceList[datas.source]
|
let source = state.sourceList[datas.source]
|
||||||
datas.list = deduplicationList(datas.list)
|
datas.list = deduplicationList(datas.list)
|
||||||
source.list = markRawList(datas.list)
|
source.list = markRawList(datas.list)
|
||||||
|
@ -160,6 +161,7 @@ const mutations = {
|
||||||
source.limit = datas.limit
|
source.limit = datas.limit
|
||||||
},
|
},
|
||||||
setLists(state, { results, page }) {
|
setLists(state, { results, page }) {
|
||||||
|
if (!state.text) return
|
||||||
let pages = []
|
let pages = []
|
||||||
let total = 0
|
let total = 0
|
||||||
let limit = 0
|
let limit = 0
|
||||||
|
|
|
@ -65,6 +65,8 @@ const getters = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let loadId = null
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
const actions = {
|
const actions = {
|
||||||
getTags({ state, rootState, commit }) {
|
getTags({ state, rootState, commit }) {
|
||||||
|
@ -76,11 +78,14 @@ const actions = {
|
||||||
let tabId = rootState.setting.songList.tagInfo.id
|
let tabId = rootState.setting.songList.tagInfo.id
|
||||||
let sortId = rootState.setting.songList.sortId
|
let sortId = rootState.setting.songList.sortId
|
||||||
// console.log(sortId)
|
// console.log(sortId)
|
||||||
let key = `slist__${source}__${sortId}__${tabId}__${page}`
|
let key = loadId = `slist__${source}__${sortId}__${tabId}__${page}`
|
||||||
if (state.list.list.length && state.list.key == key) return
|
if (state.list.list.length && state.list.key == key) return
|
||||||
if (cache.has(key)) return Promise.resolve(cache.get(key)).then(result => commit('setList', { result, key, page }))
|
if (cache.has(key)) return Promise.resolve(cache.get(key)).then(result => commit('setList', { result, key, page }))
|
||||||
commit('clearList')
|
commit('clearList')
|
||||||
return music[source]?.songList.getList(sortId, tabId, page).then(result => commit('setList', { result, key, page }))
|
return music[source]?.songList.getList(sortId, tabId, page).then(result => {
|
||||||
|
if (loadId != key) return
|
||||||
|
commit('setList', { result, key, page })
|
||||||
|
})
|
||||||
},
|
},
|
||||||
getListDetail({ state, commit }, { id, source, page, isRefresh = false }) {
|
getListDetail({ state, commit }, { id, source, page, isRefresh = false }) {
|
||||||
let key = `sdetail__${source}__${id}__${page}`
|
let key = `sdetail__${source}__${id}__${page}`
|
||||||
|
|
|
@ -79,11 +79,9 @@ export default {
|
||||||
item: /data-song="({.+?})"/g,
|
item: /data-song="({.+?})"/g,
|
||||||
info: /{total[\s:]+"(\d+)", size[\s:]+"(\d+)", page[\s:]+"(\d+)"}/,
|
info: /{total[\s:]+"(\d+)", size[\s:]+"(\d+)", page[\s:]+"(\d+)"}/,
|
||||||
},
|
},
|
||||||
requestObj: null,
|
|
||||||
getData(url) {
|
getData(url) {
|
||||||
if (this.requestObj) this.requestObj.cancelHttp()
|
const requestObj = httpFetch(url)
|
||||||
this.requestObj = httpFetch(url)
|
return requestObj.promise
|
||||||
return this.requestObj.promise
|
|
||||||
},
|
},
|
||||||
filterData(rawList) {
|
filterData(rawList) {
|
||||||
// console.log(rawList)
|
// console.log(rawList)
|
||||||
|
|
|
@ -5,15 +5,13 @@ import { formatPlayTime } from '../../index'
|
||||||
// import { debug } from '../../utils/env'
|
// import { debug } from '../../utils/env'
|
||||||
// import { formatSinger } from './util'
|
// import { formatSinger } from './util'
|
||||||
|
|
||||||
let searchRequest
|
|
||||||
export default {
|
export default {
|
||||||
limit: 30,
|
limit: 30,
|
||||||
total: 0,
|
total: 0,
|
||||||
page: 0,
|
page: 0,
|
||||||
allPage: 1,
|
allPage: 1,
|
||||||
musicSearch(str, page, limit) {
|
musicSearch(str, page, limit) {
|
||||||
if (searchRequest && searchRequest.cancelHttp) searchRequest.cancelHttp()
|
const searchRequest = httpFetch(`http://tingapi.ting.baidu.com/v1/restserver/ting?from=android&version=5.6.5.6&method=baidu.ting.search.merge&format=json&query=${encodeURIComponent(str)}&page_no=${page}&page_size=${limit}&type=0&data_source=0&use_cluster=1`)
|
||||||
searchRequest = httpFetch(`http://tingapi.ting.baidu.com/v1/restserver/ting?from=android&version=5.6.5.6&method=baidu.ting.search.merge&format=json&query=${encodeURIComponent(str)}&page_no=${page}&page_size=${limit}&type=0&data_source=0&use_cluster=1`)
|
|
||||||
return searchRequest.promise.then(({ body }) => body)
|
return searchRequest.promise.then(({ body }) => body)
|
||||||
},
|
},
|
||||||
handleResult(rawData) {
|
handleResult(rawData) {
|
||||||
|
|
|
@ -6,7 +6,6 @@ export default {
|
||||||
_requestObj_tags: null,
|
_requestObj_tags: null,
|
||||||
_requestObj_list: null,
|
_requestObj_list: null,
|
||||||
_requestObj_listRecommend: null,
|
_requestObj_listRecommend: null,
|
||||||
_requestObj_listDetail: null,
|
|
||||||
limit_list: 30,
|
limit_list: 30,
|
||||||
limit_song: 10000,
|
limit_song: 10000,
|
||||||
successCode: 22000,
|
successCode: 22000,
|
||||||
|
@ -188,13 +187,12 @@ export default {
|
||||||
|
|
||||||
// 获取歌曲列表内的音乐
|
// 获取歌曲列表内的音乐
|
||||||
getListDetail(id, page, tryNum = 0) {
|
getListDetail(id, page, tryNum = 0) {
|
||||||
if (this._requestObj_listDetail) this._requestObj_listDetail.cancelHttp()
|
|
||||||
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
||||||
|
|
||||||
if ((/[?&:/]/.test(id))) id = id.replace(this.regExps.listDetailLink, '$1')
|
if ((/[?&:/]/.test(id))) id = id.replace(this.regExps.listDetailLink, '$1')
|
||||||
|
|
||||||
this._requestObj_listDetail = httpFetch(this.getListDetailUrl(id, page))
|
const requestObj_listDetail = httpFetch(this.getListDetailUrl(id, page))
|
||||||
return this._requestObj_listDetail.promise.then(({ body }) => {
|
return requestObj_listDetail.promise.then(({ body }) => {
|
||||||
if (body.error_code !== this.successCode) return this.getListDetail(id, page, ++tryNum)
|
if (body.error_code !== this.successCode) return this.getListDetail(id, page, ++tryNum)
|
||||||
let listData = this.filterData(body.result.songlist)
|
let listData = this.filterData(body.result.songlist)
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -71,16 +71,14 @@ export default {
|
||||||
listData: /global\.features = (\[.+\]);/,
|
listData: /global\.features = (\[.+\]);/,
|
||||||
},
|
},
|
||||||
_requestBoardsObj: null,
|
_requestBoardsObj: null,
|
||||||
_requestDataObj: null,
|
|
||||||
getBoardsData() {
|
getBoardsData() {
|
||||||
if (this._requestBoardsObj) this._requestBoardsObj.cancelHttp()
|
if (this._requestBoardsObj) this._requestBoardsObj.cancelHttp()
|
||||||
this._requestBoardsObj = httpFetch('http://mobilecdnbj.kugou.com/api/v3/rank/list?version=9108&plat=0&showtype=2&parentid=0&apiver=6&area_code=1&withsong=1')
|
this._requestBoardsObj = httpFetch('http://mobilecdnbj.kugou.com/api/v3/rank/list?version=9108&plat=0&showtype=2&parentid=0&apiver=6&area_code=1&withsong=1')
|
||||||
return this._requestBoardsObj.promise
|
return this._requestBoardsObj.promise
|
||||||
},
|
},
|
||||||
getData(url) {
|
getData(url) {
|
||||||
if (this._requestDataObj) this._requestDataObj.cancelHttp()
|
const requestDataObj = httpFetch(url)
|
||||||
this._requestDataObj = httpFetch(url)
|
return requestDataObj.promise
|
||||||
return this._requestDataObj.promise
|
|
||||||
},
|
},
|
||||||
filterData(rawList) {
|
filterData(rawList) {
|
||||||
// console.log(rawList)
|
// console.log(rawList)
|
||||||
|
|
|
@ -5,15 +5,13 @@ import { decodeName, formatPlayTime, sizeFormate } from '../../index'
|
||||||
// import { debug } from '../../utils/env'
|
// import { debug } from '../../utils/env'
|
||||||
// import { formatSinger } from './util'
|
// import { formatSinger } from './util'
|
||||||
|
|
||||||
let searchRequest
|
|
||||||
export default {
|
export default {
|
||||||
limit: 30,
|
limit: 30,
|
||||||
total: 0,
|
total: 0,
|
||||||
page: 0,
|
page: 0,
|
||||||
allPage: 1,
|
allPage: 1,
|
||||||
musicSearch(str, page, limit) {
|
musicSearch(str, page, limit) {
|
||||||
if (searchRequest && searchRequest.cancelHttp) searchRequest.cancelHttp()
|
const searchRequest = httpFetch(`http://ioscdn.kugou.com/api/v3/search/song?keyword=${encodeURIComponent(str)}&page=${page}&pagesize=${limit}&showtype=10&plat=2&version=7910&tag=1&correct=1&privilege=1&sver=5`)
|
||||||
searchRequest = httpFetch(`http://ioscdn.kugou.com/api/v3/search/song?keyword=${encodeURIComponent(str)}&page=${page}&pagesize=${limit}&showtype=10&plat=2&version=7910&tag=1&correct=1&privilege=1&sver=5`)
|
|
||||||
return searchRequest.promise.then(({ body }) => body)
|
return searchRequest.promise.then(({ body }) => body)
|
||||||
},
|
},
|
||||||
filterData(rawData) {
|
filterData(rawData) {
|
||||||
|
|
|
@ -18,7 +18,6 @@ export default {
|
||||||
_requestObj_listInfo: null,
|
_requestObj_listInfo: null,
|
||||||
_requestObj_list: null,
|
_requestObj_list: null,
|
||||||
_requestObj_listRecommend: null,
|
_requestObj_listRecommend: null,
|
||||||
_requestObj_listDetail: null,
|
|
||||||
listDetailLimit: 10000,
|
listDetailLimit: 10000,
|
||||||
currentTagInfo: {
|
currentTagInfo: {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
|
@ -477,15 +476,14 @@ export default {
|
||||||
}
|
}
|
||||||
} else if (!link.includes('song.html')) return this.getUserListDetail3(link.replace(/.+\/(\w+).html(?:\?.*|&.*$|#.*$|$)/, '$1'), page)
|
} else if (!link.includes('song.html')) return this.getUserListDetail3(link.replace(/.+\/(\w+).html(?:\?.*|&.*$|#.*$|$)/, '$1'), page)
|
||||||
}
|
}
|
||||||
if (this._requestObj_listDetailLink) this._requestObj_listDetailLink.cancelHttp()
|
|
||||||
|
|
||||||
this._requestObj_listDetailLink = httpFetch(link, {
|
const requestObj_listDetailLink = httpFetch(link, {
|
||||||
headers: {
|
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',
|
'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,
|
Referer: link,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
const { headers: { location }, statusCode, body } = await this._requestObj_listDetailLink.promise
|
const { headers: { location }, statusCode, body } = await requestObj_listDetailLink.promise
|
||||||
// console.log(body, location)
|
// console.log(body, location)
|
||||||
if (statusCode > 400) return this.getUserListDetail(link, page, ++retryNum)
|
if (statusCode > 400) return this.getUserListDetail(link, page, ++retryNum)
|
||||||
if (location) {
|
if (location) {
|
||||||
|
@ -512,7 +510,6 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
getListDetail(id, page, tryNum = 0) { // 获取歌曲列表内的音乐
|
getListDetail(id, page, tryNum = 0) { // 获取歌曲列表内的音乐
|
||||||
if (this._requestObj_listDetail) this._requestObj_listDetail.cancelHttp()
|
|
||||||
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
||||||
|
|
||||||
id = id.toString()
|
id = id.toString()
|
||||||
|
@ -528,8 +525,8 @@ export default {
|
||||||
|
|
||||||
// if ((/[?&:/]/.test(id))) id = id.replace(this.regExps.listDetailLink, '$1')
|
// if ((/[?&:/]/.test(id))) id = id.replace(this.regExps.listDetailLink, '$1')
|
||||||
|
|
||||||
this._requestObj_listDetail = httpFetch(this.getSongListDetailUrl(id))
|
const requestObj_listDetail = httpFetch(this.getSongListDetailUrl(id))
|
||||||
return this._requestObj_listDetail.promise.then(({ body }) => {
|
return requestObj_listDetail.promise.then(({ body }) => {
|
||||||
let listData = body.match(this.regExps.listData)
|
let listData = body.match(this.regExps.listData)
|
||||||
let listInfo = body.match(this.regExps.listInfo)
|
let listInfo = body.match(this.regExps.listInfo)
|
||||||
if (!listData) return this.getListDetail(id, page, ++tryNum)
|
if (!listData) return this.getListDetail(id, page, ++tryNum)
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { decodeName } from '../../index'
|
||||||
import { formatSinger, objStr2JSON } from './util'
|
import { formatSinger, objStr2JSON } from './util'
|
||||||
|
|
||||||
// let requestObj_list
|
// let requestObj_list
|
||||||
let requestObj_listDetail
|
|
||||||
export default {
|
export default {
|
||||||
limit_list: 36,
|
limit_list: 36,
|
||||||
limit_song: 1000,
|
limit_song: 1000,
|
||||||
|
@ -72,11 +71,8 @@ export default {
|
||||||
return num
|
return num
|
||||||
},
|
},
|
||||||
getAlbumListDetail(id, page, retryNum = 0) {
|
getAlbumListDetail(id, page, retryNum = 0) {
|
||||||
if (requestObj_listDetail) {
|
|
||||||
requestObj_listDetail.cancelHttp()
|
|
||||||
}
|
|
||||||
if (retryNum > 2) return Promise.reject(new Error('try max num'))
|
if (retryNum > 2) return Promise.reject(new Error('try max num'))
|
||||||
requestObj_listDetail = httpFetch(`http://search.kuwo.cn/r.s?pn=${page - 1}&rn=${this.limit_song}&stype=albuminfo&albumid=${id}&show_copyright_off=0&encoding=utf&vipver=MUSIC_9.1.0`)
|
const requestObj_listDetail = httpFetch(`http://search.kuwo.cn/r.s?pn=${page - 1}&rn=${this.limit_song}&stype=albuminfo&albumid=${id}&show_copyright_off=0&encoding=utf&vipver=MUSIC_9.1.0`)
|
||||||
return requestObj_listDetail.promise.then(({ statusCode, body }) => {
|
return requestObj_listDetail.promise.then(({ statusCode, body }) => {
|
||||||
if (statusCode !== 200) return this.getAlbumListDetail(id, page, ++retryNum)
|
if (statusCode !== 200) return this.getAlbumListDetail(id, page, ++retryNum)
|
||||||
body = objStr2JSON(body)
|
body = objStr2JSON(body)
|
||||||
|
|
|
@ -69,16 +69,14 @@ export default {
|
||||||
limit: 100,
|
limit: 100,
|
||||||
_requestBoardsObj: null,
|
_requestBoardsObj: null,
|
||||||
|
|
||||||
_requestDataObj: null,
|
|
||||||
getBoardsData() {
|
getBoardsData() {
|
||||||
if (this._requestBoardsObj) this._requestBoardsObj.cancelHttp()
|
if (this._requestBoardsObj) this._requestBoardsObj.cancelHttp()
|
||||||
this._requestBoardsObj = httpFetch('http://qukudata.kuwo.cn/q.k?op=query&cont=tree&node=2&pn=0&rn=1000&fmt=json&level=2')
|
this._requestBoardsObj = httpFetch('http://qukudata.kuwo.cn/q.k?op=query&cont=tree&node=2&pn=0&rn=1000&fmt=json&level=2')
|
||||||
return this._requestBoardsObj.promise
|
return this._requestBoardsObj.promise
|
||||||
},
|
},
|
||||||
getData(url) {
|
getData(url) {
|
||||||
if (this._requestDataObj) this._requestDataObj.cancelHttp()
|
const requestDataObj = httpFetch(url)
|
||||||
this._requestDataObj = httpFetch(url)
|
return requestDataObj.promise
|
||||||
return this._requestDataObj.promise
|
|
||||||
},
|
},
|
||||||
filterData(rawList) {
|
filterData(rawList) {
|
||||||
// console.log(rawList)
|
// console.log(rawList)
|
||||||
|
|
|
@ -9,16 +9,14 @@ export default {
|
||||||
regExps: {
|
regExps: {
|
||||||
mInfo: /bitrate:(\d+),format:(\w+),size:([\w.]+)/,
|
mInfo: /bitrate:(\d+),format:(\w+),size:([\w.]+)/,
|
||||||
},
|
},
|
||||||
_musicSearchRequestObj: null,
|
|
||||||
limit: 30,
|
limit: 30,
|
||||||
total: 0,
|
total: 0,
|
||||||
page: 0,
|
page: 0,
|
||||||
allPage: 1,
|
allPage: 1,
|
||||||
// cancelFn: null,
|
// cancelFn: null,
|
||||||
musicSearch(str, page, limit) {
|
musicSearch(str, page, limit) {
|
||||||
if (this._musicSearchRequestObj) this._musicSearchRequestObj.cancelHttp()
|
const musicSearchRequestObj = httpFetch(`http://search.kuwo.cn/r.s?client=kt&all=${encodeURIComponent(str)}&pn=${page - 1}&rn=${limit}&uid=794762570&ver=kwplayer_ar_9.2.2.1&vipver=1&show_copyright_off=1&newver=1&ft=music&cluster=0&strategy=2012&encoding=utf8&rformat=json&vermerge=1&mobi=1&issubtitle=1`)
|
||||||
this._musicSearchRequestObj = httpFetch(`http://search.kuwo.cn/r.s?client=kt&all=${encodeURIComponent(str)}&pn=${page - 1}&rn=${limit}&uid=794762570&ver=kwplayer_ar_9.2.2.1&vipver=1&show_copyright_off=1&newver=1&ft=music&cluster=0&strategy=2012&encoding=utf8&rformat=json&vermerge=1&mobi=1&issubtitle=1`)
|
return musicSearchRequestObj.promise
|
||||||
return this._musicSearchRequestObj.promise
|
|
||||||
},
|
},
|
||||||
// getImg(songId) {
|
// getImg(songId) {
|
||||||
// return httpGet(`http://player.kuwo.cn/webmusic/sj/dtflagdate?flag=6&rid=MUSIC_${songId}`)
|
// return httpGet(`http://player.kuwo.cn/webmusic/sj/dtflagdate?flag=6&rid=MUSIC_${songId}`)
|
||||||
|
|
|
@ -7,7 +7,6 @@ export default {
|
||||||
_requestObj_tags: null,
|
_requestObj_tags: null,
|
||||||
_requestObj_hotTags: null,
|
_requestObj_hotTags: null,
|
||||||
_requestObj_list: null,
|
_requestObj_list: null,
|
||||||
_requestObj_listDetail: null,
|
|
||||||
limit_list: 36,
|
limit_list: 36,
|
||||||
limit_song: 10000,
|
limit_song: 10000,
|
||||||
successCode: 200,
|
successCode: 200,
|
||||||
|
@ -165,13 +164,10 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
getListDetailDigest8(id, page, tryNum = 0) {
|
getListDetailDigest8(id, page, tryNum = 0) {
|
||||||
if (this._requestObj_listDetail) {
|
|
||||||
this._requestObj_listDetail.cancelHttp()
|
|
||||||
}
|
|
||||||
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
||||||
|
|
||||||
this._requestObj_listDetail = httpFetch(this.getListDetailUrl(id, page))
|
const requestObj = httpFetch(this.getListDetailUrl(id, page))
|
||||||
return this._requestObj_listDetail.promise.then(({ body }) => {
|
return requestObj.promise.then(({ body }) => {
|
||||||
if (body.result !== 'ok') return this.getListDetail(id, page, ++tryNum)
|
if (body.result !== 'ok') return this.getListDetail(id, page, ++tryNum)
|
||||||
return {
|
return {
|
||||||
list: this.filterListDetail(body.musiclist),
|
list: this.filterListDetail(body.musiclist),
|
||||||
|
@ -190,24 +186,18 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getListDetailDigest5Info(id, tryNum = 0) {
|
getListDetailDigest5Info(id, tryNum = 0) {
|
||||||
if (this._requestObj_listDetail) {
|
|
||||||
this._requestObj_listDetail.cancelHttp()
|
|
||||||
}
|
|
||||||
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
||||||
this._requestObj_listDetail = httpFetch(`http://qukudata.kuwo.cn/q.k?op=query&cont=ninfo&node=${id}&pn=0&rn=1&fmt=json&src=mbox&level=2`)
|
const requestObj = httpFetch(`http://qukudata.kuwo.cn/q.k?op=query&cont=ninfo&node=${id}&pn=0&rn=1&fmt=json&src=mbox&level=2`)
|
||||||
return this._requestObj_listDetail.promise.then(({ statusCode, body }) => {
|
return requestObj.promise.then(({ statusCode, body }) => {
|
||||||
if (statusCode != 200 || !body.child) return this.getListDetail(id, ++tryNum)
|
if (statusCode != 200 || !body.child) return this.getListDetail(id, ++tryNum)
|
||||||
// console.log(body)
|
// console.log(body)
|
||||||
return body.child.length ? body.child[0].sourceid : null
|
return body.child.length ? body.child[0].sourceid : null
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getListDetailDigest5Music(id, page, tryNum = 0) {
|
getListDetailDigest5Music(id, page, tryNum = 0) {
|
||||||
if (this._requestObj_listDetail) {
|
|
||||||
this._requestObj_listDetail.cancelHttp()
|
|
||||||
}
|
|
||||||
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
||||||
this._requestObj_listDetail = httpFetch(`http://nplserver.kuwo.cn/pl.svc?op=getlistinfo&pid=${id}&pn=${page - 1}}&rn=${this.limit_song}&encode=utf-8&keyset=pl2012&identity=kuwo&pcmp4=1`)
|
const requestObj = httpFetch(`http://nplserver.kuwo.cn/pl.svc?op=getlistinfo&pid=${id}&pn=${page - 1}}&rn=${this.limit_song}&encode=utf-8&keyset=pl2012&identity=kuwo&pcmp4=1`)
|
||||||
return this._requestObj_listDetail.promise.then(({ body }) => {
|
return requestObj.promise.then(({ body }) => {
|
||||||
// console.log(body)
|
// console.log(body)
|
||||||
if (body.result !== 'ok') return this.getListDetail(id, page, ++tryNum)
|
if (body.result !== 'ok') return this.getListDetail(id, page, ++tryNum)
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -65,7 +65,6 @@ export default {
|
||||||
},
|
},
|
||||||
successCode: '000000',
|
successCode: '000000',
|
||||||
requestBoardsObj: null,
|
requestBoardsObj: null,
|
||||||
requestObj: null,
|
|
||||||
getBoardsData() {
|
getBoardsData() {
|
||||||
if (this.requestBoardsObj) this._requestBoardsObj.cancelHttp()
|
if (this.requestBoardsObj) this._requestBoardsObj.cancelHttp()
|
||||||
this.requestBoardsObj = httpFetch('https://app.c.nf.migu.cn/MIGUM3.0/v1.0/template/rank-list/release', {
|
this.requestBoardsObj = httpFetch('https://app.c.nf.migu.cn/MIGUM3.0/v1.0/template/rank-list/release', {
|
||||||
|
@ -79,9 +78,8 @@ export default {
|
||||||
return this.requestBoardsObj.promise
|
return this.requestBoardsObj.promise
|
||||||
},
|
},
|
||||||
getData(url) {
|
getData(url) {
|
||||||
if (this.requestObj) this.requestObj.cancelHttp()
|
const requestObj = httpFetch(url)
|
||||||
this.requestObj = httpFetch(url)
|
return requestObj.promise
|
||||||
return this.requestObj.promise
|
|
||||||
},
|
},
|
||||||
getSinger(singers) {
|
getSinger(singers) {
|
||||||
let arr = []
|
let arr = []
|
||||||
|
|
|
@ -57,14 +57,12 @@ export default {
|
||||||
},
|
},
|
||||||
successCode: '000000',
|
successCode: '000000',
|
||||||
requestBoardsObj: null,
|
requestBoardsObj: null,
|
||||||
requestObj: null,
|
|
||||||
regExps: {
|
regExps: {
|
||||||
listData: /var listData = (\{.+\})<\/script>/,
|
listData: /var listData = (\{.+\})<\/script>/,
|
||||||
},
|
},
|
||||||
getData(url) {
|
getData(url) {
|
||||||
if (this.requestObj) this.requestObj.cancelHttp()
|
const requestObj = httpFetch(url)
|
||||||
this.requestObj = httpFetch(url)
|
return requestObj.promise
|
||||||
return this.requestObj.promise
|
|
||||||
},
|
},
|
||||||
getSinger(singers) {
|
getSinger(singers) {
|
||||||
let arr = []
|
let arr = []
|
||||||
|
|
|
@ -5,15 +5,13 @@ import { sizeFormate } from '../../index'
|
||||||
// import { debug } from '../../utils/env'
|
// import { debug } from '../../utils/env'
|
||||||
// import { formatSinger } from './util'
|
// import { formatSinger } from './util'
|
||||||
|
|
||||||
let searchRequest
|
|
||||||
export default {
|
export default {
|
||||||
limit: 20,
|
limit: 20,
|
||||||
total: 0,
|
total: 0,
|
||||||
page: 0,
|
page: 0,
|
||||||
allPage: 1,
|
allPage: 1,
|
||||||
musicSearch(str, page, limit) {
|
musicSearch(str, page, limit) {
|
||||||
if (searchRequest && searchRequest.cancelHttp) searchRequest.cancelHttp()
|
const searchRequest = httpFetch(`http://pd.musicapp.migu.cn/MIGUM2.0/v1.0/content/search_all.do?ua=Android_migu&version=5.0.1&text=${encodeURIComponent(str)}&pageNo=${page}&pageSize=${limit}&searchSwitch=%7B%22song%22%3A1%2C%22album%22%3A0%2C%22singer%22%3A0%2C%22tagSong%22%3A0%2C%22mvSong%22%3A0%2C%22songlist%22%3A0%2C%22bestShow%22%3A1%7D`, {
|
||||||
searchRequest = httpFetch(`http://pd.musicapp.migu.cn/MIGUM2.0/v1.0/content/search_all.do?ua=Android_migu&version=5.0.1&text=${encodeURIComponent(str)}&pageNo=${page}&pageSize=${limit}&searchSwitch=%7B%22song%22%3A1%2C%22album%22%3A0%2C%22singer%22%3A0%2C%22tagSong%22%3A0%2C%22mvSong%22%3A0%2C%22songlist%22%3A0%2C%22bestShow%22%3A1%7D`, {
|
|
||||||
// searchRequest = httpFetch(`http://jadeite.migu.cn:7090/music_search/v2/search/searchAll?sid=4f87090d01c84984a11976b828e2b02c18946be88a6b4c47bcdc92fbd40762db&isCorrect=1&isCopyright=1&searchSwitch=%7B%22song%22%3A1%2C%22album%22%3A0%2C%22singer%22%3A0%2C%22tagSong%22%3A1%2C%22mvSong%22%3A0%2C%22bestShow%22%3A1%2C%22songlist%22%3A0%2C%22lyricSong%22%3A0%7D&pageSize=${limit}&text=${encodeURIComponent(str)}&pageNo=${page}&sort=0`, {
|
// searchRequest = httpFetch(`http://jadeite.migu.cn:7090/music_search/v2/search/searchAll?sid=4f87090d01c84984a11976b828e2b02c18946be88a6b4c47bcdc92fbd40762db&isCorrect=1&isCopyright=1&searchSwitch=%7B%22song%22%3A1%2C%22album%22%3A0%2C%22singer%22%3A0%2C%22tagSong%22%3A1%2C%22mvSong%22%3A0%2C%22bestShow%22%3A1%2C%22songlist%22%3A0%2C%22lyricSong%22%3A0%7D&pageSize=${limit}&text=${encodeURIComponent(str)}&pageNo=${page}&sort=0`, {
|
||||||
headers: {
|
headers: {
|
||||||
// sign: 'c3b7ae985e2206e97f1b2de8f88691e2',
|
// sign: 'c3b7ae985e2206e97f1b2de8f88691e2',
|
||||||
|
|
|
@ -6,9 +6,6 @@ import { sizeFormate } from '../../index'
|
||||||
export default {
|
export default {
|
||||||
_requestObj_tags: null,
|
_requestObj_tags: null,
|
||||||
_requestObj_list: null,
|
_requestObj_list: null,
|
||||||
_requestObj_listDetail: null,
|
|
||||||
_requestObj_listDetailLink: null,
|
|
||||||
_requestObj_listDetailInfo: null,
|
|
||||||
limit_list: 10,
|
limit_list: 10,
|
||||||
limit_song: 50,
|
limit_song: 50,
|
||||||
successCode: '000000',
|
successCode: '000000',
|
||||||
|
@ -74,7 +71,6 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
getListDetailList(id, page, tryNum = 0) {
|
getListDetailList(id, page, tryNum = 0) {
|
||||||
if (this._requestObj_listDetail) this._requestObj_listDetail.cancelHttp()
|
|
||||||
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
||||||
// https://h5.nf.migu.cn/app/v4/p/share/playlist/index.html?id=184187437&channel=0146921
|
// https://h5.nf.migu.cn/app/v4/p/share/playlist/index.html?id=184187437&channel=0146921
|
||||||
|
|
||||||
|
@ -82,8 +78,8 @@ export default {
|
||||||
id = id.replace(/.*(?:\?|&)id=(\d+)(?:&.*|$)/, '$1')
|
id = id.replace(/.*(?:\?|&)id=(\d+)(?:&.*|$)/, '$1')
|
||||||
} else if ((/[?&:/]/.test(id))) id = id.replace(this.regExps.listDetailLink, '$1')
|
} else if ((/[?&:/]/.test(id))) id = id.replace(this.regExps.listDetailLink, '$1')
|
||||||
|
|
||||||
this._requestObj_listDetail = httpFetch(this.getSongListDetailUrl(id, page), { headers: this.defaultHeaders })
|
const requestObj_listDetail = httpFetch(this.getSongListDetailUrl(id, page), { headers: this.defaultHeaders })
|
||||||
return this._requestObj_listDetail.promise.then(({ body }) => {
|
return requestObj_listDetail.promise.then(({ body }) => {
|
||||||
if (body.code !== this.successCode) return this.getListDetail(id, page, ++tryNum)
|
if (body.code !== this.successCode) return this.getListDetail(id, page, ++tryNum)
|
||||||
// console.log(JSON.stringify(body))
|
// console.log(JSON.stringify(body))
|
||||||
// console.log(body)
|
// console.log(body)
|
||||||
|
@ -98,14 +94,13 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
getListDetailInfo(id, tryNum = 0) {
|
getListDetailInfo(id, tryNum = 0) {
|
||||||
if (this._requestObj_listDetailInfo) this._requestObj_listDetailInfo.cancelHttp()
|
|
||||||
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
||||||
|
|
||||||
if (this.cachedDetailInfo[id]) return Promise.resolve(this.cachedDetailInfo[id])
|
if (this.cachedDetailInfo[id]) return Promise.resolve(this.cachedDetailInfo[id])
|
||||||
this._requestObj_listDetailInfo = httpFetch(`https://c.musicapp.migu.cn/MIGUM3.0/resource/playlist/v2.0?playlistId=${id}`, {
|
const requestObj_listDetailInfo = httpFetch(`https://c.musicapp.migu.cn/MIGUM3.0/resource/playlist/v2.0?playlistId=${id}`, {
|
||||||
headers: this.defaultHeaders,
|
headers: this.defaultHeaders,
|
||||||
})
|
})
|
||||||
return this._requestObj_listDetailInfo.promise.then(({ body }) => {
|
return requestObj_listDetailInfo.promise.then(({ body }) => {
|
||||||
if (body.code !== this.successCode) return this.getListDetail(id, ++tryNum)
|
if (body.code !== this.successCode) return this.getListDetail(id, ++tryNum)
|
||||||
// console.log(JSON.stringify(body))
|
// console.log(JSON.stringify(body))
|
||||||
// console.log(body)
|
// console.log(body)
|
||||||
|
@ -123,15 +118,13 @@ export default {
|
||||||
async getDetailUrl(link, page, retryNum = 0) {
|
async getDetailUrl(link, page, retryNum = 0) {
|
||||||
if (retryNum > 3) return Promise.reject(new Error('link try max num'))
|
if (retryNum > 3) return Promise.reject(new Error('link try max num'))
|
||||||
|
|
||||||
if (this._requestObj_listDetailLink) this._requestObj_listDetailLink.cancelHttp()
|
const requestObj_listDetailLink = httpFetch(link, {
|
||||||
|
|
||||||
this._requestObj_listDetailLink = httpFetch(link, {
|
|
||||||
headers: {
|
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',
|
'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,
|
Referer: link,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
const { headers: { location }, statusCode } = await this._requestObj_listDetailLink.promise
|
const { headers: { location }, statusCode } = await requestObj_listDetailLink.promise
|
||||||
// console.log(body, location)
|
// console.log(body, location)
|
||||||
if (statusCode > 400) return this.getDetailUrl(link, page, ++retryNum)
|
if (statusCode > 400) return this.getDetailUrl(link, page, ++retryNum)
|
||||||
if (location) {
|
if (location) {
|
||||||
|
|
|
@ -86,16 +86,14 @@ export default {
|
||||||
periods: {},
|
periods: {},
|
||||||
periodUrl: 'https://c.y.qq.com/node/pc/wk_v15/top.html',
|
periodUrl: 'https://c.y.qq.com/node/pc/wk_v15/top.html',
|
||||||
_requestBoardsObj: null,
|
_requestBoardsObj: null,
|
||||||
_requestDataObj: null,
|
|
||||||
getBoardsData() {
|
getBoardsData() {
|
||||||
if (this._requestBoardsObj) this._requestBoardsObj.cancelHttp()
|
if (this._requestBoardsObj) this._requestBoardsObj.cancelHttp()
|
||||||
this._requestBoardsObj = httpFetch('https://c.y.qq.com/v8/fcg-bin/fcg_myqq_toplist.fcg?g_tk=1928093487&inCharset=utf-8&outCharset=utf-8¬ice=0&format=json&uin=0&needNewCode=1&platform=h5')
|
this._requestBoardsObj = httpFetch('https://c.y.qq.com/v8/fcg-bin/fcg_myqq_toplist.fcg?g_tk=1928093487&inCharset=utf-8&outCharset=utf-8¬ice=0&format=json&uin=0&needNewCode=1&platform=h5')
|
||||||
return this._requestBoardsObj.promise
|
return this._requestBoardsObj.promise
|
||||||
},
|
},
|
||||||
getData(url) {
|
getData(url) {
|
||||||
if (this._requestDataObj) this._requestDataObj.cancelHttp()
|
const requestDataObj = httpFetch(url)
|
||||||
this._requestDataObj = httpFetch(url)
|
return requestDataObj.promise
|
||||||
return this._requestDataObj.promise
|
|
||||||
},
|
},
|
||||||
getSinger(singers) {
|
getSinger(singers) {
|
||||||
let arr = []
|
let arr = []
|
||||||
|
|
|
@ -5,7 +5,6 @@ import { formatPlayTime, sizeFormate } from '../../index'
|
||||||
// import { debug } from '../../utils/env'
|
// import { debug } from '../../utils/env'
|
||||||
// import { formatSinger } from './util'
|
// import { formatSinger } from './util'
|
||||||
|
|
||||||
let searchRequest
|
|
||||||
export default {
|
export default {
|
||||||
limit: 30,
|
limit: 30,
|
||||||
total: 0,
|
total: 0,
|
||||||
|
@ -13,10 +12,9 @@ export default {
|
||||||
allPage: 1,
|
allPage: 1,
|
||||||
successCode: 0,
|
successCode: 0,
|
||||||
musicSearch(str, page, limit, retryNum = 0) {
|
musicSearch(str, page, limit, retryNum = 0) {
|
||||||
if (searchRequest && searchRequest.cancelHttp) searchRequest.cancelHttp()
|
|
||||||
if (retryNum > 5) return Promise.reject(new Error('搜索失败'))
|
if (retryNum > 5) return Promise.reject(new Error('搜索失败'))
|
||||||
// searchRequest = httpFetch(`https://c.y.qq.com/soso/fcgi-bin/client_search_cp?ct=24&qqmusic_ver=1298&new_json=1&remoteplace=sizer.yqq.song_next&searchid=49252838123499591&t=0&aggr=1&cr=1&catZhida=1&lossless=0&flag_qc=0&p=${page}&n=${limit}&w=${encodeURIComponent(str)}&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0`)
|
// searchRequest = httpFetch(`https://c.y.qq.com/soso/fcgi-bin/client_search_cp?ct=24&qqmusic_ver=1298&new_json=1&remoteplace=sizer.yqq.song_next&searchid=49252838123499591&t=0&aggr=1&cr=1&catZhida=1&lossless=0&flag_qc=0&p=${page}&n=${limit}&w=${encodeURIComponent(str)}&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0`)
|
||||||
searchRequest = httpFetch(`https://c.y.qq.com/soso/fcgi-bin/client_search_cp?ct=24&qqmusic_ver=1298&remoteplace=txt.yqq.top&aggr=1&cr=1&catZhida=1&lossless=0&flag_qc=0&p=${page}&n=${limit}&w=${encodeURIComponent(str)}&cv=4747474&ct=24&format=json&inCharset=utf-8&outCharset=utf-8¬ice=0&platform=yqq.json&needNewCode=0&uin=0&hostUin=0&loginUin=0`)
|
const searchRequest = httpFetch(`https://c.y.qq.com/soso/fcgi-bin/client_search_cp?ct=24&qqmusic_ver=1298&remoteplace=txt.yqq.top&aggr=1&cr=1&catZhida=1&lossless=0&flag_qc=0&p=${page}&n=${limit}&w=${encodeURIComponent(str)}&cv=4747474&ct=24&format=json&inCharset=utf-8&outCharset=utf-8¬ice=0&platform=yqq.json&needNewCode=0&uin=0&hostUin=0&loginUin=0`)
|
||||||
// searchRequest = httpFetch(`http://ioscdn.kugou.com/api/v3/search/song?keyword=${encodeURIComponent(str)}&page=${page}&pagesize=${this.limit}&showtype=10&plat=2&version=7910&tag=1&correct=1&privilege=1&sver=5`)
|
// searchRequest = httpFetch(`http://ioscdn.kugou.com/api/v3/search/song?keyword=${encodeURIComponent(str)}&page=${page}&pagesize=${this.limit}&showtype=10&plat=2&version=7910&tag=1&correct=1&privilege=1&sver=5`)
|
||||||
return searchRequest.promise.then(({ body }) => {
|
return searchRequest.promise.then(({ body }) => {
|
||||||
if (body.code !== this.successCode) return this.musicSearch(str, page, limit, ++retryNum)
|
if (body.code !== this.successCode) return this.musicSearch(str, page, limit, ++retryNum)
|
||||||
|
|
|
@ -5,8 +5,6 @@ export default {
|
||||||
_requestObj_tags: null,
|
_requestObj_tags: null,
|
||||||
_requestObj_hotTags: null,
|
_requestObj_hotTags: null,
|
||||||
_requestObj_list: null,
|
_requestObj_list: null,
|
||||||
_requestObj_listDetail: null,
|
|
||||||
_requestObj_listDetailLink: null,
|
|
||||||
limit_list: 36,
|
limit_list: 36,
|
||||||
limit_song: 100000,
|
limit_song: 100000,
|
||||||
successCode: 0,
|
successCode: 0,
|
||||||
|
@ -175,11 +173,10 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
async handleParseId(link, retryNum = 0) {
|
async handleParseId(link, retryNum = 0) {
|
||||||
if (this._requestObj_listDetailLink) this._requestObj_listDetailLink.cancelHttp()
|
|
||||||
if (retryNum > 2) return Promise.reject(new Error('link try max num'))
|
if (retryNum > 2) return Promise.reject(new Error('link try max num'))
|
||||||
|
|
||||||
this._requestObj_listDetailLink = httpFetch(link)
|
const requestObj_listDetailLink = httpFetch(link)
|
||||||
const { headers: { location }, statusCode } = await this._requestObj_listDetailLink.promise
|
const { headers: { location }, statusCode } = await 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
|
return location == null ? link : location
|
||||||
|
@ -200,18 +197,17 @@ export default {
|
||||||
},
|
},
|
||||||
// 获取歌曲列表内的音乐
|
// 获取歌曲列表内的音乐
|
||||||
async getListDetail(id, tryNum = 0) {
|
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 (tryNum > 2) return Promise.reject(new Error('try max num'))
|
||||||
|
|
||||||
id = await this.getListId(id)
|
id = await this.getListId(id)
|
||||||
|
|
||||||
this._requestObj_listDetail = httpFetch(this.getListDetailUrl(id), {
|
const requestObj_listDetail = httpFetch(this.getListDetailUrl(id), {
|
||||||
headers: {
|
headers: {
|
||||||
Origin: 'https://y.qq.com',
|
Origin: 'https://y.qq.com',
|
||||||
Referer: `https://y.qq.com/n/yqq/playsquare/${id}.html`,
|
Referer: `https://y.qq.com/n/yqq/playsquare/${id}.html`,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
const { body } = await this._requestObj_listDetail.promise
|
const { body } = await requestObj_listDetail.promise
|
||||||
|
|
||||||
if (body.code !== this.successCode) return this.getListDetail(id, ++tryNum)
|
if (body.code !== this.successCode) return this.getListDetail(id, ++tryNum)
|
||||||
const cdlist = body.cdlist[0]
|
const cdlist = body.cdlist[0]
|
||||||
|
|
|
@ -104,7 +104,6 @@ export default {
|
||||||
list: /<textarea id="song-list-pre-data" style="display:none;">(.+?)<\/textarea>/,
|
list: /<textarea id="song-list-pre-data" style="display:none;">(.+?)<\/textarea>/,
|
||||||
},
|
},
|
||||||
_requestBoardsObj: null,
|
_requestBoardsObj: null,
|
||||||
_requestBoardsDetailObj: null,
|
|
||||||
getBoardsData() {
|
getBoardsData() {
|
||||||
if (this._requestBoardsObj) this._requestBoardsObj.cancelHttp()
|
if (this._requestBoardsObj) this._requestBoardsObj.cancelHttp()
|
||||||
this._requestBoardsObj = httpFetch('https://music.163.com/weapi/toplist', {
|
this._requestBoardsObj = httpFetch('https://music.163.com/weapi/toplist', {
|
||||||
|
@ -114,8 +113,7 @@ export default {
|
||||||
return this._requestBoardsObj.promise
|
return this._requestBoardsObj.promise
|
||||||
},
|
},
|
||||||
getData(id) {
|
getData(id) {
|
||||||
if (this._requestBoardsDetailObj) this._requestBoardsDetailObj.cancelHttp()
|
const requestBoardsDetailObj = httpFetch('https://music.163.com/weapi/v3/playlist/detail', {
|
||||||
this._requestBoardsDetailObj = httpFetch('https://music.163.com/weapi/v3/playlist/detail', {
|
|
||||||
method: 'post',
|
method: 'post',
|
||||||
form: weapi({
|
form: weapi({
|
||||||
id,
|
id,
|
||||||
|
@ -123,7 +121,7 @@ export default {
|
||||||
p: 1,
|
p: 1,
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
return this._requestBoardsDetailObj.promise
|
return requestBoardsDetailObj.promise
|
||||||
},
|
},
|
||||||
|
|
||||||
filterBoardsData(rawList) {
|
filterBoardsData(rawList) {
|
||||||
|
|
|
@ -4,7 +4,6 @@ import { formatPlayTime, sizeFormate } from '../..'
|
||||||
// https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/module/song_detail.js
|
// https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/module/song_detail.js
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
_requestObj: null,
|
|
||||||
getSinger(singers) {
|
getSinger(singers) {
|
||||||
let arr = []
|
let arr = []
|
||||||
singers.forEach(singer => {
|
singers.forEach(singer => {
|
||||||
|
@ -70,10 +69,9 @@ export default {
|
||||||
return list
|
return list
|
||||||
},
|
},
|
||||||
async getList(ids = [], retryNum = 0) {
|
async getList(ids = [], retryNum = 0) {
|
||||||
if (this._requestObj) this._requestObj.cancelHttp()
|
|
||||||
if (retryNum > 2) return Promise.reject(new Error('try max num'))
|
if (retryNum > 2) return Promise.reject(new Error('try max num'))
|
||||||
|
|
||||||
const _requestObj = httpFetch('https://music.163.com/weapi/v3/song/detail', {
|
const requestObj = httpFetch('https://music.163.com/weapi/v3/song/detail', {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36',
|
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36',
|
||||||
|
@ -84,7 +82,7 @@ export default {
|
||||||
ids: '[' + ids.join(',') + ']',
|
ids: '[' + ids.join(',') + ']',
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
const { body, statusCode } = await _requestObj.promise
|
const { body, statusCode } = await requestObj.promise
|
||||||
if (statusCode != 200 || body.code !== 200) throw new Error('获取歌曲详情失败')
|
if (statusCode != 200 || body.code !== 200) throw new Error('获取歌曲详情失败')
|
||||||
// console.log(body)
|
// console.log(body)
|
||||||
return { source: 'wy', list: this.filterList(body) }
|
return { source: 'wy', list: this.filterList(body) }
|
||||||
|
|
|
@ -4,15 +4,13 @@ import { sizeFormate, formatPlayTime } from '../../index'
|
||||||
// import musicDetailApi from './musicDetail'
|
// import musicDetailApi from './musicDetail'
|
||||||
import { eapiRequest } from './utils'
|
import { eapiRequest } from './utils'
|
||||||
|
|
||||||
let searchRequest
|
|
||||||
export default {
|
export default {
|
||||||
limit: 30,
|
limit: 30,
|
||||||
total: 0,
|
total: 0,
|
||||||
page: 0,
|
page: 0,
|
||||||
allPage: 1,
|
allPage: 1,
|
||||||
musicSearch(str, page, limit) {
|
musicSearch(str, page, limit) {
|
||||||
if (searchRequest && searchRequest.cancelHttp) searchRequest.cancelHttp()
|
const searchRequest = eapiRequest('/api/cloudsearch/pc', {
|
||||||
searchRequest = eapiRequest('/api/cloudsearch/pc', {
|
|
||||||
s: str,
|
s: str,
|
||||||
type: 1, // 1: 单曲, 10: 专辑, 100: 歌手, 1000: 歌单, 1002: 用户, 1004: MV, 1006: 歌词, 1009: 电台, 1014: 视频
|
type: 1, // 1: 单曲, 10: 专辑, 100: 歌手, 1000: 歌单, 1002: 用户, 1004: MV, 1006: 歌词, 1009: 电台, 1014: 视频
|
||||||
limit,
|
limit,
|
||||||
|
|
|
@ -12,8 +12,6 @@ export default {
|
||||||
_requestObj_tags: null,
|
_requestObj_tags: null,
|
||||||
_requestObj_hotTags: null,
|
_requestObj_hotTags: null,
|
||||||
_requestObj_list: null,
|
_requestObj_list: null,
|
||||||
_requestObj_listDetail: null,
|
|
||||||
_requestObj_listDetailLink: null,
|
|
||||||
limit_list: 30,
|
limit_list: 30,
|
||||||
limit_song: 100000,
|
limit_song: 100000,
|
||||||
successCode: 200,
|
successCode: 200,
|
||||||
|
@ -50,11 +48,10 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
async handleParseId(link, retryNum = 0) {
|
async handleParseId(link, retryNum = 0) {
|
||||||
if (this._requestObj_listDetailLink) this._requestObj_listDetailLink.cancelHttp()
|
|
||||||
if (retryNum > 2) throw new Error('link try max num')
|
if (retryNum > 2) throw new Error('link try max num')
|
||||||
|
|
||||||
this._requestObj_listDetailLink = httpFetch(link)
|
const requestObj_listDetailLink = httpFetch(link)
|
||||||
const { headers: { location }, statusCode } = await this._requestObj_listDetailLink.promise
|
const { headers: { location }, statusCode } = await 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)
|
||||||
const url = location == null ? link : location
|
const url = location == null ? link : location
|
||||||
|
@ -83,13 +80,12 @@ export default {
|
||||||
return { id, cookie }
|
return { id, cookie }
|
||||||
},
|
},
|
||||||
async getListDetail(rawId, page, tryNum = 0) { // 获取歌曲列表内的音乐
|
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'))
|
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
||||||
|
|
||||||
const { id, cookie } = await this.getListId(rawId)
|
const { id, cookie } = await this.getListId(rawId)
|
||||||
if (cookie) this.cookie = cookie
|
if (cookie) this.cookie = cookie
|
||||||
|
|
||||||
this._requestObj_listDetail = httpFetch('https://music.163.com/api/linux/forward', {
|
const requestObj_listDetail = httpFetch('https://music.163.com/api/linux/forward', {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36',
|
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36',
|
||||||
|
@ -105,7 +101,7 @@ export default {
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
const { statusCode, body } = await this._requestObj_listDetail.promise
|
const { statusCode, body } = await requestObj_listDetail.promise
|
||||||
if (statusCode !== 200 || body.code !== this.successCode) return this.getListDetail(id, page, ++tryNum)
|
if (statusCode !== 200 || body.code !== this.successCode) return this.getListDetail(id, page, ++tryNum)
|
||||||
let limit = 1000
|
let limit = 1000
|
||||||
let rangeStart = (page - 1) * limit
|
let rangeStart = (page - 1) * limit
|
||||||
|
|
|
@ -107,6 +107,7 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
|
searchId: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeRouteUpdate(to, from) {
|
beforeRouteUpdate(to, from) {
|
||||||
|
@ -259,14 +260,20 @@ export default {
|
||||||
this.handleSelectAllData()
|
this.handleSelectAllData()
|
||||||
},
|
},
|
||||||
handleSearch(text, page) {
|
handleSearch(text, page) {
|
||||||
if (text === '') return this.clearList()
|
const searchId = this.searchId = `${this.searchSourceId}__${page}__${text}`
|
||||||
|
if (text === '') {
|
||||||
|
this.isLoading = false
|
||||||
|
return this.clearList()
|
||||||
|
}
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
this.search({ text, page, limit: this.listInfo.limit }).then(data => {
|
this.search({ text, page, limit: this.listInfo.limit }).then(data => {
|
||||||
|
if (this.searchId != searchId) return
|
||||||
this.page = page
|
this.page = page
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.dom_scrollContent.scrollTo(0, 0)
|
this.$refs.dom_scrollContent.scrollTo(0, 0)
|
||||||
})
|
})
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
|
if (this.searchId != searchId) return
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue