forked from chrisli30/anticaptcha-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_custom_captcha.js
74 lines (66 loc) · 2.01 KB
/
example_custom_captcha.js
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
// http module should be installed:
// npm i http
// Params:
// your anti-captcha.com account key
var anticaptcha = require('./anticaptcha')('12345678901234567890123456789012');
// check balance first
anticaptcha.getBalance(function (err, balance) {
if (err) {
console.error(err);
return;
}
anticaptcha.setImageUrl("https://files.anti-captcha.com/26/41f/c23/7c50ff19.jpg?random=" + Math.random());
anticaptcha.setAssignment("Enter license plate number");
anticaptcha.setForms([
{
label: "Number",
labelHint: false,
contentType: false,
name: "license_plate",
inputType: "text",
inputOptions: {
width: "100",
placeHolder: "Enter a letters and number without spaces"
}
},
{
label: "Car color",
labelHint: "Select car color",
contentType: false,
name: "color",
inputType: "select",
inputOptions: [
{
value: "white",
caption: "White color"
},
{
value: "black",
caption: "Black color"
},
{
value: "grey",
caption: "Grey color"
}
]
}
]);
if (balance > 0) {
anticaptcha.createCustomCaptchaTask(
function (err, taskId) {
if (err) {
console.error(err);
return;
}
console.log(taskId);
anticaptcha.getTaskSolution(taskId, function (err, taskSolution) {
if (err) {
console.error(err);
return;
}
console.log(taskSolution);
});
}
);
}
});