-
Notifications
You must be signed in to change notification settings - Fork 5
/
geetestV4.js
executable file
·36 lines (29 loc) · 1.22 KB
/
geetestV4.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
#!/usr/bin/node
// require library
var imagetyperzapi = require('../');
// get access token from: http://www.imagetyperz.com/Forms/ClientHome.aspx
const ACCESS_KEY = 'access_token_here';
imagetyperzapi.set_access_key(ACCESS_KEY);
async function test_api() {
var captcha_params = {};
captcha_params.domain = 'https://example.com';
captcha_params.geetestid = '647f5ed2ed8acb4be36784e01556bb71';
// captcha_params.proxy = '126.45.34.53:123'; // optional
// captcha_params.user_agent = 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0'; // optional
// get balance
const balance = await imagetyperzapi.account_balance();
console.log('Balance:', balance); // print balance gathered
// solve captcha
const captchaID = await imagetyperzapi.submit_geetest_v4(captcha_params);
console.log('Waiting for captcha to be solved ...');
const response = await imagetyperzapi.retrieve_response(captchaID) // wait for response to get solved
console.log(`Response: ${JSON.stringify(response)}`)
}
async function main () {
try {
await test_api()
} catch (err) {
console.log(`Error: ${err.message || err}`)
}
}
main()