azcaptcha-java

Java library for easy integration with the API of azcaptcha captcha solving service to bypass recaptcha, hcaptcha, funcaptcha, geetest and solve any other captchas.

License

License

Categories

Categories

Java Languages
GroupId

GroupId

com.github.hassan-ghahraloud
ArtifactId

ArtifactId

azcaptcha-java
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

azcaptcha-java
Java library for easy integration with the API of azcaptcha captcha solving service to bypass recaptcha, hcaptcha, funcaptcha, geetest and solve any other captchas.
Project URL

Project URL

https://github.com/Hassan-GhahrAloud/azcaptcha-java
Source Code Management

Source Code Management

https://github.com/Hassan-GhahrAloud/azcaptcha-java.git

Download azcaptcha-java

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.hassan-ghahraloud/azcaptcha-java/ -->
<dependency>
    <groupId>com.github.hassan-ghahraloud</groupId>
    <artifactId>azcaptcha-java</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.hassan-ghahraloud/azcaptcha-java/
implementation 'com.github.hassan-ghahraloud:azcaptcha-java:1.0'
// https://jarcasting.com/artifacts/com.github.hassan-ghahraloud/azcaptcha-java/
implementation ("com.github.hassan-ghahraloud:azcaptcha-java:1.0")
'com.github.hassan-ghahraloud:azcaptcha-java:jar:1.0'
<dependency org="com.github.hassan-ghahraloud" name="azcaptcha-java" rev="1.0">
  <artifact name="azcaptcha-java" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.hassan-ghahraloud', module='azcaptcha-java', version='1.0')
)
libraryDependencies += "com.github.hassan-ghahraloud" % "azcaptcha-java" % "1.0"
[com.github.hassan-ghahraloud/azcaptcha-java "1.0"]

Dependencies

compile (1)

Group / Artifact Type Version
com.squareup.okhttp3 : okhttp jar 4.7.2

test (2)

Group / Artifact Type Version
junit : junit jar 4.13
org.mockito : mockito-core jar 3.3.3

Project Modules

There are no modules declared in this project.

Maven Central

JAVA Module for AZCaptcha API

The easiest way to quickly integrate AZCaptcha into your code to automate solving of any types of captcha.

Installation

azcaptcha-java artifact is available in Maven Central

Configuration

AZCaptcha instance can be created like this:

AZCaptcha solver = new AZCaptcha('YOUR_API_KEY');

Also there are few options that can be configured:

solver.setSoftId(123);
solver.setCallback("https://your.site/result-receiver");
solver.setDefaultTimeout(120);
solver.setRecaptchaTimeout(600);
solver.setPollingInterval(10);

AZCaptcha instance options

Option Default value Description
softId - your software ID obtained after publishing in [azcaptcha sofware catalog]
callback - URL of your web-sever that receives the captcha recognition result. The URl should be first registered in [pingback settings] of your account
defaultTimeout 120 Polling timeout in seconds for all captcha types except ReCaptcha. Defines how long the module tries to get the answer from res.php API endpoint
recaptchaTimeout 600 Polling timeout for ReCaptcha in seconds. Defines how long the module tries to get the answer from res.php API endpoint
pollingInterval 10 Interval in seconds between requests to res.php API endpoint, setting values less than 5 seconds is not recommended

IMPORTANT: once callback URL is defined for AZCaptcha instance with setCallback, all methods return only the captcha ID and DO NOT poll the API to get the result. The result will be sent to the callback URL. To get the answer manually use getResult method

Solve captcha

When you submit any image-based captcha use can provide additional options to help azcaptcha workers to solve it properly.

Captcha options

Option Default Value Description
hintImg - an image with hint shown to workers with the captcha
hintText - hint or task text shown to workers with the captcha

Check out examples directory to find more examples with all available options.

Normal Captcha

To bypass a normal captcha (distorted text on image) use the following method. This method also can be used to recognize any text on the image.

Normal captcha = new Normal();
captcha.setFile("path/to/captcha.jpg");
captcha.setHintImg(new File("path/to/hint.jpg"));
captcha.setHintText("Type red symbols only");

ReCaptcha v2

Use this method to solve ReCaptcha V2 and obtain a token to bypass the protection.

ReCaptcha captcha = new ReCaptcha();
captcha.setSiteKey("6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-");
captcha.setUrl("https://mysite.com/page/with/recaptcha");
captcha.setInvisible(true);
captcha.setAction("verify");
captcha.setProxy("HTTPS", "login:password@IP_address:PORT");

ReCaptcha v3

This method provides ReCaptcha V3 solver and returns a token.

ReCaptcha captcha = new ReCaptcha();
captcha.setSiteKey("6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-");
captcha.setUrl("https://mysite.com/page/with/recaptcha");
captcha.setVersion("v3");
captcha.setAction("verify");
captcha.setScore(0.3);
captcha.setProxy("HTTPS", "login:password@IP_address:PORT");

hCaptcha

Method to solve GeeTest puzzle captcha. Returns a set of tokens as JSON.

HCaptcha captcha = new HCaptcha();
captcha.setSiteKey("10000000-ffff-ffff-ffff-000000000001");
captcha.setUrl("https://www.site.com/page/");
captcha.setProxy("HTTPS", "login:password@IP_address:PORT");

Other methods

send / getResult

These methods can be used for manual captcha submission and answer polling.

String captchaId = solver.send(captcha);

Thread.sleep(20 * 1000);

String code = solver.getResult(captchaId);

balance

Use this method to get your account's balance

double balance = solver.balance();

report

Use this method to report good or bad captcha answer.

solver.report(captcha.getId(), true); // captcha solved correctly
solver.report(captcha.getId(), false); // captcha solved incorrectly

Error handling

If case of an error captcha solver throws an exception. It's important to properly handle these cases. We recommend to use try catch to handle exceptions.

try {
    solver.solve(captcha);
} catch (ValidationException e) {
    // invalid parameters passed
} catch (NetworkException e) {
    // network error occurred
} catch (ApiException e) {
    // api respond with error
} catch (TimeoutException e) {
    // captcha is not solved so far
}

Versions

Version
1.0