Bypassing the Slide Programmatic Captcha Resolution
How to handle TikTok's slider captchas using ZOCAILMINE's resolve-captcha endpoint.
Introduction
One of the biggest blockers in scraping is the "Slider Captcha." When automated systems interact with TikTok, they are often presented with a puzzle piece that must be slid into place.
While most of our endpoints handle this internally, there are edge cases where you might need to solve a specific challenge. ZOCAILMINE offers a resolve-captcha endpoint specifically for this utility.
Concept: Image-Based Resolution
The logic requires two inputs:
- Image 1: The background image (the puzzle).
- Image 2: The slider piece.
The API processes these images and calculates the exact X/Y coordinates and trajectory needed to solve the puzzle, returning the solution payload.
The Problem vs. The Solution
| Method | Approach | Drawback |
|---|---|---|
| Manual | Human intervention | Cannot scale |
| Heuristics | Simple CV/Edge detection | High failure rate on modern captchas |
| ZOCAILMINE | AI/ML Model | High accuracy, API-based |
Code Example: Preparing the Payload
As seen in useTikTokApi.ts, files must be converted to Base64 before sending.
// Helper to convert File to Base64
const fileToBase64 = (file: File): Promise<string> =>
new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result as string);
reader.onerror = () => reject(new Error('Failed to read file'));
});
// The execution logic
async function solveCaptcha(bgImage: File, pieceImage: File, apiKey: string) {
const base64Bg = await fileToBase64(bgImage);
const base64Piece = await fileToBase64(pieceImage);
const payload = {
image1: base64Bg,
image2: base64Piece,
type: 'slider' // Default type
};
const response = await axios.post('/api/v1/tiktok/resolve-captcha', payload, {
headers: { 'x-api-key': apiKey }
});
return response.data; // Returns coordinates/solution
}