Skip to content

Commit 7574fe1

Browse files
author
nextcaptcha
committedApr 7, 2024
type
1 parent 1be5c05 commit 7574fe1

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ To start using the NextCaptcha Golang SDK, you first need to obtain your API key
1616
```go
1717
import "github.com/nextcaptcha/nextcaptcha-go"
1818

19-
api := nextcaptcha.NewNextCaptchaAPI("YOUR_CLIENT_KEY")
19+
api := nextcaptcha.NewNextCaptchaAPI(clientKey, "", "", true)
2020

2121
```
2222
Now, you can use the api object to solve various types of captchas.

‎README_RU.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ go get github.com/nextcaptcha/nextcaptcha-go
2020
```go
2121
import "github.com/nextcaptcha/nextcaptcha-go"
2222

23-
api := nextcaptcha.NewNextCaptchaAPI("YOUR_CLIENT_KEY")
23+
api := nextcaptcha.NewNextCaptchaAPI(clientKey, "", "", true)
2424

2525
```
2626

‎next.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ func (c *ApiClient) send(task map[string]interface{}) (map[string]interface{}, e
8989
return nil, err
9090
}
9191

92-
taskId := resp["taskId"].(string)
92+
taskId := resp["taskId"].(float64)
9393
if c.openLog {
94-
log.Printf("Task %s created %v", taskId, resp)
94+
log.Printf("Task %f created %v", taskId, resp)
9595
}
9696

9797
startTime := time.Now()
@@ -104,7 +104,7 @@ func (c *ApiClient) send(task map[string]interface{}) (map[string]interface{}, e
104104
}, nil
105105
}
106106

107-
data := map[string]string{
107+
data := map[string]any{
108108
"clientKey": c.clientKey,
109109
"taskId": taskId,
110110
}
@@ -122,11 +122,11 @@ func (c *ApiClient) send(task map[string]interface{}) (map[string]interface{}, e
122122
}
123123

124124
if status == READY_STATUS {
125-
log.Printf("Task %s ready %v", taskId, resp)
125+
log.Printf("Task %f ready %v", taskId, resp)
126126
return resp, nil
127127
}
128128
if status == FAILED_STATUS {
129-
log.Printf("Task %s failed %v", taskId, resp)
129+
log.Printf("Task %f failed %v", taskId, resp)
130130
return resp, nil
131131
}
132132
time.Sleep(1 * time.Second)

‎next_test.go

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package nextcaptcha
2+
3+
import (
4+
"os"
5+
"testing"
6+
)
7+
8+
var clientKey string
9+
10+
func init() {
11+
clientKey = os.Getenv("NEXT_CAPTCHA_CLIENT_KEY")
12+
}
13+
14+
func TestReCaptchaV2Task(t *testing.T) {
15+
16+
api := NewNextCaptchaAPI(clientKey, "", "", true)
17+
api.RecaptchaV2("https://google.com", "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-", RecaptchaV2Options{})
18+
api.HCaptcha("https://accounts.hcaptcha.com/demo", "a5f74b19-9e45-40e0-b45d-47ff91b7a6c2", HCaptchaOptions{})
19+
api.FunCaptcha("2F1CD804-FE45-F12B-9723-240962EBA6F8", FunCaptchaOptions{Data: `{"blob":"Aevp3tBIkq8erBvyuXaLZQ==.nQfRqZK25AY+SSk3q4cOPmx7p11SDLbASdijSKZ6b2QFm1grgzyW8bUJcEUIruK6NkfX5xwQdtlZOsJY0AhbaVYx0ZNK5i1QCtf7q3zG+v55pUqiFXEDkSddKqnYH4zqHtwk5YWIiFFShWkhvBHs6Y4gtmvAX92kH7oDwgWRqqZawaysrDn3BUfaHGFSWlubD/ifXpYI0SvGqdTrtzMbV1tNQ8NxM2UOUZ57O5uvCwbJtNRdjEMhL7pYrFUokKe0nMzcmPJsPKnH8IXmEbPkaVEUWDZcXiZGziupAonHz0yd"}`})
20+
}

0 commit comments

Comments
 (0)
Please sign in to comment.