This commit is contained in:
lyswhut
2022-10-29 11:36:35 +08:00
parent 66b965d9f7
commit e45cee6596
715 changed files with 57096 additions and 31771 deletions
+23
View File
@@ -0,0 +1,23 @@
import { httpFetch } from '../../request'
import { b64DecodeUnicode, decodeName } from '../../index'
export default {
regexps: {
matchLrc: /.+"lyric":"([\w=+/]*)".+/,
},
getLyric(songmid) {
const requestObj = httpFetch(`https://c.y.qq.com/lyric/fcgi-bin/fcg_query_lyric_new.fcg?songmid=${songmid}&g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8&platform=yqq`, {
headers: {
Referer: 'https://y.qq.com/portal/player.html',
},
})
requestObj.promise = requestObj.promise.then(({ body }) => {
if (body.code != 0 || !body.lyric) return Promise.reject(new Error('Get lyric failed'))
return {
lyric: decodeName(b64DecodeUnicode(body.lyric)),
tlyric: decodeName(b64DecodeUnicode(body.trans)),
}
})
return requestObj
},
}