From 4a6c2576db7fe85f7e23cc00cf964ce51fbb9e65 Mon Sep 17 00:00:00 2001 From: dzmitry-duboyski Date: Mon, 13 May 2024 11:50:43 +0400 Subject: [PATCH 1/4] add info about proxy --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 1ae2cc9..03c4cd9 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ The easiest way to quickly integrate [2Captcha] into your code to automate solvi - [send / getResult](#send--getresult) - [balance](#balance) - [report](#report) + - [proxies](#proxies) - [Error handling](#error-handling) @@ -355,6 +356,16 @@ solver.report(captcha.getId(), true); // captcha solved correctly solver.report(captcha.getId(), false); // captcha solved incorrectly ``` +### Proxies +You can pass your proxy as an additional argument for methods: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha, keycaptcha, capy puzzle, lemin, turnstile, amazon waf and etc. The proxy will be forwarded to the API to solve the captcha. + +We have our own proxies that we can offer you. [Buy residential proxies](https://2captcha.com/proxy/residential-proxies) for avoid restrictions and blocks. [Quick start](https://2captcha.com/proxy?openAddTrafficModal=true). + +```java +captcha.setProxy("HTTPS", "login:password@IP_address:PORT"); +``` + + ## Error handling If case of an error captcha solver throws an exception. It's important to properly handle these cases. We recommend to use `try catch` to handle exceptions. From 0c15680288874e9ba588bfa776f4e4ad570b9ae3 Mon Sep 17 00:00:00 2001 From: dzmitry-duboyski Date: Mon, 13 May 2024 11:53:06 +0400 Subject: [PATCH 2/4] add 2captcha softId --- src/main/java/com/twocaptcha/TwoCaptcha.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/twocaptcha/TwoCaptcha.java b/src/main/java/com/twocaptcha/TwoCaptcha.java index b3bc50a..9a042db 100644 --- a/src/main/java/com/twocaptcha/TwoCaptcha.java +++ b/src/main/java/com/twocaptcha/TwoCaptcha.java @@ -25,7 +25,7 @@ public class TwoCaptcha { * ID of software developer. Developers who integrated their software * with our service get reward: 10% of spendings of their software users. */ - private int softId; + private int softId = 4581; /** * URL to which the result will be sent From d4c1af2711f67da29d1768a5e9d49b303691571b Mon Sep 17 00:00:00 2001 From: dzmitry-duboyski Date: Mon, 13 May 2024 13:36:35 +0400 Subject: [PATCH 3/4] update README.md --- README.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 03c4cd9..b2a042b 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,9 @@ The easiest way to quickly integrate [2Captcha] into your code to automate solvi - [send / getResult](#send--getresult) - [balance](#balance) - [report](#report) - - [proxies](#proxies) + - [Proxies](#proxies) - [Error handling](#error-handling) + - [Useful links](#useful-links) ## Installation @@ -356,7 +357,7 @@ solver.report(captcha.getId(), true); // captcha solved correctly solver.report(captcha.getId(), false); // captcha solved incorrectly ``` -### Proxies +## Proxies You can pass your proxy as an additional argument for methods: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha, keycaptcha, capy puzzle, lemin, turnstile, amazon waf and etc. The proxy will be forwarded to the API to solve the captcha. We have our own proxies that we can offer you. [Buy residential proxies](https://2captcha.com/proxy/residential-proxies) for avoid restrictions and blocks. [Quick start](https://2captcha.com/proxy?openAddTrafficModal=true). @@ -382,10 +383,13 @@ try { // captcha is not solved so far } ``` -[Maven Central]: https://search.maven.org/artifact/com.github.2captcha/2captcha-java -[examples directory]: /src/main/java/examples -[2Captcha]: https://2captcha.com/ -[2captcha sofware catalog]: https://2captcha.com/software -[pingback settings]: https://2captcha.com/setting/pingback -[post options]: https://2captcha.com/2captcha-api#normal_post -[list of supported languages]: https://2captcha.com/2captcha-api#language + +## Useful links + +- [Maven Central](https://search.maven.org/artifact/com.github.2captcha/2captcha-java) +- [Examples directory](./src/main/java/examples) +- [2Captcha](https://2captcha.com/) +- [2captcha sofware catalog](https://2captcha.com/software) +- [Pingback settings](https://2captcha.com/setting/pingback) +- [Post options](https://2captcha.com/2captcha-api#normal_post) +- [List of supported languages](https://2captcha.com/2captcha-api#language) From ede6df4572e03b6ace8337f847403c805fdc762e Mon Sep 17 00:00:00 2001 From: dzmitry-duboyski Date: Mon, 13 May 2024 15:54:10 +0400 Subject: [PATCH 4/4] update tests --- src/test/java/com/twocaptcha/AmazonWafTest.java | 1 + src/test/java/com/twocaptcha/AudioTest.java | 1 + src/test/java/com/twocaptcha/CanvasTest.java | 3 +++ src/test/java/com/twocaptcha/CapyTest.java | 1 + src/test/java/com/twocaptcha/CoordinatesTest.java | 4 ++++ src/test/java/com/twocaptcha/FunCaptchaTest.java | 1 + src/test/java/com/twocaptcha/GeeTestTest.java | 1 + src/test/java/com/twocaptcha/GeeTestV4Test.java | 1 + src/test/java/com/twocaptcha/GridTest.java | 4 ++++ src/test/java/com/twocaptcha/HCaptchaTest.java | 1 + src/test/java/com/twocaptcha/KeyCaptchaTest.java | 1 + src/test/java/com/twocaptcha/LeminTest.java | 1 + src/test/java/com/twocaptcha/NormalTest.java | 4 ++++ src/test/java/com/twocaptcha/ReCaptchaTest.java | 2 ++ src/test/java/com/twocaptcha/RotateTest.java | 1 + src/test/java/com/twocaptcha/TextTest.java | 3 +++ src/test/java/com/twocaptcha/TurnstileTest.java | 1 + src/test/java/com/twocaptcha/YandexTest.java | 1 + 18 files changed, 32 insertions(+) diff --git a/src/test/java/com/twocaptcha/AmazonWafTest.java b/src/test/java/com/twocaptcha/AmazonWafTest.java index 9c17593..5d51fcf 100644 --- a/src/test/java/com/twocaptcha/AmazonWafTest.java +++ b/src/test/java/com/twocaptcha/AmazonWafTest.java @@ -20,6 +20,7 @@ public void testAllOptions() throws Exception { params.put("pageurl", "https://non-existent-example.execute-api.us-east-1.amazonaws.com"); params.put("iv", "test_iv"); params.put("context", "test_context"); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); } diff --git a/src/test/java/com/twocaptcha/AudioTest.java b/src/test/java/com/twocaptcha/AudioTest.java index 158fa52..4f18df3 100644 --- a/src/test/java/com/twocaptcha/AudioTest.java +++ b/src/test/java/com/twocaptcha/AudioTest.java @@ -24,6 +24,7 @@ public void testAllParameters() throws Exception { params.put("method", "audio"); params.put("lang", "ru"); params.put("body", base64EncodedImage); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); diff --git a/src/test/java/com/twocaptcha/CanvasTest.java b/src/test/java/com/twocaptcha/CanvasTest.java index dd37b50..63d27ec 100644 --- a/src/test/java/com/twocaptcha/CanvasTest.java +++ b/src/test/java/com/twocaptcha/CanvasTest.java @@ -24,6 +24,7 @@ public void testSingleFile() throws Exception { params.put("recaptcha", "1"); params.put("canvas", "1"); params.put("textinstructions", hintText); + params.put("soft_id", "4581"); Map files = new HashMap<>(); files.put("file", image); @@ -42,6 +43,7 @@ public void testBase64() throws Exception { params.put("canvas", "1"); params.put("body", "..."); params.put("textinstructions", hintText); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); } @@ -66,6 +68,7 @@ public void testAllParameters() throws Exception { params.put("can_no_answer", "0"); params.put("lang", "en"); params.put("textinstructions", hintText); + params.put("soft_id", "4581"); Map files = new HashMap<>(); files.put("file", image); diff --git a/src/test/java/com/twocaptcha/CapyTest.java b/src/test/java/com/twocaptcha/CapyTest.java index b36ad7e..e6ea994 100644 --- a/src/test/java/com/twocaptcha/CapyTest.java +++ b/src/test/java/com/twocaptcha/CapyTest.java @@ -18,6 +18,7 @@ public void testAllOptions() throws Exception { params.put("captchakey", "PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v"); params.put("pageurl", "http://mysite.com/"); params.put("api_server","https://myapiserver.com/"); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); } diff --git a/src/test/java/com/twocaptcha/CoordinatesTest.java b/src/test/java/com/twocaptcha/CoordinatesTest.java index 8df4c82..48c7fef 100644 --- a/src/test/java/com/twocaptcha/CoordinatesTest.java +++ b/src/test/java/com/twocaptcha/CoordinatesTest.java @@ -20,6 +20,7 @@ public void testSingleFile() throws Exception { Map params = new HashMap<>(); params.put("method", "post"); params.put("coordinatescaptcha", "1"); + params.put("soft_id", "4581"); Map files = new HashMap<>(); files.put("file", image); @@ -36,6 +37,7 @@ public void testSingleFileParameter() throws Exception { Map params = new HashMap<>(); params.put("method", "post"); params.put("coordinatescaptcha", "1"); + params.put("soft_id", "4581"); Map files = new HashMap<>(); files.put("file", image); @@ -51,6 +53,7 @@ public void testBase64() throws Exception { params.put("method", "base64"); params.put("coordinatescaptcha", "1"); params.put("body", "..."); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); } @@ -70,6 +73,7 @@ public void testAllParameters() throws Exception { params.put("coordinatescaptcha", "1"); params.put("lang", "en"); params.put("textinstructions", hintText); + params.put("soft_id", "4581"); Map files = new HashMap<>(); files.put("file", image); diff --git a/src/test/java/com/twocaptcha/FunCaptchaTest.java b/src/test/java/com/twocaptcha/FunCaptchaTest.java index 4fa8ced..c6b47c1 100644 --- a/src/test/java/com/twocaptcha/FunCaptchaTest.java +++ b/src/test/java/com/twocaptcha/FunCaptchaTest.java @@ -22,6 +22,7 @@ public void testAllOptions() throws Exception { params.put("surl", "https://client-api.arkoselabs.com"); params.put("userAgent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"); params.put("data[anyKey]", "anyStringValue"); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); } diff --git a/src/test/java/com/twocaptcha/GeeTestTest.java b/src/test/java/com/twocaptcha/GeeTestTest.java index ed4fb89..0b90153 100644 --- a/src/test/java/com/twocaptcha/GeeTestTest.java +++ b/src/test/java/com/twocaptcha/GeeTestTest.java @@ -20,6 +20,7 @@ public void testAllOptions() throws Exception { params.put("api_server", "api-na.geetest.com"); params.put("challenge", "69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC"); params.put("pageurl", "https://launches.endclothing.com/distil_r_captcha.html"); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); } diff --git a/src/test/java/com/twocaptcha/GeeTestV4Test.java b/src/test/java/com/twocaptcha/GeeTestV4Test.java index 2c2a6b8..e70ce35 100644 --- a/src/test/java/com/twocaptcha/GeeTestV4Test.java +++ b/src/test/java/com/twocaptcha/GeeTestV4Test.java @@ -20,6 +20,7 @@ public void testAllOptions() throws Exception { params.put("api_server", "api-na.geetest.com"); params.put("challenge", "12345678abc90123d45678ef90123a456b"); params.put("pageurl", "https://mysite.com/captcha.html"); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); } diff --git a/src/test/java/com/twocaptcha/GridTest.java b/src/test/java/com/twocaptcha/GridTest.java index 3b9c395..926e262 100644 --- a/src/test/java/com/twocaptcha/GridTest.java +++ b/src/test/java/com/twocaptcha/GridTest.java @@ -19,6 +19,7 @@ public void testSingleFile() throws Exception { Map params = new HashMap<>(); params.put("method", "post"); + params.put("soft_id", "4581"); Map files = new HashMap<>(); files.put("file", image); @@ -34,6 +35,7 @@ public void testSingleFileParameter() throws Exception { Map params = new HashMap<>(); params.put("method", "post"); + params.put("soft_id", "4581"); Map files = new HashMap<>(); files.put("file", image); @@ -48,6 +50,7 @@ public void testBase64() throws Exception { Map params = new HashMap<>(); params.put("method", "base64"); params.put("body", "..."); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); } @@ -74,6 +77,7 @@ public void testAllParameters() throws Exception { params.put("can_no_answer", "0"); params.put("lang", "en"); params.put("textinstructions", hintText); + params.put("soft_id", "4581"); Map files = new HashMap<>(); files.put("file", image); diff --git a/src/test/java/com/twocaptcha/HCaptchaTest.java b/src/test/java/com/twocaptcha/HCaptchaTest.java index e2b4d88..601013c 100644 --- a/src/test/java/com/twocaptcha/HCaptchaTest.java +++ b/src/test/java/com/twocaptcha/HCaptchaTest.java @@ -16,6 +16,7 @@ public void testAllOptions() throws Exception { params.put("method", "hcaptcha"); params.put("sitekey", "f1ab2cdefa3456789012345b6c78d90e"); params.put("pageurl", "https://www.site.com/page/"); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); } diff --git a/src/test/java/com/twocaptcha/KeyCaptchaTest.java b/src/test/java/com/twocaptcha/KeyCaptchaTest.java index bd4a402..9e58128 100644 --- a/src/test/java/com/twocaptcha/KeyCaptchaTest.java +++ b/src/test/java/com/twocaptcha/KeyCaptchaTest.java @@ -22,6 +22,7 @@ public void testAllOptions() throws Exception { params.put("s_s_c_web_server_sign", "9006dc725760858e4c0715b835472f22-pz-"); params.put("s_s_c_web_server_sign2", "2ca3abe86d90c6142d5571db98af6714"); params.put("pageurl", "https://www.keycaptcha.ru/demo-magnetic/"); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); } diff --git a/src/test/java/com/twocaptcha/LeminTest.java b/src/test/java/com/twocaptcha/LeminTest.java index 325dec5..85d0fc2 100644 --- a/src/test/java/com/twocaptcha/LeminTest.java +++ b/src/test/java/com/twocaptcha/LeminTest.java @@ -19,6 +19,7 @@ public void testAllOptions() throws Exception { params.put("captcha_id", "CROPPED_d3d4d56_73ca4008925b4f83a8bed59c2dd0df6d"); params.put("pageurl", "http://sat2.aksigorta.com.tr"); params.put("api_server", "api.leminnow.com"); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); } diff --git a/src/test/java/com/twocaptcha/NormalTest.java b/src/test/java/com/twocaptcha/NormalTest.java index 5423c86..39d9fb0 100644 --- a/src/test/java/com/twocaptcha/NormalTest.java +++ b/src/test/java/com/twocaptcha/NormalTest.java @@ -19,6 +19,7 @@ public void testSingleFile() throws Exception { Map params = new HashMap<>(); params.put("method", "post"); + params.put("soft_id", "4581"); Map files = new HashMap<>(); files.put("file", image); @@ -35,6 +36,7 @@ public void testSingleFileParameter() throws Exception { Map params = new HashMap<>(); params.put("method", "post"); + params.put("soft_id", "4581"); Map files = new HashMap<>(); files.put("file", image); @@ -49,6 +51,7 @@ public void testBase64() throws Exception { Map params = new HashMap<>(); params.put("method", "base64"); params.put("body", "..."); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); } @@ -79,6 +82,7 @@ public void testAllParameters() throws Exception { params.put("calc", "0"); params.put("lang", "en"); params.put("textinstructions", hintText); + params.put("soft_id", "4581"); Map files = new HashMap<>(); files.put("file", image); diff --git a/src/test/java/com/twocaptcha/ReCaptchaTest.java b/src/test/java/com/twocaptcha/ReCaptchaTest.java index f784cb9..4da0a02 100644 --- a/src/test/java/com/twocaptcha/ReCaptchaTest.java +++ b/src/test/java/com/twocaptcha/ReCaptchaTest.java @@ -22,6 +22,7 @@ public void testV2() throws Exception { params.put("invisible", "1"); params.put("enterprise", "1"); params.put("action", "verify"); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); } @@ -43,6 +44,7 @@ public void testV3() throws Exception { params.put("enterprise", "1"); params.put("action", "verify"); params.put("min_score", "0.3"); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); } diff --git a/src/test/java/com/twocaptcha/RotateTest.java b/src/test/java/com/twocaptcha/RotateTest.java index 23a65a7..68621cb 100644 --- a/src/test/java/com/twocaptcha/RotateTest.java +++ b/src/test/java/com/twocaptcha/RotateTest.java @@ -30,6 +30,7 @@ public void testAllParameters() throws Exception { params.put("lang", "en"); params.put("textinstructions", "Put the images in the correct way up"); params.put("body", base64EncodedImage); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); diff --git a/src/test/java/com/twocaptcha/TextTest.java b/src/test/java/com/twocaptcha/TextTest.java index 665484b..4796d57 100644 --- a/src/test/java/com/twocaptcha/TextTest.java +++ b/src/test/java/com/twocaptcha/TextTest.java @@ -15,6 +15,7 @@ public void testSimpleText() throws Exception { Map params = new HashMap<>(); params.put("method", "post"); params.put("textcaptcha", question); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); } @@ -26,6 +27,7 @@ public void testTextParameter() throws Exception { Map params = new HashMap<>(); params.put("method", "post"); params.put("textcaptcha", question); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); } @@ -39,6 +41,7 @@ public void testAllParameters() throws Exception { params.put("method", "post"); params.put("textcaptcha", question); params.put("lang", "en"); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); } diff --git a/src/test/java/com/twocaptcha/TurnstileTest.java b/src/test/java/com/twocaptcha/TurnstileTest.java index fa951d6..7266193 100644 --- a/src/test/java/com/twocaptcha/TurnstileTest.java +++ b/src/test/java/com/twocaptcha/TurnstileTest.java @@ -16,6 +16,7 @@ public void testAllOptions() throws Exception { params.put("method", "turnstile"); params.put("sitekey", "0x4AAAAAAAChNiVJM_WtShFf"); params.put("pageurl", "https://ace.fusionist.io"); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); } diff --git a/src/test/java/com/twocaptcha/YandexTest.java b/src/test/java/com/twocaptcha/YandexTest.java index dedbb22..9795907 100644 --- a/src/test/java/com/twocaptcha/YandexTest.java +++ b/src/test/java/com/twocaptcha/YandexTest.java @@ -16,6 +16,7 @@ public void testAllOptions() throws Exception { params.put("method", "yandex"); params.put("sitekey", "Y5Lh0tiycconMJGsFd3EbbuNKSp1yaZESUOIHfeV"); params.put("pageurl", "https://rutube.ru"); + params.put("soft_id", "4581"); checkIfCorrectParamsSendAndResultReturned(captcha, params); }