public abstract class Client
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
API_VERSION |
static int |
DEFAULT_TIMEOUT |
static int |
DEFAULT_TOKEN_TIMEOUT |
static int |
DFLT_POLL_INTERVAL |
boolean |
isVerbose
Client verbosity flag.
|
static int |
LEN_POLLS_INTERVAL |
static int[] |
POLLS_INTERVAL |
static int |
SOFTWARE_VENDOR_ID |
| Constructor and Description |
|---|
Client(java.lang.String username,
java.lang.String password) |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
close()
Closes opened connections (if any), cleans up resources.
|
abstract boolean |
connect()
Opens API-specific connection if not opened yet.
|
Captcha |
decode(byte[] img) |
Captcha |
decode(byte[] img,
int type) |
Captcha |
decode(byte[] img,
int type,
byte[] banner,
java.lang.String banner_text) |
Captcha |
decode(byte[] img,
int type,
int timeout) |
Captcha |
decode(byte[] img,
java.lang.String challenge) |
Captcha |
decode(byte[] img,
java.lang.String challenge,
int timeout) |
Captcha |
decode(byte[] img,
java.lang.String challenge,
int type,
byte[] banner,
java.lang.String banner_text,
int timeout) |
Captcha |
decode(byte[] img,
java.lang.String challenge,
int type,
byte[] banner,
java.lang.String banner_text,
java.lang.String grid,
int timeout)
Tries to solve a CAPTCHA by uploading it and polling for its status
and text with arbitrary timeout.
|
Captcha |
decode(java.io.File f) |
Captcha |
decode(java.io.File f,
int timeout) |
Captcha |
decode(java.io.File f,
int type,
java.io.File banner_f,
java.lang.String banner_text) |
Captcha |
decode(java.io.File f,
int type,
int timeout) |
Captcha |
decode(java.io.File f,
java.lang.String challenge) |
Captcha |
decode(java.io.File f,
java.lang.String challenge,
int timeout) |
Captcha |
decode(java.io.File f,
java.lang.String challenge,
int type,
java.io.File banner_f,
java.lang.String banner_text,
int timeout) |
Captcha |
decode(java.io.InputStream st) |
Captcha |
decode(java.io.InputStream st,
int timeout) |
Captcha |
decode(java.io.InputStream st,
int type,
java.io.InputStream banner_st,
java.lang.String banner_text) |
Captcha |
decode(java.io.InputStream st,
int type,
java.io.InputStream banner_st,
java.lang.String banner_text,
java.lang.String grid) |
Captcha |
decode(java.io.InputStream st,
int type,
int timeout) |
Captcha |
decode(java.io.InputStream st,
java.lang.String challenge) |
Captcha |
decode(java.io.InputStream st,
java.lang.String challenge,
int timeout) |
Captcha |
decode(java.io.InputStream st,
java.lang.String challenge,
int type,
java.io.InputStream banner_st,
java.lang.String banner_text,
int timeout) |
Captcha |
decode(java.io.InputStream st,
java.lang.String challenge,
int type,
java.io.InputStream banner_st,
java.lang.String banner_text,
java.lang.String grid,
int timeout) |
Captcha |
decode(org.json.JSONObject json) |
Captcha |
decode(org.json.JSONObject json,
int timeout) |
Captcha |
decode(java.lang.String fn) |
Captcha |
decode(java.lang.String fn,
int timeout) |
Captcha |
decode(java.lang.String fn,
int type,
int timeout) |
Captcha |
decode(java.lang.String fn,
int type,
java.lang.String banner_fn,
java.lang.String banner_text) |
Captcha |
decode(java.lang.String fn,
int type,
java.lang.String banner_fn,
java.lang.String banner_text,
int timeout) |
Captcha |
decode(java.lang.String fn,
java.lang.String challenge) |
Captcha |
decode(java.lang.String fn,
java.lang.String challenge,
int timeout) |
Captcha |
decode(java.lang.String fn,
java.lang.String challenge,
int type,
java.lang.String banner_fn,
java.lang.String banner_text,
int timeout) |
Captcha |
decode(java.lang.String proxy,
java.lang.String proxytype,
java.lang.String sitekey,
java.lang.String pageurl) |
Captcha |
decode(java.lang.String proxy,
java.lang.String proxytype,
java.lang.String sitekey,
java.lang.String pageurl,
int timeout) |
double |
getBalance()
Fetches user balance (in US cents).
|
Captcha |
getCaptcha(Captcha captcha) |
abstract Captcha |
getCaptcha(int id)
Fetches an uploaded CAPTCHA details.
|
static int[] |
getPollInterval(int idx) |
java.lang.String |
getText(Captcha captcha) |
java.lang.String |
getText(int id)
Fetches an uploaded CAPTCHA text.
|
abstract User |
getUser()
Fetches user details.
|
byte[] |
load(java.lang.String fn) |
boolean |
report(Captcha captcha) |
abstract boolean |
report(int id)
Reports an incorrectly solved CAPTCHA
|
abstract Captcha |
upload(byte[] img) |
abstract Captcha |
upload(byte[] img,
int type,
byte[] banner,
java.lang.String banner_text) |
abstract Captcha |
upload(byte[] img,
java.lang.String challenge,
int type,
byte[] banner,
java.lang.String banner_text) |
abstract Captcha |
upload(byte[] img,
java.lang.String challenge,
int type,
byte[] banner,
java.lang.String banner_text,
java.lang.String grid)
Uploads a CAPTCHA to the service.
|
Captcha |
upload(java.io.File f) |
Captcha |
upload(java.io.InputStream st) |
abstract Captcha |
upload(int type,
org.json.JSONObject json) |
Captcha |
upload(int type,
java.lang.String proxy,
java.lang.String proxytype,
java.lang.String sitekey,
java.lang.String pageurl) |
Captcha |
upload(java.lang.String fn) |
public static final java.lang.String API_VERSION
public static final int SOFTWARE_VENDOR_ID
public static final int DEFAULT_TIMEOUT
public static final int DEFAULT_TOKEN_TIMEOUT
public static final int[] POLLS_INTERVAL
public static final int DFLT_POLL_INTERVAL
public static final int LEN_POLLS_INTERVAL
public boolean isVerbose
public Client(java.lang.String username,
java.lang.String password)
username - DBC account usernamepassword - DBC account passwordpublic byte[] load(java.lang.String fn)
throws java.io.IOException,
java.io.FileNotFoundException
java.io.IOExceptionjava.io.FileNotFoundExceptionpublic abstract void close()
public abstract boolean connect()
throws java.io.IOException
java.io.IOExceptionpublic abstract User getUser() throws java.io.IOException, Exception
java.io.IOExceptionExceptionpublic double getBalance()
throws java.io.IOException,
Exception
java.io.IOExceptionExceptionpublic abstract Captcha upload(byte[] img, java.lang.String challenge, int type, byte[] banner, java.lang.String banner_text, java.lang.String grid) throws java.io.IOException, Exception
img - CAPTCHA image byte vectorjava.io.IOExceptionExceptionpublic abstract Captcha upload(byte[] img, java.lang.String challenge, int type, byte[] banner, java.lang.String banner_text) throws java.io.IOException, Exception
java.io.IOExceptionExceptionpublic abstract Captcha upload(byte[] img, int type, byte[] banner, java.lang.String banner_text) throws java.io.IOException, Exception
java.io.IOExceptionExceptionpublic abstract Captcha upload(byte[] img) throws java.io.IOException, Exception
java.io.IOExceptionExceptionpublic Captcha upload(java.io.InputStream st) throws java.io.IOException, Exception
st - CAPTCHA image streamjava.io.IOExceptionExceptionupload(byte[], java.lang.String, int, byte[], java.lang.String, java.lang.String)public Captcha upload(java.io.File f) throws java.io.IOException, java.io.FileNotFoundException, Exception
f - CAPTCHA image filejava.io.IOExceptionjava.io.FileNotFoundExceptionExceptionupload(byte[], java.lang.String, int, byte[], java.lang.String, java.lang.String)public Captcha upload(java.lang.String fn) throws java.io.IOException, java.io.FileNotFoundException, Exception
fn - CAPTCHA image file namejava.io.IOExceptionjava.io.FileNotFoundExceptionExceptionupload(byte[], java.lang.String, int, byte[], java.lang.String, java.lang.String)public Captcha upload(int type, java.lang.String proxy, java.lang.String proxytype, java.lang.String sitekey, java.lang.String pageurl) throws java.io.IOException, Exception
type - CAPTCHA typeproxy - User proxyproxytype - User proxy typesitekey - Site Google Keypageurl - Site urljava.io.IOExceptionExceptionupload(byte[], java.lang.String, int, byte[], java.lang.String, java.lang.String)public abstract Captcha upload(int type, org.json.JSONObject json) throws java.io.IOException, Exception
java.io.IOExceptionExceptionpublic abstract Captcha getCaptcha(int id) throws java.io.IOException, Exception
id - CAPTCHA IDjava.io.IOExceptionExceptionpublic Captcha getCaptcha(Captcha captcha) throws java.io.IOException, Exception
captcha - CAPTCHA objectjava.io.IOExceptionExceptiongetCaptcha(int)public java.lang.String getText(int id)
throws java.io.IOException,
Exception
id - CAPTCHA IDjava.io.IOExceptionExceptionpublic java.lang.String getText(Captcha captcha) throws java.io.IOException, Exception
captcha - CAPTCHA objectjava.io.IOExceptionExceptiongetText(int)public abstract boolean report(int id)
throws java.io.IOException,
Exception
id - CAPTCHA IDjava.io.IOExceptionExceptionpublic boolean report(Captcha captcha) throws java.io.IOException, Exception
captcha - CAPTCHA objectjava.io.IOExceptionExceptionreport(int)public Captcha decode(byte[] img, java.lang.String challenge, int type, byte[] banner, java.lang.String banner_text, java.lang.String grid, int timeout) throws java.io.IOException, Exception, java.lang.InterruptedException
img - CAPTCHA image byte vectortimeout - Solving timeout (in seconds)java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(byte[] img, java.lang.String challenge, int type, byte[] banner, java.lang.String banner_text, int timeout) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(byte[] img, int type, byte[] banner, java.lang.String banner_text) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(byte[] img, int type) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(byte[] img, java.lang.String challenge) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(byte[] img, int type, int timeout) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(byte[] img, java.lang.String challenge, int timeout) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(byte[] img) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptiondecode(byte[], int)public Captcha decode(java.io.InputStream st, java.lang.String challenge, int type, java.io.InputStream banner_st, java.lang.String banner_text, java.lang.String grid, int timeout) throws java.io.IOException, Exception, java.lang.InterruptedException
st - CAPTCHA image streamtimeout - Solving timeout (in seconds)java.io.IOExceptionExceptionjava.lang.InterruptedExceptiondecode(byte[], java.lang.String, int, byte[], java.lang.String, java.lang.String, int)public Captcha decode(java.io.InputStream st, java.lang.String challenge, int type, java.io.InputStream banner_st, java.lang.String banner_text, int timeout) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.io.InputStream st, int type, java.io.InputStream banner_st, java.lang.String banner_text, java.lang.String grid) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.io.InputStream st, int type, java.io.InputStream banner_st, java.lang.String banner_text) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.io.InputStream st, int type, int timeout) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.io.InputStream st, java.lang.String challenge) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.io.InputStream st, java.lang.String challenge, int timeout) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.io.InputStream st, int timeout) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.io.InputStream st) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptiondecode(InputStream, int)public Captcha decode(java.io.File f, java.lang.String challenge, int type, java.io.File banner_f, java.lang.String banner_text, int timeout) throws java.io.IOException, Exception, java.lang.InterruptedException
f - CAPTCHA image filetimeout - Solving timeout (in seconds)java.io.IOExceptionExceptionjava.lang.InterruptedExceptiondecode(byte[], java.lang.String, int, byte[], java.lang.String, java.lang.String, int)public Captcha decode(java.io.File f, int type, java.io.File banner_f, java.lang.String banner_text) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.io.File f, int type, int timeout) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.io.File f, java.lang.String challenge) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.io.File f, java.lang.String challenge, int timeout) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.io.File f, int timeout) throws java.io.IOException, java.io.FileNotFoundException, Exception, java.lang.InterruptedException
java.io.IOExceptionjava.io.FileNotFoundExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.io.File f) throws java.io.IOException, java.io.FileNotFoundException, Exception, java.lang.InterruptedException
java.io.IOExceptionjava.io.FileNotFoundExceptionExceptionjava.lang.InterruptedExceptiondecode(File, int)public Captcha decode(java.lang.String fn, java.lang.String challenge, int type, java.lang.String banner_fn, java.lang.String banner_text, int timeout) throws java.io.IOException, Exception, java.lang.InterruptedException
fn - CAPTCHA image file nametimeout - Solving timeout (in seconds)java.io.IOExceptionExceptionjava.lang.InterruptedExceptiondecode(byte[], java.lang.String, int, byte[], java.lang.String, java.lang.String, int)public Captcha decode(java.lang.String fn, int type, java.lang.String banner_fn, java.lang.String banner_text) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.lang.String fn, int type, java.lang.String banner_fn, java.lang.String banner_text, int timeout) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.lang.String fn, int type, int timeout) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.lang.String fn, java.lang.String challenge) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.lang.String fn, java.lang.String challenge, int timeout) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.lang.String fn, int timeout) throws java.io.IOException, java.io.FileNotFoundException, Exception, java.lang.InterruptedException
java.io.IOExceptionjava.io.FileNotFoundExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.lang.String fn) throws java.io.IOException, java.io.FileNotFoundException, Exception, java.lang.InterruptedException
java.io.IOExceptionjava.io.FileNotFoundExceptionExceptionjava.lang.InterruptedExceptiondecode(String, int)public Captcha decode(java.lang.String proxy, java.lang.String proxytype, java.lang.String sitekey, java.lang.String pageurl) throws java.io.IOException, java.io.FileNotFoundException, Exception, java.lang.InterruptedException
java.io.IOExceptionjava.io.FileNotFoundExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(java.lang.String proxy, java.lang.String proxytype, java.lang.String sitekey, java.lang.String pageurl, int timeout) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(org.json.JSONObject json) throws java.io.IOException, java.io.FileNotFoundException, Exception, java.lang.InterruptedException
java.io.IOExceptionjava.io.FileNotFoundExceptionExceptionjava.lang.InterruptedExceptionpublic Captcha decode(org.json.JSONObject json, int timeout) throws java.io.IOException, Exception, java.lang.InterruptedException
java.io.IOExceptionExceptionjava.lang.InterruptedExceptionpublic static int[] getPollInterval(int idx)
int - index of POLLS_INTERVAL