修复潜在歌单更新失败的问题
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
|
||||
},
|
||||
setList(state, datas) {
|
||||
if (!state.text) return
|
||||
let source = state.sourceList[datas.source]
|
||||
datas.list = deduplicationList(datas.list)
|
||||
source.list = markRawList(datas.list)
|
||||
|
@ -160,6 +161,7 @@ const mutations = {
|
|||
source.limit = datas.limit
|
||||
},
|
||||
setLists(state, { results, page }) {
|
||||
if (!state.text) return
|
||||
let pages = []
|
||||
let total = 0
|
||||
let limit = 0
|
||||
|
|
|
@ -65,6 +65,8 @@ const getters = {
|
|||
},
|
||||
}
|
||||
|
||||
let loadId = null
|
||||
|
||||
// actions
|
||||
const actions = {
|
||||
getTags({ state, rootState, commit }) {
|
||||
|
@ -76,11 +78,14 @@ const actions = {
|
|||
let tabId = rootState.setting.songList.tagInfo.id
|
||||
let sortId = rootState.setting.songList.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 (cache.has(key)) return Promise.resolve(cache.get(key)).then(result => commit('setList', { result, key, page }))
|
||||
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 }) {
|
||||
let key = `sdetail__${source}__${id}__${page}`
|
||||
|
|
|
@ -79,11 +79,9 @@ export default {
|
|||
item: /data-song="({.+?})"/g,
|
||||
info: /{total[\s:]+"(\d+)", size[\s:]+"(\d+)", page[\s:]+"(\d+)"}/,
|
||||
},
|
||||
requestObj: null,
|
||||
getData(url) {
|
||||
if (this.requestObj) this.requestObj.cancelHttp()
|
||||
this.requestObj = httpFetch(url)
|
||||
return this.requestObj.promise
|
||||
const requestObj = httpFetch(url)
|
||||
return requestObj.promise
|
||||
},
|
||||
filterData(rawList) {
|
||||
// console.log(rawList)
|
||||
|
|
|
@ -5,15 +5,13 @@ import { formatPlayTime } from '../../index'
|
|||
// import { debug } from '../../utils/env'
|
||||
// import { formatSinger } from './util'
|
||||
|
||||
let searchRequest
|
||||
export default {
|
||||
limit: 30,
|
||||
total: 0,
|
||||
page: 0,
|
||||
allPage: 1,
|
||||
musicSearch(str, page, limit) {
|
||||
if (searchRequest && searchRequest.cancelHttp) searchRequest.cancelHttp()
|
||||
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`)
|
||||
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`)
|
||||
return searchRequest.promise.then(({ body }) => body)
|
||||
},
|
||||
handleResult(rawData) {
|
||||
|
|
|
@ -6,7 +6,6 @@ export default {
|
|||
_requestObj_tags: null,
|
||||
_requestObj_list: null,
|
||||
_requestObj_listRecommend: null,
|
||||
_requestObj_listDetail: null,
|
||||
limit_list: 30,
|
||||
limit_song: 10000,
|
||||
successCode: 22000,
|
||||
|
@ -188,13 +187,12 @@ export default {
|
|||
|
||||
// 获取歌曲列表内的音乐
|
||||
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 ((/[?&:/]/.test(id))) id = id.replace(this.regExps.listDetailLink, '$1')
|
||||
|
||||
this._requestObj_listDetail = httpFetch(this.getListDetailUrl(id, page))
|
||||
return this._requestObj_listDetail.promise.then(({ body }) => {
|
||||
const requestObj_listDetail = httpFetch(this.getListDetailUrl(id, page))
|
||||
return requestObj_listDetail.promise.then(({ body }) => {
|
||||
if (body.error_code !== this.successCode) return this.getListDetail(id, page, ++tryNum)
|
||||
let listData = this.filterData(body.result.songlist)
|
||||
return {
|
||||
|
|
|
@ -71,16 +71,14 @@ export default {
|
|||
listData: /global\.features = (\[.+\]);/,
|
||||
},
|
||||
_requestBoardsObj: null,
|
||||
_requestDataObj: null,
|
||||
getBoardsData() {
|
||||
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')
|
||||
return this._requestBoardsObj.promise
|
||||
},
|
||||
getData(url) {
|
||||
if (this._requestDataObj) this._requestDataObj.cancelHttp()
|
||||
this._requestDataObj = httpFetch(url)
|
||||
return this._requestDataObj.promise
|
||||
const requestDataObj = httpFetch(url)
|
||||
return requestDataObj.promise
|
||||
},
|
||||
filterData(rawList) {
|
||||
// console.log(rawList)
|
||||
|
|
|
@ -5,15 +5,13 @@ import { decodeName, formatPlayTime, sizeFormate } from '../../index'
|
|||
// import { debug } from '../../utils/env'
|
||||
// import { formatSinger } from './util'
|
||||
|
||||
let searchRequest
|
||||
export default {
|
||||
limit: 30,
|
||||
total: 0,
|
||||
page: 0,
|
||||
allPage: 1,
|
||||
musicSearch(str, page, limit) {
|
||||
if (searchRequest && searchRequest.cancelHttp) searchRequest.cancelHttp()
|
||||
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`)
|
||||
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`)
|
||||
return searchRequest.promise.then(({ body }) => body)
|
||||
},
|
||||
filterData(rawData) {
|
||||
|
|
|
@ -18,7 +18,6 @@ export default {
|
|||
_requestObj_listInfo: null,
|
||||
_requestObj_list: null,
|
||||
_requestObj_listRecommend: null,
|
||||
_requestObj_listDetail: null,
|
||||
listDetailLimit: 10000,
|
||||
currentTagInfo: {
|
||||
id: undefined,
|
||||
|
@ -477,15 +476,14 @@ export default {
|
|||
}
|
||||
} 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: {
|
||||
'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 { headers: { location }, statusCode, body } = await this._requestObj_listDetailLink.promise
|
||||
const { headers: { location }, statusCode, body } = await requestObj_listDetailLink.promise
|
||||
// console.log(body, location)
|
||||
if (statusCode > 400) return this.getUserListDetail(link, page, ++retryNum)
|
||||
if (location) {
|
||||
|
@ -512,7 +510,6 @@ export default {
|
|||
},
|
||||
|
||||
getListDetail(id, page, tryNum = 0) { // 获取歌曲列表内的音乐
|
||||
if (this._requestObj_listDetail) this._requestObj_listDetail.cancelHttp()
|
||||
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
||||
|
||||
id = id.toString()
|
||||
|
@ -528,8 +525,8 @@ export default {
|
|||
|
||||
// if ((/[?&:/]/.test(id))) id = id.replace(this.regExps.listDetailLink, '$1')
|
||||
|
||||
this._requestObj_listDetail = httpFetch(this.getSongListDetailUrl(id))
|
||||
return this._requestObj_listDetail.promise.then(({ body }) => {
|
||||
const requestObj_listDetail = httpFetch(this.getSongListDetailUrl(id))
|
||||
return requestObj_listDetail.promise.then(({ body }) => {
|
||||
let listData = body.match(this.regExps.listData)
|
||||
let listInfo = body.match(this.regExps.listInfo)
|
||||
if (!listData) return this.getListDetail(id, page, ++tryNum)
|
||||
|
|
|
@ -3,7 +3,6 @@ import { decodeName } from '../../index'
|
|||
import { formatSinger, objStr2JSON } from './util'
|
||||
|
||||
// let requestObj_list
|
||||
let requestObj_listDetail
|
||||
export default {
|
||||
limit_list: 36,
|
||||
limit_song: 1000,
|
||||
|
@ -72,11 +71,8 @@ export default {
|
|||
return num
|
||||
},
|
||||
getAlbumListDetail(id, page, retryNum = 0) {
|
||||
if (requestObj_listDetail) {
|
||||
requestObj_listDetail.cancelHttp()
|
||||
}
|
||||
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 }) => {
|
||||
if (statusCode !== 200) return this.getAlbumListDetail(id, page, ++retryNum)
|
||||
body = objStr2JSON(body)
|
||||
|
|
|
@ -69,16 +69,14 @@ export default {
|
|||
limit: 100,
|
||||
_requestBoardsObj: null,
|
||||
|
||||
_requestDataObj: null,
|
||||
getBoardsData() {
|
||||
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')
|
||||
return this._requestBoardsObj.promise
|
||||
},
|
||||
getData(url) {
|
||||
if (this._requestDataObj) this._requestDataObj.cancelHttp()
|
||||
this._requestDataObj = httpFetch(url)
|
||||
return this._requestDataObj.promise
|
||||
const requestDataObj = httpFetch(url)
|
||||
return requestDataObj.promise
|
||||
},
|
||||
filterData(rawList) {
|
||||
// console.log(rawList)
|
||||
|
|
|
@ -9,16 +9,14 @@ export default {
|
|||
regExps: {
|
||||
mInfo: /bitrate:(\d+),format:(\w+),size:([\w.]+)/,
|
||||
},
|
||||
_musicSearchRequestObj: null,
|
||||
limit: 30,
|
||||
total: 0,
|
||||
page: 0,
|
||||
allPage: 1,
|
||||
// cancelFn: null,
|
||||
musicSearch(str, page, limit) {
|
||||
if (this._musicSearchRequestObj) this._musicSearchRequestObj.cancelHttp()
|
||||
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 this._musicSearchRequestObj.promise
|
||||
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`)
|
||||
return musicSearchRequestObj.promise
|
||||
},
|
||||
// getImg(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_hotTags: null,
|
||||
_requestObj_list: null,
|
||||
_requestObj_listDetail: null,
|
||||
limit_list: 36,
|
||||
limit_song: 10000,
|
||||
successCode: 200,
|
||||
|
@ -165,13 +164,10 @@ export default {
|
|||
},
|
||||
|
||||
getListDetailDigest8(id, page, tryNum = 0) {
|
||||
if (this._requestObj_listDetail) {
|
||||
this._requestObj_listDetail.cancelHttp()
|
||||
}
|
||||
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
||||
|
||||
this._requestObj_listDetail = httpFetch(this.getListDetailUrl(id, page))
|
||||
return this._requestObj_listDetail.promise.then(({ body }) => {
|
||||
const requestObj = httpFetch(this.getListDetailUrl(id, page))
|
||||
return requestObj.promise.then(({ body }) => {
|
||||
if (body.result !== 'ok') return this.getListDetail(id, page, ++tryNum)
|
||||
return {
|
||||
list: this.filterListDetail(body.musiclist),
|
||||
|
@ -190,24 +186,18 @@ export default {
|
|||
})
|
||||
},
|
||||
getListDetailDigest5Info(id, tryNum = 0) {
|
||||
if (this._requestObj_listDetail) {
|
||||
this._requestObj_listDetail.cancelHttp()
|
||||
}
|
||||
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`)
|
||||
return this._requestObj_listDetail.promise.then(({ statusCode, body }) => {
|
||||
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 requestObj.promise.then(({ statusCode, body }) => {
|
||||
if (statusCode != 200 || !body.child) return this.getListDetail(id, ++tryNum)
|
||||
// console.log(body)
|
||||
return body.child.length ? body.child[0].sourceid : null
|
||||
})
|
||||
},
|
||||
getListDetailDigest5Music(id, page, tryNum = 0) {
|
||||
if (this._requestObj_listDetail) {
|
||||
this._requestObj_listDetail.cancelHttp()
|
||||
}
|
||||
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`)
|
||||
return this._requestObj_listDetail.promise.then(({ body }) => {
|
||||
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 requestObj.promise.then(({ body }) => {
|
||||
// console.log(body)
|
||||
if (body.result !== 'ok') return this.getListDetail(id, page, ++tryNum)
|
||||
return {
|
||||
|
|
|
@ -65,7 +65,6 @@ export default {
|
|||
},
|
||||
successCode: '000000',
|
||||
requestBoardsObj: null,
|
||||
requestObj: null,
|
||||
getBoardsData() {
|
||||
if (this.requestBoardsObj) this._requestBoardsObj.cancelHttp()
|
||||
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
|
||||
},
|
||||
getData(url) {
|
||||
if (this.requestObj) this.requestObj.cancelHttp()
|
||||
this.requestObj = httpFetch(url)
|
||||
return this.requestObj.promise
|
||||
const requestObj = httpFetch(url)
|
||||
return requestObj.promise
|
||||
},
|
||||
getSinger(singers) {
|
||||
let arr = []
|
||||
|
|
|
@ -57,14 +57,12 @@ export default {
|
|||
},
|
||||
successCode: '000000',
|
||||
requestBoardsObj: null,
|
||||
requestObj: null,
|
||||
regExps: {
|
||||
listData: /var listData = (\{.+\})<\/script>/,
|
||||
},
|
||||
getData(url) {
|
||||
if (this.requestObj) this.requestObj.cancelHttp()
|
||||
this.requestObj = httpFetch(url)
|
||||
return this.requestObj.promise
|
||||
const requestObj = httpFetch(url)
|
||||
return requestObj.promise
|
||||
},
|
||||
getSinger(singers) {
|
||||
let arr = []
|
||||
|
|
|
@ -5,15 +5,13 @@ import { sizeFormate } from '../../index'
|
|||
// import { debug } from '../../utils/env'
|
||||
// import { formatSinger } from './util'
|
||||
|
||||
let searchRequest
|
||||
export default {
|
||||
limit: 20,
|
||||
total: 0,
|
||||
page: 0,
|
||||
allPage: 1,
|
||||
musicSearch(str, page, limit) {
|
||||
if (searchRequest && searchRequest.cancelHttp) searchRequest.cancelHttp()
|
||||
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`, {
|
||||
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://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: {
|
||||
// sign: 'c3b7ae985e2206e97f1b2de8f88691e2',
|
||||
|
|
|
@ -6,9 +6,6 @@ import { sizeFormate } from '../../index'
|
|||
export default {
|
||||
_requestObj_tags: null,
|
||||
_requestObj_list: null,
|
||||
_requestObj_listDetail: null,
|
||||
_requestObj_listDetailLink: null,
|
||||
_requestObj_listDetailInfo: null,
|
||||
limit_list: 10,
|
||||
limit_song: 50,
|
||||
successCode: '000000',
|
||||
|
@ -74,7 +71,6 @@ export default {
|
|||
},
|
||||
|
||||
getListDetailList(id, page, tryNum = 0) {
|
||||
if (this._requestObj_listDetail) this._requestObj_listDetail.cancelHttp()
|
||||
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
|
||||
|
||||
|
@ -82,8 +78,8 @@ export default {
|
|||
id = id.replace(/.*(?:\?|&)id=(\d+)(?:&.*|$)/, '$1')
|
||||
} else if ((/[?&:/]/.test(id))) id = id.replace(this.regExps.listDetailLink, '$1')
|
||||
|
||||
this._requestObj_listDetail = httpFetch(this.getSongListDetailUrl(id, page), { headers: this.defaultHeaders })
|
||||
return this._requestObj_listDetail.promise.then(({ body }) => {
|
||||
const requestObj_listDetail = httpFetch(this.getSongListDetailUrl(id, page), { headers: this.defaultHeaders })
|
||||
return requestObj_listDetail.promise.then(({ body }) => {
|
||||
if (body.code !== this.successCode) return this.getListDetail(id, page, ++tryNum)
|
||||
// console.log(JSON.stringify(body))
|
||||
// console.log(body)
|
||||
|
@ -98,14 +94,13 @@ export default {
|
|||
},
|
||||
|
||||
getListDetailInfo(id, tryNum = 0) {
|
||||
if (this._requestObj_listDetailInfo) this._requestObj_listDetailInfo.cancelHttp()
|
||||
if (tryNum > 2) return Promise.reject(new Error('try max num'))
|
||||
|
||||
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,
|
||||
})
|
||||
return this._requestObj_listDetailInfo.promise.then(({ body }) => {
|
||||
return requestObj_listDetailInfo.promise.then(({ body }) => {
|
||||
if (body.code !== this.successCode) return this.getListDetail(id, ++tryNum)
|
||||
// console.log(JSON.stringify(body))
|
||||
// console.log(body)
|
||||
|
@ -123,15 +118,13 @@ 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, {
|
||||
const 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 { headers: { location }, statusCode } = await this._requestObj_listDetailLink.promise
|
||||
const { headers: { location }, statusCode } = await requestObj_listDetailLink.promise
|
||||
// console.log(body, location)
|
||||
if (statusCode > 400) return this.getDetailUrl(link, page, ++retryNum)
|
||||
if (location) {
|
||||
|
|
|
@ -86,16 +86,14 @@ export default {
|
|||
periods: {},
|
||||
periodUrl: 'https://c.y.qq.com/node/pc/wk_v15/top.html',
|
||||
_requestBoardsObj: null,
|
||||
_requestDataObj: null,
|
||||
getBoardsData() {
|
||||
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')
|
||||
return this._requestBoardsObj.promise
|
||||
},
|
||||
getData(url) {
|
||||
if (this._requestDataObj) this._requestDataObj.cancelHttp()
|
||||
this._requestDataObj = httpFetch(url)
|
||||
return this._requestDataObj.promise
|
||||
const requestDataObj = httpFetch(url)
|
||||
return requestDataObj.promise
|
||||
},
|
||||
getSinger(singers) {
|
||||
let arr = []
|
||||
|
|
|
@ -5,7 +5,6 @@ import { formatPlayTime, sizeFormate } from '../../index'
|
|||
// import { debug } from '../../utils/env'
|
||||
// import { formatSinger } from './util'
|
||||
|
||||
let searchRequest
|
||||
export default {
|
||||
limit: 30,
|
||||
total: 0,
|
||||
|
@ -13,10 +12,9 @@ export default {
|
|||
allPage: 1,
|
||||
successCode: 0,
|
||||
musicSearch(str, page, limit, retryNum = 0) {
|
||||
if (searchRequest && searchRequest.cancelHttp) searchRequest.cancelHttp()
|
||||
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&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`)
|
||||
return searchRequest.promise.then(({ body }) => {
|
||||
if (body.code !== this.successCode) return this.musicSearch(str, page, limit, ++retryNum)
|
||||
|
|
|
@ -5,8 +5,6 @@ export default {
|
|||
_requestObj_tags: null,
|
||||
_requestObj_hotTags: null,
|
||||
_requestObj_list: null,
|
||||
_requestObj_listDetail: null,
|
||||
_requestObj_listDetailLink: null,
|
||||
limit_list: 36,
|
||||
limit_song: 100000,
|
||||
successCode: 0,
|
||||
|
@ -175,11 +173,10 @@ export default {
|
|||
},
|
||||
|
||||
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'))
|
||||
|
||||
this._requestObj_listDetailLink = httpFetch(link)
|
||||
const { headers: { location }, statusCode } = await this._requestObj_listDetailLink.promise
|
||||
const requestObj_listDetailLink = httpFetch(link)
|
||||
const { headers: { location }, statusCode } = await requestObj_listDetailLink.promise
|
||||
// console.log(headers)
|
||||
if (statusCode > 400) return this.handleParseId(link, ++retryNum)
|
||||
return location == null ? link : location
|
||||
|
@ -200,18 +197,17 @@ export default {
|
|||
},
|
||||
// 获取歌曲列表内的音乐
|
||||
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), {
|
||||
const requestObj_listDetail = httpFetch(this.getListDetailUrl(id), {
|
||||
headers: {
|
||||
Origin: 'https://y.qq.com',
|
||||
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)
|
||||
const cdlist = body.cdlist[0]
|
||||
|
|
|
@ -104,7 +104,6 @@ export default {
|
|||
list: /<textarea id="song-list-pre-data" style="display:none;">(.+?)<\/textarea>/,
|
||||
},
|
||||
_requestBoardsObj: null,
|
||||
_requestBoardsDetailObj: null,
|
||||
getBoardsData() {
|
||||
if (this._requestBoardsObj) this._requestBoardsObj.cancelHttp()
|
||||
this._requestBoardsObj = httpFetch('https://music.163.com/weapi/toplist', {
|
||||
|
@ -114,8 +113,7 @@ export default {
|
|||
return this._requestBoardsObj.promise
|
||||
},
|
||||
getData(id) {
|
||||
if (this._requestBoardsDetailObj) this._requestBoardsDetailObj.cancelHttp()
|
||||
this._requestBoardsDetailObj = httpFetch('https://music.163.com/weapi/v3/playlist/detail', {
|
||||
const requestBoardsDetailObj = httpFetch('https://music.163.com/weapi/v3/playlist/detail', {
|
||||
method: 'post',
|
||||
form: weapi({
|
||||
id,
|
||||
|
@ -123,7 +121,7 @@ export default {
|
|||
p: 1,
|
||||
}),
|
||||
})
|
||||
return this._requestBoardsDetailObj.promise
|
||||
return requestBoardsDetailObj.promise
|
||||
},
|
||||
|
||||
filterBoardsData(rawList) {
|
||||
|
|
|
@ -4,7 +4,6 @@ import { formatPlayTime, sizeFormate } from '../..'
|
|||
// https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/module/song_detail.js
|
||||
|
||||
export default {
|
||||
_requestObj: null,
|
||||
getSinger(singers) {
|
||||
let arr = []
|
||||
singers.forEach(singer => {
|
||||
|
@ -70,10 +69,9 @@ export default {
|
|||
return list
|
||||
},
|
||||
async getList(ids = [], retryNum = 0) {
|
||||
if (this._requestObj) this._requestObj.cancelHttp()
|
||||
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',
|
||||
headers: {
|
||||
'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(',') + ']',
|
||||
}),
|
||||
})
|
||||
const { body, statusCode } = await _requestObj.promise
|
||||
const { body, statusCode } = await requestObj.promise
|
||||
if (statusCode != 200 || body.code !== 200) throw new Error('获取歌曲详情失败')
|
||||
// console.log(body)
|
||||
return { source: 'wy', list: this.filterList(body) }
|
||||
|
|
|
@ -4,15 +4,13 @@ import { sizeFormate, formatPlayTime } from '../../index'
|
|||
// import musicDetailApi from './musicDetail'
|
||||
import { eapiRequest } from './utils'
|
||||
|
||||
let searchRequest
|
||||
export default {
|
||||
limit: 30,
|
||||
total: 0,
|
||||
page: 0,
|
||||
allPage: 1,
|
||||
musicSearch(str, page, limit) {
|
||||
if (searchRequest && searchRequest.cancelHttp) searchRequest.cancelHttp()
|
||||
searchRequest = eapiRequest('/api/cloudsearch/pc', {
|
||||
const searchRequest = eapiRequest('/api/cloudsearch/pc', {
|
||||
s: str,
|
||||
type: 1, // 1: 单曲, 10: 专辑, 100: 歌手, 1000: 歌单, 1002: 用户, 1004: MV, 1006: 歌词, 1009: 电台, 1014: 视频
|
||||
limit,
|
||||
|
|
|
@ -12,8 +12,6 @@ export default {
|
|||
_requestObj_tags: null,
|
||||
_requestObj_hotTags: null,
|
||||
_requestObj_list: null,
|
||||
_requestObj_listDetail: null,
|
||||
_requestObj_listDetailLink: null,
|
||||
limit_list: 30,
|
||||
limit_song: 100000,
|
||||
successCode: 200,
|
||||
|
@ -50,11 +48,10 @@ export default {
|
|||
},
|
||||
|
||||
async handleParseId(link, retryNum = 0) {
|
||||
if (this._requestObj_listDetailLink) this._requestObj_listDetailLink.cancelHttp()
|
||||
if (retryNum > 2) throw new Error('link try max num')
|
||||
|
||||
this._requestObj_listDetailLink = httpFetch(link)
|
||||
const { headers: { location }, statusCode } = await this._requestObj_listDetailLink.promise
|
||||
const requestObj_listDetailLink = httpFetch(link)
|
||||
const { headers: { location }, statusCode } = await requestObj_listDetailLink.promise
|
||||
// console.log(headers)
|
||||
if (statusCode > 400) return this.handleParseId(link, ++retryNum)
|
||||
const url = location == null ? link : location
|
||||
|
@ -83,13 +80,12 @@ export default {
|
|||
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', {
|
||||
const requestObj_listDetail = httpFetch('https://music.163.com/api/linux/forward', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'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)
|
||||
let limit = 1000
|
||||
let rangeStart = (page - 1) * limit
|
||||
|
|
|
@ -107,6 +107,7 @@ export default {
|
|||
},
|
||||
},
|
||||
isLoading: false,
|
||||
searchId: null,
|
||||
}
|
||||
},
|
||||
beforeRouteUpdate(to, from) {
|
||||
|
@ -259,14 +260,20 @@ export default {
|
|||
this.handleSelectAllData()
|
||||
},
|
||||
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.search({ text, page, limit: this.listInfo.limit }).then(data => {
|
||||
if (this.searchId != searchId) return
|
||||
this.page = page
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dom_scrollContent.scrollTo(0, 0)
|
||||
})
|
||||
}).finally(() => {
|
||||
if (this.searchId != searchId) return
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue