Skip to content

Commit c304d72

Browse files
authored
✨ music 音乐自定义分享 (#533)
1. 酷我音乐音乐直链url和参数修改,添加音乐卡片自定义参数。 2. 酷狗音乐添加音乐卡片自定义参数。
1 parent a1f1016 commit c304d72

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

plugin/music/selecter.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,20 @@ func kuwo(keyword string) message.MessageSegment {
6363
}.Encode()
6464
info := gjson.ParseBytes(netGet(search.String(), headers)).Get("data.list.0")
6565
// 获得音乐直链
66-
music, _ := url.Parse("http://www.kuwo.cn/url")
66+
music, _ := url.Parse("http://www.kuwo.cn/api/v1/www/music/playUrl")
6767
music.RawQuery = url.Values{
68-
"format": []string{"mp3"},
69-
"rid": []string{fmt.Sprintf("%d", info.Get("rid").Int())},
70-
"response": []string{"url"},
68+
"mid": []string{fmt.Sprintf("%d", info.Get("rid").Int())},
7169
"type": []string{"convert_url3"},
72-
"br": []string{"128kmp3"},
73-
"from": []string{"web"},
70+
"br": []string{"320kmp3"},
7471
"httpsStatus": []string{"1"},
7572
}.Encode()
7673
audio := gjson.ParseBytes(netGet(music.String(), headers))
7774
// 返回音乐卡片
7875
return message.CustomMusic(
7976
fmt.Sprintf("https://www.kuwo.cn/play_detail/%d", info.Get("rid").Int()),
80-
audio.Get("url").Str,
77+
audio.Get("data.url").Str,
8178
info.Get("name").Str,
82-
).Add("content", info.Get("artist").Str).Add("image", info.Get("pic").Str)
79+
).Add("content", info.Get("artist").Str).Add("image", info.Get("pic").Str).Add("subtype", "kuwo")
8380
}
8481

8582
// kugou 返回酷狗音乐卡片
@@ -133,7 +130,7 @@ func kugou(keyword string) message.MessageSegment {
133130
"https://www.kugou.com/song/#hash="+audio.Get("hash").Str+"&album_id="+audio.Get("album_id").Str,
134131
strings.ReplaceAll(audio.Get("play_backup_url").Str, "\\/", "/"),
135132
audio.Get("audio_name").Str,
136-
).Add("content", audio.Get("author_name").Str).Add("image", audio.Get("img").Str)
133+
).Add("content", audio.Get("author_name").Str).Add("image", audio.Get("img").Str).Add("subtype", "kugou")
137134
}
138135

139136
// cloud163 返回网易云音乐卡片

0 commit comments

Comments
 (0)