简单修了下网易点歌 (#200)

This commit is contained in:
MoeMagicMango 2022-04-20 12:49:24 +08:00 committed by GitHub
parent 3553683bb1
commit c0fa7efb27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,22 +140,14 @@ func cloud163(keyword string) message.MessageSegment {
"User-Agent": []string{"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0"}, "User-Agent": []string{"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0"},
} }
data := url.Values{ data := url.Values{
"offset": []string{"0"}, "keywords": []string{keyword},
"total": []string{"true"},
"limit": []string{"9"},
"type": []string{"1"},
"s": []string{keyword},
} }
// 搜索音乐信息 第一首歌 // 通过API 搜索音乐信息 第一首
info := gjson.ParseBytes(netPost("http://music.163.com/api/search/pc", data, headers)).Get("result.songs.0")
// 返回音乐卡片 // 返回音乐卡片
return message.CustomMusic( return message.Music("163", gjson.ParseBytes(netPost("https://nemapi.windis.xyz/search", data, headers)).Get("result.songs.0.id").Int())
fmt.Sprintf("http://y.music.163.com/m/song?id=%d", info.Get("id").Int()),
fmt.Sprintf("http://music.163.com/song/media/outer/url?id=%d.mp3", info.Get("id").Int()),
info.Get("name").Str,
).Add("content", info.Get("artists.0.name").Str).Add("image", info.Get("album.blurPicUrl").Str)
} }
// qqmusic 返回QQ音乐卡片 // qqmusic 返回QQ音乐卡片
func qqmusic(keyword string) message.MessageSegment { func qqmusic(keyword string) message.MessageSegment {
// 搜索音乐信息 第一首歌 // 搜索音乐信息 第一首歌