Skip to content
Open
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: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Examples of API requests for different captcha types are available on the [Java
- [atbCAPTCHA](#atbcaptcha)
- [CyberSiARA](#cybersiara)
- [DataDome](#datadome)
- [CaptchaFox](#captchafox)
- [Temu](#temu)
- [Other methods](#other-methods)
- [send / getResult](#send--getresult)
- [balance](#balance)
Expand Down Expand Up @@ -496,6 +498,33 @@ captcha.setUserAgent("Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHT
captcha.setProxy("HTTPS", "login:password@IP_address:PORT");
```

### CaptchaFox

<sup>[API method description.](https://2captcha.com/2captcha-api#captchafox)</sup>

This method can be used to solve CaptchaFox using a token. Returns a token.

```java
Captchafox captcha = new Captchafox();
captcha.setSiteKey("sk_ILKWNruBBVKDOM7dZs59KHnDLEWiH");
captcha.setUrl("https://mysite.com/page/with/captchafox");
captcha.setProxy("HTTPS", "login:password@IP_address:PORT");
```

### Temu

<sup>[API method description.](https://2captcha.com/2captcha-api#temucaptcha)</sup>

This method can be used to solve Temucaptch. Returns a coordinates.

```java
Temu captcha = new Temu();
captcha.setBody(body);
captcha.setPart1(part1);
captcha.setPart2(part2);
captcha.setPart3(part3);
```

## Other methods

### send / getResult
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/com/twocaptcha/captcha/Captchafox.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.twocaptcha.captcha;

public class Captchafox extends Captcha {

public Captchafox() {
super();
params.put("method", "captchafox");
}

public void setSiteKey(String siteKey) {
params.put("sitekey", siteKey);
}

public void setUrl(String url) {
params.put("pageurl", url);
}

}
22 changes: 22 additions & 0 deletions src/main/java/com/twocaptcha/captcha/Temu.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.twocaptcha.captcha;

public class Temu extends Captcha {

public Temu() {
super();
params.put("method", "temuimage");
}

public void setBody(String body) {
params.put("body", body);
}
public void setPart1(String part1) {
params.put("part1", part1);
}
public void setPart2(String part2) {
params.put("part2", part2);
}
public void setPart3(String part3) {
params.put("part3", part3);
}
}
25 changes: 25 additions & 0 deletions src/main/java/examples/CaptchafoxExample.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package examples;

import com.twocaptcha.TwoCaptcha;
import com.twocaptcha.captcha.Captchafox;
import com.twocaptcha.captcha.Turnstile;

public class CaptchafoxExample {

public static void main(String[] args) {
TwoCaptcha solver = new TwoCaptcha(args[0]);

Captchafox captcha = new Captchafox();
captcha.setSiteKey("sk_ILKWNruBBVKDOM7dZs59KHnDLEWiH");
captcha.setUrl("https://mysite.com/page/with/captchafox");
captcha.setProxy("HTTPS", "login:password@IP_address:PORT");

try {
solver.solve(captcha);
System.out.println("Captcha solved: " + captcha.getCode());
} catch (Exception e) {
System.out.println("Error occurred: " + e.getMessage());
}
}

}
38 changes: 38 additions & 0 deletions src/main/java/examples/TemuExample.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package examples;

import com.twocaptcha.TwoCaptcha;
import com.twocaptcha.captcha.Temu;

import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Base64;

public class TemuExample {

public static void main(String[] args) throws Exception {
TwoCaptcha solver = new TwoCaptcha(args[0]);

byte[] bodyBytes = Files.readAllBytes(Paths.get("src/main/resources/temu/body.png"));
String body = Base64.getEncoder().encodeToString(bodyBytes);
byte[] part1Bytes = Files.readAllBytes(Paths.get("src/main/resources/temu/part1.png"));
String part1 = Base64.getEncoder().encodeToString(part1Bytes);
byte[] part2Bytes = Files.readAllBytes(Paths.get("src/main/resources/temu/part2.png"));
String part2 = Base64.getEncoder().encodeToString(part2Bytes);
byte[] part3Bytes = Files.readAllBytes(Paths.get("src/main/resources/temu/part3.png"));
String part3 = Base64.getEncoder().encodeToString(part3Bytes);

Temu captcha = new Temu();
captcha.setBody(body);
captcha.setPart1(part1);
captcha.setPart2(part2);
captcha.setPart3(part3);

try {
solver.solve(captcha);
System.out.println("Captcha solved: " + captcha.getCode());
} catch (Exception e) {
System.out.println("Error occurred: " + e.getMessage());
}
}

}
Binary file added src/main/resources/temu/body.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/temu/part1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/temu/part2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/temu/part3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions src/test/java/com/twocaptcha/CaptchafoxTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.twocaptcha;

import com.twocaptcha.captcha.Captchafox;
import com.twocaptcha.captcha.Turnstile;

import java.util.HashMap;
import java.util.Map;

public class CaptchafoxTest extends AbstractWrapperTestCase {

public void testAllOptions() throws Exception {
Captchafox captcha = new Captchafox();
captcha.setSiteKey("sk_ILKWNruBBVKDOM7dZs59KHnDLEWiH");
captcha.setUrl("https://mysite.com/page/with/captchafox");

Map<String, String> params = new HashMap<>();
params.put("method", "captchafox");
params.put("sitekey", "sk_ILKWNruBBVKDOM7dZs59KHnDLEWiH");
params.put("pageurl", "https://mysite.com/page/with/captchafox");
params.put("soft_id", "4581");
params.put("json", "0");

checkIfCorrectParamsSendAndResultReturned(captcha, params);
}

}
29 changes: 29 additions & 0 deletions src/test/java/com/twocaptcha/TemuTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.twocaptcha;

import com.twocaptcha.captcha.Temu;

import java.util.HashMap;
import java.util.Map;

public class TemuTest extends AbstractWrapperTestCase {

public void testAllOptions() throws Exception {
Temu captcha = new Temu();
captcha.setBody("body");
captcha.setPart1("part1");
captcha.setPart2("part2");
captcha.setPart3("part3");

Map<String, String> params = new HashMap<>();
params.put("method", "temuimage");
params.put("body", "body");
params.put("part1", "part1");
params.put("part2", "part2");
params.put("part3", "part3");
params.put("soft_id", "4581");
params.put("json", "0");

checkIfCorrectParamsSendAndResultReturned(captcha, params);
}

}