From 23d436972c23cbcfd7c2929f50b7fc09153b809e Mon Sep 17 00:00:00 2001 From: Mrs4s <1844812067@qq.com> Date: Tue, 11 Aug 2020 17:35:03 +0800 Subject: [PATCH] save captcha to local file. close #71 --- main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 322414a..203f33c 100644 --- a/main.go +++ b/main.go @@ -166,9 +166,10 @@ func main() { if !rsp.Success { switch rsp.Error { case client.NeedCaptcha: + _ = ioutil.WriteFile("captcha.jpg", rsp.CaptchaImage, 0677) img, _, _ := image.Decode(bytes.NewReader(rsp.CaptchaImage)) fmt.Println(asciiart.New("image", img).Art) - log.Warn("请输入验证码: (Enter 提交)") + log.Warn("请输入验证码 (captcha.jpg): (Enter 提交)") text, _ := console.ReadString('\n') rsp, err = cli.SubmitCaptcha(strings.ReplaceAll(text, "\n", ""), rsp.CaptchaSign) continue