🔄 TikTok Rotate Captcha API

Tài liệu hướng dẫn sử dụng API giải captcha xoay TikTok

📋 Thông tin API

Thuộc tính Giá trị
Endpoint {urlhost}/tiktok/rotate
Method POST
Content-Type application/json
Host URL Lấy từ GitHub
⚠️ Lưu ý: Host URL sẽ thay đổi thường xuyên, vui lòng luôn lấy URL mới nhất từ GitHub trước khi sử dụng.

📤 Dữ liệu gửi đi (Request)

{ "Base64anhTrong": "base64_string_of_inner_image", "Bade64anhNgoai": "base64_string_of_outer_image" }
Tham số Kiểu dữ liệu Mô tả
Base64anhTrong String Chuỗi base64 của ảnh bên trong (ảnh cần xoay)
Bade64anhNgoai String Chuỗi base64 của ảnh bên ngoài (ảnh khung tròn)

📥 Dữ liệu trả về (Response)

{ "success": true, "angle": 90, "base64ResultImage": "base64_string_of_solved_image" }
Tham số Kiểu dữ liệu Mô tả
success Boolean Trạng thái thành công của API
angle Integer Góc cần xoay để giải captcha (đơn vị: độ)
base64ResultImage String Chuỗi base64 của ảnh đã được giải

🖼️ Demo ảnh minh họa

1. Ảnh ngoài

Ảnh ngoài - Khung tròn

Mô tả: Ảnh khung tròn bên ngoài với vùng trống ở giữa

Tham số: Bade64anhNgoai

2. Ảnh trong

Ảnh trong - Hình tròn

Mô tả: Ảnh khung tròn bên trong

Tham số: Bade64anhTrong

2. Ảnh Kết quả

Demo kết quả

Mô tả: Kết quả mẫu

Tham số: base64ResultImage

🐍 Ví dụ code Python

import requests import base64 from PIL import Image from io import BytesIO def get_current_host(): """Lấy URL host hiện tại từ GitHub""" try: response = requests.get('https://raw.githubusercontent.com/dacohacotool/host_kk/refs/heads/main/url_serverkey.txt') return response.text.strip() except Exception as e: raise Exception(f"Không thể lấy host URL: {e}") def image_to_base64(image_path): """Chuyển đổi ảnh thành base64""" with open(image_path, "rb") as image_file: encoded_string = base64.b64encode(image_file.read()) return encoded_string.decode('utf-8') def solve_tiktok_captcha(inner_image_path, outer_image_path): """Gọi API giải captcha TikTok""" try: # Lấy host URL host_url = get_current_host() # Chuyển ảnh thành base64 inner_base64 = image_to_base64(inner_image_path) outer_base64 = image_to_base64(outer_image_path) # Chuẩn bị dữ liệu data = { 'Base64anhTrong': inner_base64, 'Bade64anhNgoai': outer_base64 } # Gọi API response = requests.post( f"{host_url}/tiktok/rotate", json=data, headers={'Content-Type': 'application/json'} ) result = response.json() return result except Exception as e: print(f"Lỗi khi gọi API: {e}") return {"success": False, "error": str(e)} def save_result_image(base64_string, output_path): """Lưu ảnh kết quả từ base64""" try: image_data = base64.b64decode(base64_string) image = Image.open(BytesIO(image_data)) image.save(output_path) print(f"Đã lưu ảnh kết quả: {output_path}") except Exception as e: print(f"Lỗi khi lưu ảnh: {e}") # Ví dụ sử dụng if __name__ == "__main__": # Đường dẫn ảnh inner_image = "path/to/inner_image.png" # Ảnh trong outer_image = "path/to/outer_image.png" # Ảnh ngoài # Gọi API result = solve_tiktok_captcha(inner_image, outer_image) if result.get("success"): print(f"✅ Thành công!") print(f"Góc cần xoay: {result['angle']}°") # Lưu ảnh kết quả save_result_image(result['base64ResultImage'], "solved_captcha.png") else: print(f"❌ Thất bại: {result.get('error', 'Không xác định')}")

💻 Ví dụ code JavaScript

// Lấy URL host hiện tại async function getCurrentHost() { const response = await fetch('https://raw.githubusercontent.com/dacohacotool/host_kk/refs/heads/main/url_serverkey.txt'); const hostUrl = await response.text(); return hostUrl.trim(); } // Hàm chuyển file thành base64 function fileToBase64(file) { return new Promise((resolve, reject) => { const reader = new FileReader(); reader.readAsDataURL(file); reader.onload = () => resolve(reader.result.split(',')[1]); reader.onerror = error => reject(error); }); } // Gọi API giải captcha async function solveCaptcha(innerImageBase64, outerImageBase64) { try { const hostUrl = await getCurrentHost(); const response = await fetch(`${hostUrl}/tiktok/rotate`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ 'Base64anhTrong': innerImageBase64, 'Bade64anhNgoai': outerImageBase64 }) }); const result = await response.json(); return result; } catch (error) { console.error('Lỗi khi gọi API:', error); return { success: false, error: error.message }; } }

🧪 Test API

Tải lên 2 ảnh để test API giải captcha xoay TikTok

📁 Tải ảnh ngoài (Khung tròn)

📁 Tải ảnh trong (Hình cần xoay)

📊 Kết quả: