新增咪咕源搜索、歌单、排行榜

This commit is contained in:
lyswhut
2019-10-07 21:51:16 +08:00
parent ed12aac7d8
commit f7546b0090
14 changed files with 569 additions and 4 deletions
+2 -2
View File
@@ -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
}