-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathNormalOptionsExample.java
37 lines (31 loc) · 1.12 KB
/
NormalOptionsExample.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package examples;
import com.twocaptcha.TwoCaptcha;
import java.io.File;
import com.twocaptcha.captcha.Normal;
public class NormalOptionsExample {
public static void main(String[] args) {
TwoCaptcha solver = new TwoCaptcha(args[0]);
solver.setHost("rucaptcha.com");
solver.setSoftId(0);
solver.setDefaultTimeout(120);
solver.setRecaptchaTimeout(600);
solver.setPollingInterval(10);
Normal captcha = new Normal();
captcha.setFile("src/main/resources/normal_2.jpg");
captcha.setNumeric(4);
captcha.setMinLen(4);
captcha.setMaxLen(20);
captcha.setPhrase(true);
captcha.setCaseSensitive(true);
captcha.setCalc(false);
captcha.setLang("en");
captcha.setHintImg(new File("src/main/resources/normal_hint.jpg"));
captcha.setHintText("Type red symbols only");
try {
solver.solve(captcha);
System.out.println("Captcha solved: " + captcha.getCode());
} catch (Exception e) {
System.out.println("Error occurred: " + e.getMessage());
}
}
}