Chat with us, powered by LiveChat
← Return to MyDisct Solver

Lemin Captcha Solving

Solve Lemin Captcha challenges programmatically with high accuracy. Lemin Captcha is an image-based puzzle captcha that requires dragging an object to a target.

What is Lemin Captcha?

Lemin Captcha is a visual challenge where users must drag a specific object (like a badge) onto a matching silhouette or target area within an image. Our API returns the X and Y coordinates for the correct drop location.

Captcha Type

Use the following captcha type identifier in your API requests:

"type": "LEMIN_CAPTCHA_IMAGE"

Request Format

POST /createTask

Request Parameters

Parameter Type Required Description
auth.token string required Your API key
captcha.type string required Must be "LEMIN_CAPTCHA_IMAGE"
captcha.metadata.siteUrl string required The URL where the captcha appears
captcha.payload.question string required The instruction text (e.g., "Drag the badge onto the matching silhouette")
captcha.payload.images array required Array containing the Base64 encoded image string

Example Request

JavaScript
const response = await fetch('https://solver-api.mydisct.com/createTask', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'apikey': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    auth: {
      token: 'YOUR_API_KEY'
    },
    context: {
      source: 'api',
      version: '1.0.0'
    },
    captcha: {
      type: 'LEMIN_CAPTCHA_IMAGE',
      metadata: {
        siteUrl: 'https://example.com/page-with-captcha'
      },
      payload: {
        question: 'Drag the badge onto the matching silhouette',
        images: [
          'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...'
        ]
      }
    }
  })
});

const data = await response.json();
console.log('Task ID:', data.task.id);

Response Format

Create Task Response (Processing)

{
  "success": true,
  "service": "MyDisct Solver",
  "message": "Task created successfully",
  "task": {
    "id": "MyDisctSolver_abc123",
    "status": "processing",
    "timestamp": "2025-11-05T12:00:00.000Z"
  }
}

Fetch Result Response (Completed)

{
  "success": true,
  "service": "MyDisct Solver",
  "message": "Captcha solved successfully",
  "task": {
    "id": "MyDisctSolver_abc123",
    "status": "completed",
    "result": {
      "answers": [72.5, 34.1],
      "timestamp": "2025-11-05T12:00:15.000Z"
    }
  }
}
Understanding the Response

The answers array contains the X and Y coordinates (percentages) where the object should be dropped.
answers[0]: X coordinate (horizontal drop percentage)
answers[1]: Y coordinate (vertical drop percentage)

Python Example

Python
import requests
import time
import base64

def solve_lemin_captcha(site_url, question, image_path, api_key):
    """Solve Lemin Captcha challenge"""

    # Read image and convert to base64
    with open(image_path, "rb") as image_file:
        encoded_string = base64.b64encode(image_file.read()).decode('utf-8')
        image_data = f"data:image/png;base64,{encoded_string}"

    # Step 1: Create task
    create_response = requests.post(
        'https://solver-api.mydisct.com/createTask',
        headers={
            'Content-Type': 'application/json',
            'apikey': api_key
        },
        json={
            'auth': {'token': api_key},
            'context': {'source': 'api', 'version': '1.0.0'},
            'captcha': {
                'type': 'LEMIN_CAPTCHA_IMAGE',
                'metadata': {
                    'siteUrl': site_url
                },
                'payload': {
                    'question': question,
                    'images': [image_data]
                }
            }
        }
    )

    create_data = create_response.json()
    if not create_data['success']:
        raise Exception(create_data['error']['message'])

    task_id = create_data['task']['id']
    print(f'Task created: {task_id}')

    # Step 2: Poll for result
    while True:
        time.sleep(2)  # Wait 2 seconds

        result_response = requests.post(
            'https://solver-api.mydisct.com/fetchResult',
            headers={
                'Content-Type': 'application/json',
                'apikey': api_key
            },
            json={'taskId': task_id}
        )

        result_data = result_response.json()
        if result_data['task']['status'] == 'completed':
            return result_data['task']['result']['answers']
        elif result_data['task']['status'] == 'failed':
            raise Exception('Lemin captcha solving failed')

        print('Waiting for solution...')

# Example usage
coordinates = solve_lemin_captcha(
    site_url='https://example.com/page-with-captcha',
    question='Drag the badge onto the matching silhouette',
    image_path='captcha_image.png',
    api_key='YOUR_API_KEY'
)

print(f'Solution Coordinates: X={coordinates[0]}, Y={coordinates[1]}')

Implementation Guide

Step 1: Extract Image and Question

Lemin Captcha typically presents an image and a question. You need to extract both to send to the API.

JavaScript
// Example: Extracting image and question from the DOM

function getLeminData() {
    const imageElement = document.querySelector('.lemin-captcha-image'); 
    const imageBase64 = getBase64FromImage(imageElement); // Helper function to get base64

    const questionElement = document.querySelector('.lemin-captcha-instruction');
    const question = questionElement ? questionElement.innerText : 'Drag the object to the target';

    return {
        image: imageBase64,
        question: question
    };
}

Step 2: Simulate Drag and Drop

Once you receive the X and Y coordinates (percentages) from the API, you need to simulate the drag and drop action on the page.

JavaScript
// Example: Simulating drag and drop using Puppeteer

async function performDragAndDrop(page, coordinates) {
    const containerSelector = '.lemin-captcha-container'; // The container element
    const draggerSelector = '.lemin-captcha-dragger';     // The draggable element (badge/puzzle piece)

    const containerBox = await page.$eval(containerSelector, el => {
        const rect = el.getBoundingClientRect();
        return { x: rect.x, y: rect.y, width: rect.width, height: rect.height };
    });

    const draggerBox = await page.$eval(draggerSelector, el => {
        const rect = el.getBoundingClientRect();
        return { x: rect.x, y: rect.y, width: rect.width, height: rect.height };
    });

    const targetX = containerBox.x + (containerBox.width * (coordinates[0] / 100));
    const targetY = containerBox.y + (containerBox.height * (coordinates[1] / 100));

    const startX = draggerBox.x + (draggerBox.width / 2);
    const startY = draggerBox.y + (draggerBox.height / 2);

    await page.mouse.move(startX, startY);
    await page.mouse.down();
    await page.mouse.move(targetX, targetY, { steps: 10 }); // Move smoothly
    await page.mouse.up();
}

Best Practices

Recommendations
  • Ensure the image sent is high quality and not compressed too much.
  • Provide the exact question text displayed on the captcha.
  • The API returns coordinates as percentages. Convert these to pixel coordinates relative to the captcha container.
  • Implement retry logic for network errors.
  • Use smooth mouse movements when simulating drag and drop to avoid bot detection.

Common Issues

Issue: Incorrect Drop Position

Solution: Ensure you are converting the percentage coordinates returned by the API to the correct pixel coordinates relative to the image container size on your screen.

Issue: Image Extraction Fails

Solution: Ensure you are extracting the full captcha image, not just a thumbnail or a cropped version. Base64 strings should include the data URI prefix.

Issue: Drag Simulation Detected

Solution: Some sites require smooth mouse movement simulation rather than an instant jump to the target coordinates. Use steps in your mouse move function.