File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ import (
2121 "github.com/wdvxdr1123/ZeroBot/message"
2222)
2323
24+ var (
25+ longZhuURL = "https://www.hhlqilongzhu.cn/api/joox/juhe_music.php?msg=%v"
26+ )
27+
2428func init () {
2529 control .AutoRegister (& ctrl.Options [* zero.Ctx ]{
2630 DisableOnDefault : false ,
@@ -45,12 +49,22 @@ func init() {
4549 ctx .SendChain (cloud163 (ctx .State ["regex_matched" ].([]string )[2 ]))
4650 case "qq" :
4751 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 ]))
5054 }
5155 })
5256}
5357
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+
5468// migu 返回咪咕音乐卡片
5569func migu (keyword string ) message.Segment {
5670 headers := http.Header {
You can’t perform that action at this time.
0 commit comments