mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-12 10:10:25 +00:00
更新QQ音乐点歌API,修复猜歌panic (#444)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user