Skip to content

Commit 29df604

Browse files
Add Grid examples
1 parent f41153c commit 29df604

File tree

5 files changed

+44
-0
lines changed

5 files changed

+44
-0
lines changed

examples/grid.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const TwoCaptcha = require("../dist/index.js");
2+
require('dotenv').config();
3+
const APIKEY = process.env.APIKEY
4+
const solver = new TwoCaptcha.Solver(APIKEY);
5+
const fs = require('fs')
6+
const imageBase64 = fs.readFileSync("./media/recaptchaGrid3x3.jpg", "base64")
7+
8+
solver.grid({
9+
body: imageBase64,
10+
textinstructions: "Select cars in the image"
11+
})
12+
.then((res) => {
13+
console.log(res);
14+
})
15+
.catch((err) => {
16+
console.log(err);
17+
})

examples/grid_options.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const TwoCaptcha = require("../dist/index.js");
2+
require("dotenv").config();
3+
const APIKEY = process.env.APIKEY;
4+
const solver = new TwoCaptcha.Solver(APIKEY);
5+
const fs = require("fs");
6+
const imageBase64 = fs.readFileSync("./media/recaptchaGrid4x4.jpg", "base64");
7+
const imageInstructionsBase64 = fs.readFileSync("./media/recaptchaGridImginstructions4x4.jpg", "base64");
8+
9+
solver.grid({
10+
body: imageBase64,
11+
textinstructions: "Select all squares with stairs",
12+
imginstructions: imageInstructionsBase64,
13+
cols: 4,
14+
rows: 4,
15+
minClicks: 2,
16+
maxClicks: 6,
17+
lang: "en",
18+
canSkip: 1,
19+
// pingback: '123.123.123.123' /* More info about pingback https://2captcha.com/setting/pingback */
20+
// previousId: '123456789'
21+
})
22+
.then((res) => {
23+
console.log(res);
24+
})
25+
.catch((err) => {
26+
console.log(err);
27+
});

examples/media/recaptchaGrid3x3.jpg

65.4 KB
Loading

examples/media/recaptchaGrid4x4.jpg

351 KB
Loading
Loading

0 commit comments

Comments
 (0)