com.twocaptcha.captcha.Captcha Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of 2captcha-java Show documentation
Show all versions of 2captcha-java Show documentation
Java library for easy integration with the API of 2captcha captcha solving service to bypass recaptcha, hcaptcha, funcaptcha, geetest and solve any other captchas.
The newest version!
package com.twocaptcha.captcha;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
public abstract class Captcha {
protected String id;
protected String code;
protected Map params;
protected Map files;
public Captcha() {
params = new HashMap<>();
files = new HashMap<>();
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public void setProxy(String type, String uri) {
params.put("proxy", uri);
params.put("proxytype", type);
}
public void setSoftId(int softId) {
params.put("soft_id", String.valueOf(softId));
}
public void setCallback(String callback) {
params.put("pingback", callback);
}
public Map getParams() {
Map params = new HashMap(this.params);
if (!params.containsKey("method")) {
if (params.containsKey("body")) {
params.put("method", "base64");
} else {
params.put("method", "post");
}
}
return params;
}
public Map getFiles() {
return new HashMap<>(files);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy