Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Examples of API requests for different captcha types are available on the [Golan
- [Cutcaptcha](#cutcaptcha)
- [Friendly Captcha](#friendly-captcha)
- [Audio Captcha](#audio-captcha)
- [VK Captcha](#vk-captcha)
- [Other methods](#other-methods)
- [send / getResult](#send--getresult)
- [balance](#balance)
Expand Down Expand Up @@ -551,6 +552,22 @@ audio := api2captcha.Audio{
}
```

### VKCaptcha

<sup>[API method description.](https://2captcha.com/2captcha-api#vkcaptcha)</sup>

We offer two methods to solve this type of captcha - token-based and image-based.

We use the body (image in base64 format) or file (image as file) and steps parameters.
You can get both values from the response to the request https://api.vk.com/method/captchaNotRobot.getContent?v={API_VER} when loading the captcha widget on the page.

```go
vkcaptcha := api2captcha.VKCaptcha{
Base64: "/9j/4AAQSkZJRgABAQAAAQABAAD/2wB...",
Steps: "[5,19,14,14,6,4,8,9...]
}
```

## Other methods

### Send / GetResult
Expand Down
22 changes: 22 additions & 0 deletions api2captcha.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ type (
Base64 string
Lang string
}

VKCaptcha struct {
File string
Base64 string
Steps string
}
)

var (
Expand Down Expand Up @@ -1097,3 +1103,19 @@ func (c *Audio) ToRequest() Request {

return req
}

func (c *VKCaptcha) ToRequest() Request {
req := Request{
Params: map[string]string{"method": "vkimage"},
}
if c.File != "" {
req.Files["file"] = c.File
}
if c.Base64 != "" {
req.Params["body"] = c.Base64
}
if c.Steps != "" {
req.Params["steps"] = c.Steps
}
return req
}
Binary file added examples/.DS_Store
Binary file not shown.