Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +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)
- [Error handling](#error-handling)
- [Useful links](#useful-links)


## Installation
Expand Down Expand Up @@ -355,6 +357,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.

Expand All @@ -371,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)
2 changes: 1 addition & 1 deletion src/main/java/com/twocaptcha/TwoCaptcha.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/twocaptcha/AmazonWafTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/twocaptcha/AudioTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions src/test/java/com/twocaptcha/CanvasTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, File> files = new HashMap<>();
files.put("file", image);
Expand All @@ -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);
}
Expand All @@ -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<String, File> files = new HashMap<>();
files.put("file", image);
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/twocaptcha/CapyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/com/twocaptcha/CoordinatesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public void testSingleFile() throws Exception {
Map<String, String> params = new HashMap<>();
params.put("method", "post");
params.put("coordinatescaptcha", "1");
params.put("soft_id", "4581");

Map<String, File> files = new HashMap<>();
files.put("file", image);
Expand All @@ -36,6 +37,7 @@ public void testSingleFileParameter() throws Exception {
Map<String, String> params = new HashMap<>();
params.put("method", "post");
params.put("coordinatescaptcha", "1");
params.put("soft_id", "4581");

Map<String, File> files = new HashMap<>();
files.put("file", image);
Expand All @@ -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);
}
Expand All @@ -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<String, File> files = new HashMap<>();
files.put("file", image);
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/twocaptcha/FunCaptchaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/twocaptcha/GeeTestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/twocaptcha/GeeTestV4Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/com/twocaptcha/GridTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public void testSingleFile() throws Exception {

Map<String, String> params = new HashMap<>();
params.put("method", "post");
params.put("soft_id", "4581");

Map<String, File> files = new HashMap<>();
files.put("file", image);
Expand All @@ -34,6 +35,7 @@ public void testSingleFileParameter() throws Exception {

Map<String, String> params = new HashMap<>();
params.put("method", "post");
params.put("soft_id", "4581");

Map<String, File> files = new HashMap<>();
files.put("file", image);
Expand All @@ -48,6 +50,7 @@ public void testBase64() throws Exception {
Map<String, String> params = new HashMap<>();
params.put("method", "base64");
params.put("body", "...");
params.put("soft_id", "4581");

checkIfCorrectParamsSendAndResultReturned(captcha, params);
}
Expand All @@ -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<String, File> files = new HashMap<>();
files.put("file", image);
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/twocaptcha/HCaptchaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/twocaptcha/KeyCaptchaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/twocaptcha/LeminTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/com/twocaptcha/NormalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public void testSingleFile() throws Exception {

Map<String, String> params = new HashMap<>();
params.put("method", "post");
params.put("soft_id", "4581");

Map<String, File> files = new HashMap<>();
files.put("file", image);
Expand All @@ -35,6 +36,7 @@ public void testSingleFileParameter() throws Exception {

Map<String, String> params = new HashMap<>();
params.put("method", "post");
params.put("soft_id", "4581");

Map<String, File> files = new HashMap<>();
files.put("file", image);
Expand All @@ -49,6 +51,7 @@ public void testBase64() throws Exception {
Map<String, String> params = new HashMap<>();
params.put("method", "base64");
params.put("body", "...");
params.put("soft_id", "4581");

checkIfCorrectParamsSendAndResultReturned(captcha, params);
}
Expand Down Expand Up @@ -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<String, File> files = new HashMap<>();
files.put("file", image);
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/com/twocaptcha/ReCaptchaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/twocaptcha/RotateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions src/test/java/com/twocaptcha/TextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public void testSimpleText() throws Exception {
Map<String, String> params = new HashMap<>();
params.put("method", "post");
params.put("textcaptcha", question);
params.put("soft_id", "4581");

checkIfCorrectParamsSendAndResultReturned(captcha, params);
}
Expand All @@ -26,6 +27,7 @@ public void testTextParameter() throws Exception {
Map<String, String> params = new HashMap<>();
params.put("method", "post");
params.put("textcaptcha", question);
params.put("soft_id", "4581");

checkIfCorrectParamsSendAndResultReturned(captcha, params);
}
Expand All @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/twocaptcha/TurnstileTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/twocaptcha/YandexTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down