-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample.Capy.go
More file actions
49 lines (40 loc) · 1.22 KB
/
example.Capy.go
File metadata and controls
49 lines (40 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// example.Capy — DeathByCaptcha Go client example.
// Solves a Capy CAPTCHA challenge (type 15) and prints the token.
package main
import (
"encoding/json"
"fmt"
"log"
dbc "github.com/deathbycaptcha/deathbycaptcha-api-client-go/v4/deathbycaptcha"
)
func main() {
// Put your DBC account username and password here.
username := "your_username"
password := "your_password"
client := dbc.NewSocketClient(username, password)
defer client.Close()
// Put your Capy data here.
captchaDict := map[string]string{
"proxy": "http://user:password@127.0.0.1:1234",
"proxytype": "HTTP",
"captchakey": "your_capy_captchakey_here",
"pageurl": "https://www.capy.me/account/captcha/",
"api_server": "https://api.capy.me/",
}
jsonCaptcha, _ := json.Marshal(captchaDict)
params := map[string]string{
"type": "15",
"capy_params": string(jsonCaptcha),
}
captcha, err := client.Decode(nil, dbc.DefaultTokenTimeout, params)
if err != nil {
log.Fatalf("error: %v", err)
}
if captcha == nil {
fmt.Println("Failed to solve CAPTCHA (timeout).")
return
}
fmt.Printf("CAPTCHA %d solved: %s\n", captcha.CaptchaID, *captcha.Text)
// Report if the solution is incorrect.
// client.Report(captcha.CaptchaID)
}