forked from 2captcha/2captcha-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextOptionsExample.java
More file actions
28 lines (22 loc) · 808 Bytes
/
TextOptionsExample.java
File metadata and controls
28 lines (22 loc) · 808 Bytes
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
package examples;
import com.twocaptcha.TwoCaptcha;
import com.twocaptcha.captcha.Text;
public class TextOptionsExample {
public static void main(String[] args) {
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
solver.setHost("rucaptcha.com");
solver.setSoftId(0);
solver.setDefaultTimeout(120);
solver.setRecaptchaTimeout(600);
solver.setPollingInterval(10);
Text captcha = new Text();
captcha.setText("If tomorrow is Saturday, what day is today?");
captcha.setLang("en");
try {
solver.solve(captcha);
System.out.println("Captcha solved: " + captcha.getCode());
} catch (Exception e) {
System.out.println("Error occurred: " + e.getMessage());
}
}
}