From b3b50e1353b94cfaa3eed81eb0c73ea75487423b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sun, 13 Mar 2022 13:14:01 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E6=90=9C=E5=9B=BE=20=E6=9C=89?= =?UTF-8?q?=E6=97=B6=E6=97=A0=E6=B3=95=E4=B8=8B=E8=BD=BD=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 4 ++-- go.sum | 8 ++++---- plugin/bilibili_push/bilibili_push.go | 4 ++-- plugin/coser/coser.go | 2 +- plugin/hs/run.go | 10 +++++----- plugin/saucenao/searcher.go | 1 + plugin/score/sign_in.go | 4 ++-- plugin/shadiao/caihongpi.go | 2 +- plugin/shadiao/dujitang.go | 2 +- plugin/shadiao/pengyouquan.go | 2 +- plugin/shadiao/sweetnothings.go | 4 ++-- plugin/shadiao/yduanzi.go | 2 +- plugin/wangyiyun/main.go | 2 +- plugin/zaobao/zaobao.go | 4 ++-- 14 files changed, 26 insertions(+), 25 deletions(-) diff --git a/go.mod b/go.mod index e254ea7f..113a557b 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,9 @@ module github.com/FloatTech/ZeroBot-Plugin go 1.17 require ( - github.com/FloatTech/AnimeAPI v1.3.1 + github.com/FloatTech/AnimeAPI v1.3.2-0.20220313050941-09c687419791 github.com/FloatTech/sqlite v0.2.1 - github.com/FloatTech/zbputils v1.3.1 + github.com/FloatTech/zbputils v1.3.2-0.20220313050647-f542a820183c github.com/antchfx/htmlquery v1.2.4 github.com/corona10/goimagehash v1.0.3 github.com/fogleman/gg v1.3.0 diff --git a/go.sum b/go.sum index 083a0b5f..5e121de0 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,10 @@ -github.com/FloatTech/AnimeAPI v1.3.1 h1:EBNz9pzfH5vYqs8HyME9AL3gXjO+iJ5DgWmqOfdNb18= -github.com/FloatTech/AnimeAPI v1.3.1/go.mod h1:rEBMdnN1yPKt9DdL/BRSRibp7jR1SQiLIaEeQ53R+dk= +github.com/FloatTech/AnimeAPI v1.3.2-0.20220313050941-09c687419791 h1:wgBjKq4B3vTES/iRXy/8HBiv/NmgXN1mb9D6ZXY07As= +github.com/FloatTech/AnimeAPI v1.3.2-0.20220313050941-09c687419791/go.mod h1:ZraPslbw7AL9h9P1FMxbl8JMRvSuXC3PWXOX9inr7w8= github.com/FloatTech/bot-manager v1.0.0/go.mod h1:8YYRJ16oroGHQGD2En0oVnmcKJkxR9O/jd5BPSfWfOQ= github.com/FloatTech/sqlite v0.2.1 h1:9t6Me48XJJCIoPy4nLRvcdhcVKfT0c2lilp7SEKROG8= github.com/FloatTech/sqlite v0.2.1/go.mod h1:6NfHRzqOo9RWeMJEoAQVuo51Omd5LFNxCNQhMF02/9U= -github.com/FloatTech/zbputils v1.3.1 h1:ZdK5vkjdtDoeB83FoPAd+vIRmKdILeDSsLLiDIdanVI= -github.com/FloatTech/zbputils v1.3.1/go.mod h1:ByNutpHjwyrhaxo54dRjJDEppko0Fcot2iOv7WrIDUg= +github.com/FloatTech/zbputils v1.3.2-0.20220313050647-f542a820183c h1:14Ybaf7Zo5CfgVnD5cxp/nJsmw1NWIna2KqsH9ZTKKc= +github.com/FloatTech/zbputils v1.3.2-0.20220313050647-f542a820183c/go.mod h1:ByNutpHjwyrhaxo54dRjJDEppko0Fcot2iOv7WrIDUg= github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= github.com/RomiChan/websocket v1.4.3-0.20220123145318-307a86b127bc h1:AAx50/fb/xS4lvsdQg+bFbGvqSDhyV1MF+p2PLCamZ0= github.com/RomiChan/websocket v1.4.3-0.20220123145318-307a86b127bc/go.mod h1:OMmITAib6POA37xCichWM0aRnoVpSMZO1rB/G01wrr0= diff --git a/plugin/bilibili_push/bilibili_push.go b/plugin/bilibili_push/bilibili_push.go index d66401c8..09710539 100644 --- a/plugin/bilibili_push/bilibili_push.go +++ b/plugin/bilibili_push/bilibili_push.go @@ -231,7 +231,7 @@ func bilibiliPushDaily() { } func checkBuid(buid int64) (status int, name string) { - data, err := web.GetDataWith(web.NewDefaultClient(), fmt.Sprintf(infoURL, buid), "GET", referer, ua) + data, err := web.RequestDataWith(web.NewDefaultClient(), fmt.Sprintf(infoURL, buid), "GET", referer, ua) if err != nil { log.Errorln("[bilibilipush]:", err) } @@ -289,7 +289,7 @@ func unsubscribeLive(buid, groupid int64) (err error) { } func getUserDynamicCard(buid int64) (cardList []gjson.Result) { - data, err := web.GetDataWith(web.NewDefaultClient(), fmt.Sprintf(userDynamicURL, buid), "GET", referer, ua) + data, err := web.RequestDataWith(web.NewDefaultClient(), fmt.Sprintf(userDynamicURL, buid), "GET", referer, ua) if err != nil { log.Errorln("[bilibilipush]:", err) } diff --git a/plugin/coser/coser.go b/plugin/coser/coser.go index 4e875999..67564f70 100644 --- a/plugin/coser/coser.go +++ b/plugin/coser/coser.go @@ -28,7 +28,7 @@ func init() { }).ApplySingle(ctxext.DefaultSingle).OnFullMatch("coser", zero.OnlyGroup).SetBlock(true).Limit(ctxext.LimitByGroup). Handle(func(ctx *zero.Ctx) { ctx.SendChain(message.Text("少女祈祷中......")) - data, err := web.GetDataWith(web.NewDefaultClient(), coserURL, "GET", "", ua) + data, err := web.RequestDataWith(web.NewDefaultClient(), coserURL, "GET", "", ua) if err != nil { log.Println("err为:", err) } diff --git a/plugin/hs/run.go b/plugin/hs/run.go index f2a078ec..d2640d07 100644 --- a/plugin/hs/run.go +++ b/plugin/hs/run.go @@ -66,7 +66,7 @@ func init() { cid := gjson.Get(g, `list.`+strconv.Itoa(i)+`.CardID`).String() cachefile := cachedir + cid if file.IsNotExist(cachefile) { - data, err := web.GetDataWith(web.NewDefaultClient(), + data, err := web.RequestDataWith(web.NewDefaultClient(), `https://res.fbigame.com/hs/v13/`+cid+`.png?auth_key=`+ gjson.Get(g, `list.`+strconv.Itoa(i)+`.auth_key`).String(), reqconf[0], reqconf[1], reqconf[2]) @@ -98,10 +98,10 @@ func init() { } func sh(s string) string { - data, err := web.GetDataWith(web.NewDefaultClient(), "https://hs.fbigame.com", reqconf[0], reqconf[1], reqconf[2]) + data, err := web.RequestDataWith(web.NewDefaultClient(), "https://hs.fbigame.com", reqconf[0], reqconf[1], reqconf[2]) if err == nil { url := hs + para + "&hash=" + strings.SplitN(strings.SplitN(helper.BytesToString(data), `var hash = "`, 2)[1], `"`, 2)[0] + "&search=" + s - r, err := web.GetDataWith(web.NewDefaultClient(), url, reqconf[0], reqconf[1], reqconf[2]) + r, err := web.RequestDataWith(web.NewDefaultClient(), url, reqconf[0], reqconf[1], reqconf[2]) if err == nil { return helper.BytesToString(r) } @@ -110,10 +110,10 @@ func sh(s string) string { } func kz(s string) string { - data, err := web.GetDataWith(web.NewDefaultClient(), "https://hs.fbigame.com", reqconf[0], reqconf[1], reqconf[2]) + data, err := web.RequestDataWith(web.NewDefaultClient(), "https://hs.fbigame.com", reqconf[0], reqconf[1], reqconf[2]) if err == nil { url := hs + para + "mod=general_deck_image&deck_code=" + s + "&deck_text=&hash=" + strings.SplitN(strings.SplitN(helper.BytesToString(data), `var hash = "`, 2)[1], `"`, 2)[0] + "&search=" + s - r, err := web.GetDataWith(web.NewDefaultClient(), url, reqconf[0], reqconf[1], reqconf[2]) + r, err := web.RequestDataWith(web.NewDefaultClient(), url, reqconf[0], reqconf[1], reqconf[2]) if err == nil { return "base64://" + gjson.Get(helper.BytesToString(r), "img").String() } diff --git a/plugin/saucenao/searcher.go b/plugin/saucenao/searcher.go index 7af340da..e84282e9 100644 --- a/plugin/saucenao/searcher.go +++ b/plugin/saucenao/searcher.go @@ -53,6 +53,7 @@ func init() { // 插件主体 continue } logrus.Debugln("[sausenao]开始下载", n) + logrus.Debugln("[sausenao]urls:", illust.ImageUrls) err1 := illust.DownloadToCache(i) if err1 == nil { m.SetFile(f) diff --git a/plugin/score/sign_in.go b/plugin/score/sign_in.go index 32757a1c..77784ad6 100644 --- a/plugin/score/sign_in.go +++ b/plugin/score/sign_in.go @@ -203,12 +203,12 @@ func getLevel(count int) int { func initPic(picFile string) { if file.IsNotExist(picFile) { - data, err := web.GetDataWith(web.NewDefaultClient(), backgroundURL, "GET", referer, ua) + data, err := web.RequestDataWith(web.NewDefaultClient(), backgroundURL, "GET", referer, ua) if err != nil { log.Errorln("[score]", err) } picURL := gjson.Get(string(data), "pic").String() - data, err = web.GetDataWith(web.NewDefaultClient(), picURL, "GET", "", ua) + data, err = web.RequestDataWith(web.NewDefaultClient(), picURL, "GET", "", ua) if err != nil { log.Errorln("[score]", err) } diff --git a/plugin/shadiao/caihongpi.go b/plugin/shadiao/caihongpi.go index af1e32ad..4e04a80a 100644 --- a/plugin/shadiao/caihongpi.go +++ b/plugin/shadiao/caihongpi.go @@ -11,7 +11,7 @@ import ( func init() { engine.OnFullMatch("哄我").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) { - data, err := web.GetDataWith(web.NewDefaultClient(), chpURL, "GET", chpReferer, ua) + data, err := web.RequestDataWith(web.NewDefaultClient(), chpURL, "GET", chpReferer, ua) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return diff --git a/plugin/shadiao/dujitang.go b/plugin/shadiao/dujitang.go index 4a134c99..0ffe1fc6 100644 --- a/plugin/shadiao/dujitang.go +++ b/plugin/shadiao/dujitang.go @@ -11,7 +11,7 @@ import ( func init() { engine.OnFullMatch("来碗毒鸡汤").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) { - data, err := web.GetDataWith(web.NewDefaultClient(), duURL, "GET", duReferer, ua) + data, err := web.RequestDataWith(web.NewDefaultClient(), duURL, "GET", duReferer, ua) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return diff --git a/plugin/shadiao/pengyouquan.go b/plugin/shadiao/pengyouquan.go index 31654e24..21fabde6 100644 --- a/plugin/shadiao/pengyouquan.go +++ b/plugin/shadiao/pengyouquan.go @@ -11,7 +11,7 @@ import ( func init() { engine.OnFullMatch("发个朋友圈").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) { - data, err := web.GetDataWith(web.NewDefaultClient(), pyqURL, "GET", pyqReferer, ua) + data, err := web.RequestDataWith(web.NewDefaultClient(), pyqURL, "GET", pyqReferer, ua) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return diff --git a/plugin/shadiao/sweetnothings.go b/plugin/shadiao/sweetnothings.go index dcead2fd..f6d0358e 100644 --- a/plugin/shadiao/sweetnothings.go +++ b/plugin/shadiao/sweetnothings.go @@ -12,7 +12,7 @@ import ( func init() { engine.OnFullMatch("来碗绿茶").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) { - data, err := web.GetDataWith(web.NewDefaultClient(), chayiURL, "GET", loveliveReferer, ua) + data, err := web.RequestDataWith(web.NewDefaultClient(), chayiURL, "GET", loveliveReferer, ua) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return @@ -22,7 +22,7 @@ func init() { }) engine.OnFullMatch("渣我").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) { - data, err := web.GetDataWith(web.NewDefaultClient(), ganhaiURL, "GET", loveliveReferer, ua) + data, err := web.RequestDataWith(web.NewDefaultClient(), ganhaiURL, "GET", loveliveReferer, ua) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return diff --git a/plugin/shadiao/yduanzi.go b/plugin/shadiao/yduanzi.go index ba8b4ee1..7703cbae 100644 --- a/plugin/shadiao/yduanzi.go +++ b/plugin/shadiao/yduanzi.go @@ -14,7 +14,7 @@ import ( func init() { engine.OnFullMatch("讲个段子").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) { - data, err := web.GetDataWith(web.NewDefaultClient(), yduanziURL, "POST", yduanziReferer, ua) + data, err := web.RequestDataWith(web.NewDefaultClient(), yduanziURL, "POST", yduanziReferer, ua) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return diff --git a/plugin/wangyiyun/main.go b/plugin/wangyiyun/main.go index 8592e027..9fef3e44 100644 --- a/plugin/wangyiyun/main.go +++ b/plugin/wangyiyun/main.go @@ -24,7 +24,7 @@ func init() { Help: "wangyiyun \n- 来份网易云热评", }).OnFullMatch("来份网易云热评").SetBlock(true).Limit(ctxext.LimitByUser). Handle(func(ctx *zero.Ctx) { - data, err := web.GetDataWith(web.NewDefaultClient(), wangyiyunURL, "GET", wangyiyunReferer, ua) + data, err := web.RequestDataWith(web.NewDefaultClient(), wangyiyunURL, "GET", wangyiyunReferer, ua) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return diff --git a/plugin/zaobao/zaobao.go b/plugin/zaobao/zaobao.go index 0924ae1e..3f3822fa 100644 --- a/plugin/zaobao/zaobao.go +++ b/plugin/zaobao/zaobao.go @@ -54,11 +54,11 @@ func getdata() error { // 获取图片链接并且下载 if picdata != nil && time.Since(pictime) <= time.Hour*20 { return nil } - data, err := web.GetDataWith(web.NewDefaultClient(), api, "GET", "", ua) + data, err := web.RequestDataWith(web.NewDefaultClient(), api, "GET", "", ua) if err != nil { return err } - picdata, err = web.GetDataWith(web.NewDefaultClient(), gjson.Get(binary.BytesToString(data), "url").String(), "GET", referer, ua) + picdata, err = web.RequestDataWith(web.NewDefaultClient(), gjson.Get(binary.BytesToString(data), "url").String(), "GET", referer, ua) if err != nil { return err }