File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ import (
21
21
"github.com/wdvxdr1123/ZeroBot/message"
22
22
)
23
23
24
+ var (
25
+ longZhuURL = "https://www.hhlqilongzhu.cn/api/joox/juhe_music.php?msg=%v"
26
+ )
27
+
24
28
func init () {
25
29
control .AutoRegister (& ctrl.Options [* zero.Ctx ]{
26
30
DisableOnDefault : false ,
@@ -45,12 +49,22 @@ func init() {
45
49
ctx .SendChain (cloud163 (ctx .State ["regex_matched" ].([]string )[2 ]))
46
50
case "qq" :
47
51
ctx .SendChain (qqmusic (ctx .State ["regex_matched" ].([]string )[2 ]))
48
- default : // 默认咪咕点歌
49
- ctx .SendChain (migu (ctx .State ["regex_matched" ].([]string )[2 ]))
52
+ default : // 默认聚合点歌
53
+ ctx .SendChain (longzhu (ctx .State ["regex_matched" ].([]string )[2 ]))
50
54
}
51
55
})
52
56
}
53
57
58
+ // longzhu 聚合平台
59
+ func longzhu (keyword string ) message.Segment {
60
+ data , _ := web .GetData (fmt .Sprintf (longZhuURL , url .QueryEscape (keyword )))
61
+ // 假设 data 是包含整个 JSON 数组的字节切片
62
+ result := gjson .GetBytes (data , "#.full_track" )
63
+ // 取第一个非空的 full_track 链接
64
+ firstFullTrack := result .Array ()[0 ].String ()
65
+ return message .Record (firstFullTrack )
66
+ }
67
+
54
68
// migu 返回咪咕音乐卡片
55
69
func migu (keyword string ) message.Segment {
56
70
headers := http.Header {
You can’t perform that action at this time.
0 commit comments