更新QQ音乐点歌API,修复猜歌panic (#444)

This commit is contained in:
方柳煜
2022-10-12 23:45:31 +08:00
committed by GitHub
parent dc34a33346
commit 4cd81cb2e9
3 changed files with 9 additions and 9 deletions

View File

@@ -150,14 +150,13 @@ func cloud163(keyword string) (msg message.MessageSegment) {
// qqmusic 返回QQ音乐卡片
func qqmusic(keyword string) (msg message.MessageSegment) {
requestURL := "https://c.y.qq.com/soso/fcgi-bin/client_search_cp?w=" + url.QueryEscape(keyword)
requestURL := "https://c.y.qq.com/splcloud/fcgi-bin/smartbox_new.fcg?platform=yqq.json&key=" + url.QueryEscape(keyword)
data, err := web.RequestDataWith(web.NewDefaultClient(), requestURL, "GET", "", web.RandUA())
if err != nil {
msg = message.Text("ERROR: ", err)
return
}
info := gjson.ParseBytes(data[9 : len(data)-1]).Get("data.song.list.0")
msg = message.Music("qq", info.Get("songid").Int())
msg = message.Music("qq", gjson.ParseBytes(data).Get("data.song.itemlist.0.id").Int())
return
}