Skip to content

Commit b3b50e1

Browse files
committed
🐛 搜图 有时无法下载图片
1 parent 95e8bf2 commit b3b50e1

File tree

14 files changed

+26
-25
lines changed

14 files changed

+26
-25
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ module github.com/FloatTech/ZeroBot-Plugin
33
go 1.17
44

55
require (
6-
github.com/FloatTech/AnimeAPI v1.3.1
6+
github.com/FloatTech/AnimeAPI v1.3.2-0.20220313050941-09c687419791
77
github.com/FloatTech/sqlite v0.2.1
8-
github.com/FloatTech/zbputils v1.3.1
8+
github.com/FloatTech/zbputils v1.3.2-0.20220313050647-f542a820183c
99
github.com/antchfx/htmlquery v1.2.4
1010
github.com/corona10/goimagehash v1.0.3
1111
github.com/fogleman/gg v1.3.0

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
github.com/FloatTech/AnimeAPI v1.3.1 h1:EBNz9pzfH5vYqs8HyME9AL3gXjO+iJ5DgWmqOfdNb18=
2-
github.com/FloatTech/AnimeAPI v1.3.1/go.mod h1:rEBMdnN1yPKt9DdL/BRSRibp7jR1SQiLIaEeQ53R+dk=
1+
github.com/FloatTech/AnimeAPI v1.3.2-0.20220313050941-09c687419791 h1:wgBjKq4B3vTES/iRXy/8HBiv/NmgXN1mb9D6ZXY07As=
2+
github.com/FloatTech/AnimeAPI v1.3.2-0.20220313050941-09c687419791/go.mod h1:ZraPslbw7AL9h9P1FMxbl8JMRvSuXC3PWXOX9inr7w8=
33
github.com/FloatTech/bot-manager v1.0.0/go.mod h1:8YYRJ16oroGHQGD2En0oVnmcKJkxR9O/jd5BPSfWfOQ=
44
github.com/FloatTech/sqlite v0.2.1 h1:9t6Me48XJJCIoPy4nLRvcdhcVKfT0c2lilp7SEKROG8=
55
github.com/FloatTech/sqlite v0.2.1/go.mod h1:6NfHRzqOo9RWeMJEoAQVuo51Omd5LFNxCNQhMF02/9U=
6-
github.com/FloatTech/zbputils v1.3.1 h1:ZdK5vkjdtDoeB83FoPAd+vIRmKdILeDSsLLiDIdanVI=
7-
github.com/FloatTech/zbputils v1.3.1/go.mod h1:ByNutpHjwyrhaxo54dRjJDEppko0Fcot2iOv7WrIDUg=
6+
github.com/FloatTech/zbputils v1.3.2-0.20220313050647-f542a820183c h1:14Ybaf7Zo5CfgVnD5cxp/nJsmw1NWIna2KqsH9ZTKKc=
7+
github.com/FloatTech/zbputils v1.3.2-0.20220313050647-f542a820183c/go.mod h1:ByNutpHjwyrhaxo54dRjJDEppko0Fcot2iOv7WrIDUg=
88
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
99
github.com/RomiChan/websocket v1.4.3-0.20220123145318-307a86b127bc h1:AAx50/fb/xS4lvsdQg+bFbGvqSDhyV1MF+p2PLCamZ0=
1010
github.com/RomiChan/websocket v1.4.3-0.20220123145318-307a86b127bc/go.mod h1:OMmITAib6POA37xCichWM0aRnoVpSMZO1rB/G01wrr0=

plugin/bilibili_push/bilibili_push.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ func bilibiliPushDaily() {
231231
}
232232

233233
func checkBuid(buid int64) (status int, name string) {
234-
data, err := web.GetDataWith(web.NewDefaultClient(), fmt.Sprintf(infoURL, buid), "GET", referer, ua)
234+
data, err := web.RequestDataWith(web.NewDefaultClient(), fmt.Sprintf(infoURL, buid), "GET", referer, ua)
235235
if err != nil {
236236
log.Errorln("[bilibilipush]:", err)
237237
}
@@ -289,7 +289,7 @@ func unsubscribeLive(buid, groupid int64) (err error) {
289289
}
290290

291291
func getUserDynamicCard(buid int64) (cardList []gjson.Result) {
292-
data, err := web.GetDataWith(web.NewDefaultClient(), fmt.Sprintf(userDynamicURL, buid), "GET", referer, ua)
292+
data, err := web.RequestDataWith(web.NewDefaultClient(), fmt.Sprintf(userDynamicURL, buid), "GET", referer, ua)
293293
if err != nil {
294294
log.Errorln("[bilibilipush]:", err)
295295
}

plugin/coser/coser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func init() {
2828
}).ApplySingle(ctxext.DefaultSingle).OnFullMatch("coser", zero.OnlyGroup).SetBlock(true).Limit(ctxext.LimitByGroup).
2929
Handle(func(ctx *zero.Ctx) {
3030
ctx.SendChain(message.Text("少女祈祷中......"))
31-
data, err := web.GetDataWith(web.NewDefaultClient(), coserURL, "GET", "", ua)
31+
data, err := web.RequestDataWith(web.NewDefaultClient(), coserURL, "GET", "", ua)
3232
if err != nil {
3333
log.Println("err为:", err)
3434
}

plugin/hs/run.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func init() {
6666
cid := gjson.Get(g, `list.`+strconv.Itoa(i)+`.CardID`).String()
6767
cachefile := cachedir + cid
6868
if file.IsNotExist(cachefile) {
69-
data, err := web.GetDataWith(web.NewDefaultClient(),
69+
data, err := web.RequestDataWith(web.NewDefaultClient(),
7070
`https://res.fbigame.com/hs/v13/`+cid+`.png?auth_key=`+
7171
gjson.Get(g, `list.`+strconv.Itoa(i)+`.auth_key`).String(),
7272
reqconf[0], reqconf[1], reqconf[2])
@@ -98,10 +98,10 @@ func init() {
9898
}
9999

100100
func sh(s string) string {
101-
data, err := web.GetDataWith(web.NewDefaultClient(), "https://hs.fbigame.com", reqconf[0], reqconf[1], reqconf[2])
101+
data, err := web.RequestDataWith(web.NewDefaultClient(), "https://hs.fbigame.com", reqconf[0], reqconf[1], reqconf[2])
102102
if err == nil {
103103
url := hs + para + "&hash=" + strings.SplitN(strings.SplitN(helper.BytesToString(data), `var hash = "`, 2)[1], `"`, 2)[0] + "&search=" + s
104-
r, err := web.GetDataWith(web.NewDefaultClient(), url, reqconf[0], reqconf[1], reqconf[2])
104+
r, err := web.RequestDataWith(web.NewDefaultClient(), url, reqconf[0], reqconf[1], reqconf[2])
105105
if err == nil {
106106
return helper.BytesToString(r)
107107
}
@@ -110,10 +110,10 @@ func sh(s string) string {
110110
}
111111

112112
func kz(s string) string {
113-
data, err := web.GetDataWith(web.NewDefaultClient(), "https://hs.fbigame.com", reqconf[0], reqconf[1], reqconf[2])
113+
data, err := web.RequestDataWith(web.NewDefaultClient(), "https://hs.fbigame.com", reqconf[0], reqconf[1], reqconf[2])
114114
if err == nil {
115115
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
116-
r, err := web.GetDataWith(web.NewDefaultClient(), url, reqconf[0], reqconf[1], reqconf[2])
116+
r, err := web.RequestDataWith(web.NewDefaultClient(), url, reqconf[0], reqconf[1], reqconf[2])
117117
if err == nil {
118118
return "base64://" + gjson.Get(helper.BytesToString(r), "img").String()
119119
}

plugin/saucenao/searcher.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func init() { // 插件主体
5353
continue
5454
}
5555
logrus.Debugln("[sausenao]开始下载", n)
56+
logrus.Debugln("[sausenao]urls:", illust.ImageUrls)
5657
err1 := illust.DownloadToCache(i)
5758
if err1 == nil {
5859
m.SetFile(f)

plugin/score/sign_in.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,12 @@ func getLevel(count int) int {
203203

204204
func initPic(picFile string) {
205205
if file.IsNotExist(picFile) {
206-
data, err := web.GetDataWith(web.NewDefaultClient(), backgroundURL, "GET", referer, ua)
206+
data, err := web.RequestDataWith(web.NewDefaultClient(), backgroundURL, "GET", referer, ua)
207207
if err != nil {
208208
log.Errorln("[score]", err)
209209
}
210210
picURL := gjson.Get(string(data), "pic").String()
211-
data, err = web.GetDataWith(web.NewDefaultClient(), picURL, "GET", "", ua)
211+
data, err = web.RequestDataWith(web.NewDefaultClient(), picURL, "GET", "", ua)
212212
if err != nil {
213213
log.Errorln("[score]", err)
214214
}

plugin/shadiao/caihongpi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
func init() {
1313
engine.OnFullMatch("哄我").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
14-
data, err := web.GetDataWith(web.NewDefaultClient(), chpURL, "GET", chpReferer, ua)
14+
data, err := web.RequestDataWith(web.NewDefaultClient(), chpURL, "GET", chpReferer, ua)
1515
if err != nil {
1616
ctx.SendChain(message.Text("ERROR:", err))
1717
return

plugin/shadiao/dujitang.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
func init() {
1313
engine.OnFullMatch("来碗毒鸡汤").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
14-
data, err := web.GetDataWith(web.NewDefaultClient(), duURL, "GET", duReferer, ua)
14+
data, err := web.RequestDataWith(web.NewDefaultClient(), duURL, "GET", duReferer, ua)
1515
if err != nil {
1616
ctx.SendChain(message.Text("ERROR:", err))
1717
return

plugin/shadiao/pengyouquan.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
func init() {
1313
engine.OnFullMatch("发个朋友圈").SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
14-
data, err := web.GetDataWith(web.NewDefaultClient(), pyqURL, "GET", pyqReferer, ua)
14+
data, err := web.RequestDataWith(web.NewDefaultClient(), pyqURL, "GET", pyqReferer, ua)
1515
if err != nil {
1616
ctx.SendChain(message.Text("ERROR:", err))
1717
return

0 commit comments

Comments
 (0)