Skip to content

Commit 680d2f8

Browse files
NEW added task captcha
1 parent 465de1d commit 680d2f8

File tree

5 files changed

+100
-1
lines changed

5 files changed

+100
-1
lines changed

example/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
else if (cType === 'capy') capy()
3434
else if (cType === 'tiktok') tiktok()
3535
else if (cType === 'funcaptcha') funcaptcha()
36+
else if (cType === 'task') task()
3637
else log(`Unknown captcha type: ${cType}`)
3738
}
3839
</script>
@@ -50,6 +51,7 @@
5051
<option value="capy">Capy (examples/capy.js)</option>
5152
<option value="tiktok">Tiktok (examples/tiktok.js)</option>
5253
<option value="funcaptcha">FunCaptcha (examples/funcaptcha.js)</option>
54+
<option value="task">Task (examples/task.js)</option>
5355
</select>
5456
<button onclick="run()">Run example</button>
5557
<!-- Load jQuery (dependency) -->
@@ -65,5 +67,6 @@
6567
<script src="hcaptcha.js"></script>
6668
<script src="tiktok.js"></script>
6769
<script src="funcaptcha.js"></script>
70+
<script src="task.js"></script>
6871
</body>
6972
</html>

example/task.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// task parameters
2+
var task_params = {}
3+
task_params.template_name = 'Login test page'
4+
task_params.page_url = 'https://imagetyperz.net/automation/login'
5+
task_params.variables = {username: 'abc', password: 'paZZW0rd'}
6+
// task_params.proxy = '126.45.34.53:123'; // optional
7+
// task_params.user_agent = 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0'; // optional
8+
9+
async function task() {
10+
try {
11+
// clear log box
12+
document.getElementById('log').value = '';
13+
// authenticate with token
14+
imagetyperzapi.set_access_key(document.getElementById('token').value);
15+
// get account balance
16+
const balance = await imagetyperzapi.account_balance()
17+
log('Balance: $' + balance); // print balance gathered
18+
const captchaID = await imagetyperzapi.submit_task(task_params)
19+
// solve captcha
20+
log('Waiting for captcha to be solved ...');
21+
const response = await imagetyperzapi.retrieve_response(captchaID)
22+
log(`Response: ${JSON.stringify(response)}`)
23+
} catch (err) {
24+
log(`Error: ${err.message || err}`)
25+
} finally {
26+
log('Example finished !')
27+
}
28+
}

lib/imagetyperz-api-client.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ window.imagetyperz_config = {
1616
HCAPTCHA_ENDPOINT: 'http://captchatypers.com/captchaapi/UploadHCaptchaUser.ashx',
1717
TIKTOK_ENDPOINT: 'http://captchatypers.com/captchaapi/UploadTikTokCaptchaUser.ashx',
1818
FUNCAPTCHA_ENDPOINT: 'http://captchatypers.com/captchaapi/UploadFunCaptcha.ashx',
19+
TASK_ENDPOINT: 'http://captchatypers.com/captchaapi/UploadCaptchaTask.ashx',
1920

2021
CAPTCHA_ENDPOINT_CONTENT_TOKEN: 'http://captchatypers.com/Forms/UploadFileAndGetTextNEWToken.ashx',
2122
CAPTCHA_ENDPOINT_URL_TOKEN: 'http://captchatypers.com/Forms/FileUploadAndGetTextCaptchaURLToken.ashx',
@@ -459,6 +460,53 @@ imagetyperzapi.submit_funcaptcha = function (d) {
459460
});
460461
};
461462

463+
imagetyperzapi.submit_task = function (d) {
464+
var ic = imagetyperz_config; // get config obj
465+
return new Promise((resolve, reject) => {
466+
var page_url = d.page_url;
467+
var proxy = d.proxy;
468+
var data = {};
469+
if (ic.username && ic.password) {
470+
// legacy auth
471+
data['username'] = ic.username;
472+
data['password'] = ic.password;
473+
}
474+
else {
475+
data['token'] = ic.access_key; // token auth
476+
}
477+
478+
// check for proxy
479+
if (proxy) {
480+
data['proxy'] = proxy;
481+
data['proxytype'] = 'HTTP';
482+
}
483+
484+
// add rest of params
485+
data['action'] = 'UPLOADCAPTCHA';
486+
data['captchatype'] = 16
487+
data['pageurl'] = page_url;
488+
data['sitekey'] = '123';
489+
data.template_name = d.template_name
490+
if (d.variables) {
491+
data.variables = JSON.stringify(d.variables)
492+
}
493+
494+
// check for affiliate id
495+
if (ic.affiliate_id) data['affiliateid'] = ic.affiliate_id;
496+
497+
// user agent
498+
if(d.user_agent) data.useragent = d.user_agent;
499+
// make post request
500+
$.post(ic.endpoints.TASK_ENDPOINT, data).done(function (resp) {
501+
// check for error
502+
if (resp.indexOf('ERROR:') !== -1) return reject(resp);
503+
return resolve(JSON.parse(resp)[0].CaptchaId);
504+
}).fail(function (err) {
505+
return reject(err);
506+
});
507+
});
508+
};
509+
462510
// retrieve recaptcha
463511
imagetyperzapi.retrieve_response = function (captcha_id) {
464512
var ic = imagetyperz_config; // get config obj

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "imagetyperz-api-client",
3-
"version": "1.2.7",
3+
"version": "1.2.8",
44
"description": "ImagetyperzAPI (client) is a super easy to use bypass captcha API wrapper for imagetyperz.com captcha service",
55
"main": "lib/imagetyperz-api-client.js",
66
"scripts": {

readme.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,26 @@ captcha_params.s_url = 'https://api.arkoselabs.com'
219219
const captchaID = await imagetyperzapi.submit_funcaptcha(captcha_params)
220220
```
221221

222+
### Task
223+
224+
Requires template_name, page_url and variables
225+
226+
```javascript
227+
var captcha_params = {};
228+
captcha_params = {
229+
'template_name': 'Login test page',
230+
'page_url': 'https://imagetyperz.net/automation/login',
231+
'variables': {"username": 'abc', "password": 'paZZW0rd'},
232+
// 'proxy': '126.45.34.53:345', # or 126.45.34.53:123:joe:password
233+
// 'user_agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0', # optional
234+
}
235+
// captcha_params.proxy = '126.45.34.53:123'; // optional
236+
// captcha_params.user_agent = 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0'; // optional
237+
const captchaID = await imagetyperzapi.submit_task(captcha_params)
238+
```
239+
240+
241+
222242
## Retrieve response
223243

224244
Regardless of the captcha type (and method) used in submission of the captcha, this method is used

0 commit comments

Comments
 (0)