新增咪咕源搜索、歌单、排行榜
This commit is contained in:
@@ -11,7 +11,7 @@ export default {
|
||||
}
|
||||
return parseInt(intv)
|
||||
},
|
||||
getLyric(songInfo, tryNum) {
|
||||
getLyric(songInfo, tryNum = 0) {
|
||||
let requestObj = httpFetch(`http://m.kugou.com/app/i/krc.php?cmd=100&keyword=${encodeURIComponent(songInfo.name)}&hash=${songInfo.hash}&timelength=${songInfo._interval || this.getIntv(songInfo.interval)}&d=0.38664927426725626`, {
|
||||
headers: {
|
||||
'KG-RC': 1,
|
||||
@@ -22,7 +22,7 @@ export default {
|
||||
requestObj.promise = requestObj.promise.then(({ body, statusCode }) => {
|
||||
if (statusCode !== 200) {
|
||||
if (tryNum > 5) return Promise.reject('歌词获取失败')
|
||||
let tryRequestObj = this.getLyric(songInfo, tryNum)
|
||||
let tryRequestObj = this.getLyric(songInfo, ++tryNum)
|
||||
requestObj.cancelHttp = tryRequestObj.cancelHttp.bind(tryRequestObj)
|
||||
return tryRequestObj.promise
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user