Skip to main content

anticaptcha 0.0.2+2 copy "anticaptcha: ^0.0.2+2" to clipboard
anticaptcha: ^0.0.2+2 copied to clipboard

Anti-Captcha.com unofficial dart library

AntiCaptcha Dart Client #

Dart CI Pub Version License: MIT

A modern, type-safe, and asynchronous Dart library for the Anti-Captcha service. Powered by Dio and json_serializable.


๐Ÿš€ Features #

  • ๐Ÿ›ก๏ธ Type-Safe: Comprehensive models for all captcha tasks and responses.
  • โšก Modern Networking: Built on top of Dio for efficient HTTP requests and configurable timeouts.
  • ๐Ÿ”„ Automated Polling: Simplified result retrieval with smart polling logic.
  • ๐Ÿ’ฐ Balance Check: Easily check your account balance.
  • ๐Ÿ†” Soft ID Support: Support for developer attribution (softId).
  • ๐Ÿ› ๏ธ Extensible: Easily support new captcha types like Cloudflare Turnstile, Recaptcha V2, and more.
  • ๐Ÿ“ฆ Clean Architecture: Organized codebase for better maintainability.

๐Ÿ“ฆ Installation #

Add this to your pubspec.yaml:

dependencies:
  anticaptcha: ^0.0.1

Then run:

dart pub get

๐Ÿ› ๏ธ Usage #

Quick Start #

import 'package:anticaptcha/anticaptcha.dart';

void main() async {
  // Initialize the client with your API key and optional softId
  final client = AntiCaptchaClient('YOUR_API_KEY');

  // Check balance
  final balance = await client.getBalance();
  print('Current Balance: $balance');

  try {
    // Solve an Image-to-Text captcha
    final base64Image = await client.imageToBase64('captcha.jpeg');
    final result = await client.solve(ImageToTextTask(body: base64Image));
    
    print('Captcha Solved: ${result.solution?['text']}');
  } on AntiCaptchaException catch (e) {
    print('Error: ${e.message}');
  }
}

Supported Captcha Types #

Cloudflare Turnstile (Proxyless)

final result = await client.solve(
  TurnstileTaskProxyless(
    websiteURL: 'https://example.com',
    websiteKey: 'YOUR_TURNSTILE_KEY',
    action: 'login', // optional
  ),
);
print('Token: ${result.solution?['token']}');

Cloudflare Turnstile (With Proxy)

final result = await client.solve(
  TurnstileTask(
    websiteURL: 'https://example.com',
    websiteKey: 'YOUR_TURNSTILE_KEY',
    proxyType: 'http',
    proxyAddress: '1.2.3.4',
    proxyPort: 8080,
    proxyLogin: 'user', // optional
    proxyPassword: 'pass', // optional
  ),
);
print('Token: ${result.solution?['token']}');

Recaptcha V2 (Proxyless)

final result = await client.solve(
  RecaptchaV2TaskProxyless(
    websiteURL: 'https://example.com',
    websiteKey: 'YOUR_RECAPTCHA_KEY',
  ),
);
print('gRecaptchaResponse: ${result.solution?['gRecaptchaResponse']}');

Recaptcha V2 (With Proxy)

final result = await client.solve(
  RecaptchaV2Task(
    websiteURL: 'https://example.com',
    websiteKey: 'YOUR_RECAPTCHA_KEY',
    proxyType: 'http',
    proxyAddress: '1.2.3.4',
    proxyPort: 8080,
    userAgent: 'Mozilla/5.0...',
    proxyLogin: 'user', // optional
    proxyPassword: 'pass', // optional
  ),
);
print('gRecaptchaResponse: ${result.solution?['gRecaptchaResponse']}');

โš™๏ธ Advanced Configuration #

You can customize the Dio instance or adjust polling behavior:

final client = AntiCaptchaClient(
  'YOUR_API_KEY',
  timeout: Duration(seconds: 45), // Custom HTTP timeout
);

final result = await client.solve(
  task,
  pollingInterval: Duration(seconds: 3), // Wait 3s between checks
  maxRetries: 40,                       // Total attempts
);

๐Ÿงช Testing #

The library uses dotenv for integration tests. Create a .env file in the root directory:

ANTICAPTCHA_KEY=your_actual_api_key

Then run:

dart test

๐Ÿ“„ License #

This project is licensed under the MIT License - see the LICENSE file for details.


Disclaimer: This is an unofficial library and is not affiliated with Anti-Captcha.com.

0
likes
130
points
8
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Anti-Captcha.com unofficial dart library

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

dio, json_annotation

More

Packages that depend on anticaptcha