-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
114 lines (90 loc) · 2.06 KB
/
main.go
File metadata and controls
114 lines (90 loc) · 2.06 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package main
import (
"fmt"
"os"
"Packages/anticaptcha"
)
var (
ClientKey = "..."
)
func main() {
client := anticaptcha.NewClient(ClientKey)
client.SetDebug(true)
//ReCaptcha(client)
ImageToText(client)
//Stat(client)
//Reseller(client)
}
func ReCaptcha(client *anticaptcha.Client) {
url := "https://...."
key := "..."
task := anticaptcha.NewTask_NoCaptchaProxyless(url, key)
r, ac_err := client.CreateTask(task)
if ac_err.Error != nil {
fmt.Println(ac_err.ErrMsg())
os.Exit(1)
}
fmt.Println("TaskID:", r.TaskID)
result, ac_err := client.WaitResult(r.TaskID, 600)
if ac_err.Error != nil {
fmt.Println(ac_err.ErrMsg())
os.Exit(1)
}
fmt.Println("Result:", result.ResultRecaptcha())
}
func ImageToText(client *anticaptcha.Client) {
task, err := anticaptcha.NewTask_ImageFromFile("./test.png")
if err != nil {
fmt.Println(err.Error())
os.Exit(1)
}
r, ac_err := client.CreateTask(task)
if ac_err.Error != nil {
fmt.Println(ac_err.ErrMsg())
os.Exit(1)
}
fmt.Println("TaskID:", r.TaskID)
result, ac_err := client.WaitResult(r.TaskID, 600)
if ac_err.Error != nil {
fmt.Println(ac_err.ErrMsg())
os.Exit(1)
}
fmt.Println("Result:")
fmt.Println(result.ResultImage())
}
func Stat(client *anticaptcha.Client) {
b, ac_err := client.GetBalance()
if ac_err.Error != nil {
fmt.Println(ac_err.ErrMsg())
fmt.Println(ac_err.ErrMsgRu())
os.Exit(1)
}
fmt.Println(b.Balance)
q, ac_err := client.GetQueueStats(anticaptcha.Queue_RecaptchaProxyless)
if ac_err.Error != nil {
fmt.Println(ac_err.ErrMsg())
os.Exit(1)
}
fmt.Printf("%#v\n", q)
s, ac_err := client.GetSpendingStats(0, "", 0, "")
if ac_err.Error != nil {
fmt.Println(ac_err.ErrMsg())
os.Exit(1)
}
fmt.Printf("%#v\n", s)
}
func Reseller(client *anticaptcha.Client) {
// reseller
c, ac_err := client.GenerateCoupons(1, 5, "http://")
if ac_err.Error != nil {
fmt.Println(ac_err.ErrMsg())
os.Exit(1)
}
fmt.Printf("%#v\n", c)
r, ac_err := client.GetResellerData(0)
if ac_err.Error != nil {
fmt.Println(ac_err.ErrMsg())
os.Exit(1)
}
fmt.Printf("%#v\n", r)
}