From 981050c41289bdaca28b3e0c7f8fb253db3d00b0 Mon Sep 17 00:00:00 2001 From: juzeon <812312770@qq.com> Date: Fri, 8 Dec 2023 11:36:30 +0800 Subject: [PATCH] fix #search_result --- sydney/stream.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sydney/stream.go b/sydney/stream.go index da2e7e9..94ec3a4 100644 --- a/sydney/stream.go +++ b/sydney/stream.go @@ -75,11 +75,14 @@ func (o *Sydney) AskStream(options AskStreamOptions) <-chan Message { arr := gjson.Parse(messageText).Array() for _, group := range arr { srIndex := 1 - for _, subGroup := range group.Array() { - links = append(links, fmt.Sprintf("[^%d^][%s](%s)", - srIndex, subGroup.Get("title").String(), subGroup.Get("url").String())) - srIndex++ - } + group.ForEach(func(key, value gjson.Result) bool { + for _, subGroup := range value.Array() { + links = append(links, fmt.Sprintf("[^%d^][%s](%s)", + srIndex, subGroup.Get("title").String(), subGroup.Get("url").String())) + srIndex++ + } + return true + }) } out <- Message{ Type: MessageTypeSearchResult,