2021-09-30 00:00:49 +00:00
|
|
|
package anticaptcha
|
|
|
|
|
|
|
|
import (
|
|
|
|
"go.digitalcircle.com.br/open/replaycli-go/api"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Cli struct {
|
2021-10-11 14:53:44 +00:00
|
|
|
*api.ApiCli
|
|
|
|
//cli *api.Cli
|
2021-09-30 00:00:49 +00:00
|
|
|
}
|
|
|
|
|
2021-10-11 14:53:44 +00:00
|
|
|
//func (c *Cli) HttpCli() *api.Cli {
|
|
|
|
//
|
|
|
|
// return c.HttpCli()
|
|
|
|
//}
|
2021-09-30 00:00:49 +00:00
|
|
|
|
|
|
|
type Req struct {
|
|
|
|
Site string `json:"site"`
|
|
|
|
Data string `json:"data"`
|
|
|
|
Img []byte `json:"img"`
|
|
|
|
To int `json:"to"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Cli) Recaptchav2(site string, data string) (string, error) {
|
|
|
|
ret := ""
|
|
|
|
req := &Req{
|
|
|
|
Site: site,
|
|
|
|
Data: data,
|
|
|
|
Img: nil,
|
|
|
|
To: 300,
|
|
|
|
}
|
2021-10-11 14:53:44 +00:00
|
|
|
err := c.HttpCli().JsonPost("/ipc/anticaptcha/recaptchav2", req, &ret)
|
2021-09-30 00:00:49 +00:00
|
|
|
return ret, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Cli) Image2text(site string, data []byte) (string, error) {
|
|
|
|
ret := ""
|
|
|
|
req := &Req{
|
|
|
|
Site: site,
|
|
|
|
Img: data,
|
|
|
|
To: 300,
|
|
|
|
}
|
2021-10-11 14:53:44 +00:00
|
|
|
err := c.HttpCli().JsonPost("/ipc/anticaptcha/image2text", req, &ret)
|
2021-09-30 00:00:49 +00:00
|
|
|
return ret, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewCli() *Cli {
|
2021-10-11 14:53:44 +00:00
|
|
|
ret := &Cli{ApiCli: api.NewApiCli()}
|
2021-09-30 00:00:49 +00:00
|
|
|
return ret
|
|
|
|
}
|