forked from chrisli30/anticaptcha-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_proxyless.js
41 lines (33 loc) · 1.14 KB
/
example_proxyless.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
// http module should be installed:
// npm i http
// Params:
// your anti-captcha.com account key
var anticaptcha = require('./anticaptcha')('12345678901234567890123456789012');
//recaptcha key from target website
anticaptcha.setWebsiteURL("http://mywebsite.com/recaptcha/test.php");
anticaptcha.setWebsiteKey("sitekey-can-be-taken-from-div.g-recaptcha-element");
//browser header parameters
anticaptcha.setUserAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116");
// check balance first
anticaptcha.getBalance(function (err, balance) {
if (err) {
console.error(err);
return;
}
if (balance > 0) {
anticaptcha.createTaskProxyless(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);
});
});
}
});