diff --git a/README.md b/README.md index 0559ab0..9129abc 100644 --- a/README.md +++ b/README.md @@ -748,6 +748,7 @@ This method can be used to solve Altcha captcha. Returns a token. solver.altcha({ pageurl: "https://mysite.com/page/with/altcha", challenge_url: "https://example/altcha", + challenge_json: '{"algorithm":"SHA-256","challenge":"a4c9d8e7f1b23a6c...",..."signature":"7b3e2a9d5c8f1046e2d91c3a..."}' }) .then((res) => { console.log(res); diff --git a/examples/altcha.js b/examples/altcha.js index 13e5b55..d07c09e 100644 --- a/examples/altcha.js +++ b/examples/altcha.js @@ -6,11 +6,11 @@ const solver = new TwoCaptcha.Solver(APIKEY); solver.altcha({ pageurl: "https://mysite.com/page/with/altcha", challenge_url: "https://example/altcha", - // challenge_json: '{"algorithm":"SHA-256","challenge":"a4c9d8e7f1b23a6c...",..."signature":"7b3e2a9d5c8f1046e2d91c3a..."}' + challenge_json: '{"algorithm":"SHA-256","challenge":"a4c9d8e7f1b23a6c...",..."signature":"7b3e2a9d5c8f1046e2d91c3a..."}' }) .then((res) => { console.log(res); }) .catch((err) => { console.log(err); -}) \ No newline at end of file +}) diff --git a/src/structs/2captcha.ts b/src/structs/2captcha.ts index 41d36e0..33dd4ee 100644 --- a/src/structs/2captcha.ts +++ b/src/structs/2captcha.ts @@ -2160,8 +2160,8 @@ public async temu(params: paramsTemu): Promise { * * @param {{ pageurl, challenge_url, challenge_json, proxy, proxytype}} params Parameters Altcha as an object. * @param {string} params.pageurl Full URL of the page where you solve the captcha. - * @param {string} params.challenge_url The value of the 'challenge_url' parameter for the 'altcha-widget' element containing the captcha on the page. You can send either challenge_url or challenge_json parameter, but not two of it simultaneously. - * @param {string} params.challenge_json The contents of the file from the 'challenge_url' parameter. You can send either challenge_url or challenge_json parameter, but not two of it simultaneously. + * @param {string} params.challenge_url The value of the 'challenge_url' parameter for the 'altcha-widget' element containing the captcha on the page. + * @param {string} params.challenge_json The contents of the file from the 'challenge_url' parameter. * @param {string} params.proxy Format: `login:password@123.123.123.123:3128` You can find more info about proxies [here](https://2captcha.com/2captcha-api#proxies). * @param {string} params.proxytype Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`. * @@ -2169,6 +2169,7 @@ public async temu(params: paramsTemu): Promise { * solver.altcha({ * pageurl: "https://mysite.com/page/with/altcha", * challenge_url: "https://example/altcha", + * challenge_json: '{"algorithm":"SHA-256","challenge":"a4c9d8e7f1b23a6c...",..."signature":"7b3e2a9d5c8f1046e2d91c3a..."}' * }) * .then((res) => { * console.log(res); diff --git a/src/utils/checkCaptchaParams.ts b/src/utils/checkCaptchaParams.ts index 8d0cfde..52933b7 100644 --- a/src/utils/checkCaptchaParams.ts +++ b/src/utils/checkCaptchaParams.ts @@ -180,23 +180,6 @@ export default function checkCaptchaParams(params: Object, method: string) { } }) - if(method === "altcha") { - const hasChallengeUrl = params.hasOwnProperty('challenge_url') - const hasChallengeJson = params.hasOwnProperty('challenge_json') - - if(!hasChallengeUrl && !hasChallengeJson) { - isCorrectCaptchaParams = false - throw new Error(`Error when check params captcha.\nNot found "challenge_url" or "challenge_json" field in the Object. One of this field is required for "${method}" method. Please add field "challenge_url" or "challenge_json" to captcha parameters.`) - } - - if(hasChallengeUrl && hasChallengeJson) { - isCorrectCaptchaParams = false - throw new Error(`Error when check params captcha.\nYou must provide exactly one of "challenge_url" or "challenge_json" for "${method}" method.`) - } - - isCorrectCaptchaParams = true - } - //The parameters `textinstructions` and `imginstructions` are mandatory for the methods `bounding_box`, `grid`, and `canvas`. if(method === "bounding_box" || method === "grid" || method === "canvas") { if(params.hasOwnProperty('textinstructions') || params.hasOwnProperty('imginstructions')) {