From 6c20f22548c9e21d0e63104569cb12faeeeca9a0 Mon Sep 17 00:00:00 2001 From: Eat Hatsune Shallots Date: Mon, 4 Mar 2024 14:33:36 +0800 Subject: [PATCH] =?UTF-8?q?baidu:=20=E5=AF=B9=E8=A6=81=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=9A=84=E5=86=85=E5=AE=B9=E8=BF=9B=E8=A1=8CURI=E7=BC=96?= =?UTF-8?q?=E7=A0=81=20(#866)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/baidu/search.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugin/baidu/search.go b/plugin/baidu/search.go index 3b44544a..91ac83f0 100644 --- a/plugin/baidu/search.go +++ b/plugin/baidu/search.go @@ -4,6 +4,7 @@ package baidu import ( "encoding/json" "fmt" + "net/url" "github.com/FloatTech/floatbox/web" ctrl "github.com/FloatTech/zbpctrl" @@ -37,9 +38,9 @@ func init() { // 主函数 var err error switch ctx.State["regex_matched"].([]string)[1] { case "百度", "百科": - es, err = web.GetData(fmt.Sprintf(duURL, key, ctx.State["regex_matched"].([]string)[2])) // 将网站返回结果赋值 + es, err = web.GetData(fmt.Sprintf(duURL, key, url.QueryEscape(ctx.State["regex_matched"].([]string)[2]))) // 将网站返回结果赋值 case "wiki", "维基": - es, err = web.GetData(fmt.Sprintf(wikiURL, key, ctx.State["regex_matched"].([]string)[2])) // 将网站返回结果赋值 + es, err = web.GetData(fmt.Sprintf(wikiURL, key, url.QueryEscape(ctx.State["regex_matched"].([]string)[2]))) // 将网站返回结果赋值 } if err != nil { ctx.SendChain(message.Text("出现错误捏:", err))