Binance - Binance captcha

-
CapMonster Cloud 默认通过内置代理工作——这些代理已包含在费用内。仅当网站不接受令牌或对内置服务的访问受限时,才需要指定您自己的代理。
-
如果代理按 IP 授权,请将地址 65.21.190.34 加入白名单。
-
仅可使用您的账户登录。
请求参数
重要提示:某些参数的值是动态的 — 它们会在每次渲染包含 Binance 的页面时发生变化。
请在创建任务前立即提取这些参数,以避免在解决过程中出现错误。
参数提取示例请参见章节 如何获取 websiteKey 和 validateId。
type<string>requiredBinanceTask
websiteURL<string>required解决 CAPTCHA 的主页面地址。
websiteKey<string>required您网站相应部分的唯一参数。其值为 bizId、bizType 或 bizCode 参数的值。可从流量中获取(参见下方说明)。
格式示例:login
validateId<string>required动态密钥。其值为 validateId、securityId 或 securityCheckResponseValidateId 参数的值。可从流量中获取(参见下方说明)。
格式示例:cb0bfefa598b4c3887661fde54ecd57b
userAgent<string>optional浏览器 User-Agent。请使用 CapMonster Cloud 当前支持的值:userAgentPlaceholder
可通过以下地址获取最新值:https://capmonster.cloud/api/useragent/actual。
proxyType<string>optionalhttp - 普通的 http/https 代理;
https - 仅在 "http" 不起作用时尝试(某些自定义代理服务器要求);
socks4 - socks4 代理;
socks5 - socks5 代理。
proxyAddress<string>optional代理 IP 地址 IPv4/IPv6。不允许:
- 使用透明代理(其中客户端 IP 可见);
- 使用来自本地网络的代理。
proxyPort<integer>optional代理端口。
proxyLogin<string>optional代理登录。
proxyPassword<string>optional代理密码。
创建任务方法
- BinanceTask(无代理)
- BinanceTask(使用代理时)
https://api.capmonster.cloud/createTask
请求示例
{
"clientKey": "API_KEY",
"task": {
"type": "BinanceTask",
"websiteURL": "https://yourwebsite.com/page-with-binance",
"websiteKey": "your-website-key",
"validateId": "your-validate-id",
"userAgent": "userAgentPlaceholder"
}
}
响应示例
{
"errorId":0,
"taskId":407533072
}
https://api.capmonster.cloud/createTask
请求示例
{
"clientKey": "API_KEY",
"task": {
"type": "BinanceTask",
"websiteURL": "https://yourwebsite.com/page-with-binance",
"websiteKey": "your-website-key",
"validateId": "your-validate-id",
"userAgent": "userAgentPlaceholder",
"proxyType": "your-proxy-type",
"proxyAddress": "your-proxy-address",
"proxyPort": 1234,
"proxyLogin": "your-proxy-login",
"proxyPassword": "your-proxy-password",
"userAgent": "userAgentPlaceholder"
}
}
响应示例
{
"errorId":0,
"taskId":407533072
}
获取任务结果方法
使用方法 getTaskResult 获取币安解决方案。
https://api.capmonster.cloud/getTaskResult
请求示例
{
"clientKey":"API_KEY",
"taskId": 407533072
}
响应示例
{
"errorId": 0,
"status": "ready",
"solution": {
"token": "captcha#09ba4905a79f44f2a99e44f234439644-ioVA7neog7eRHCDAsC0MixpZvt5kc99maS943qIsquNP9D77",
"userAgent": "userAgentPlaceholder"
}
}
如何获取 websiteKey 和 validateId
启用开发者工具,进入 "Network"(网络)标签,激活 CAPTCHA,然后查看请求。有些请求会包含所需的参数值。 例如,参数:
bizCode: "CMC_register", securityId: "09295759baca4d4fbeae80d9ffeaefd8"

或者
bizId: "CMC_register", securityCheckResponseValidateId: "09295759baca4d4fbeae80d9ffeaefd8"

或者
bizType: "login", validateId: "ff965ea6216b46f3825fa827ecaf297f"

或者
bizId: "login", securityCheckResponseValidateId: "ff965ea6216b46f3825fa827ecaf297f"
要解决验证码所需的参数可以通过执行 JavaScript 获得:
let originalBCaptcha = window.BCaptcha;
let BCaptchaData;
Object.defineProperty(window, 'BCaptcha', {
get: function() {
return function(args) {
const BCaptcha = new originalBCaptcha(args);
let BCaptchaShow = BCaptcha.__proto__.show
BCaptcha.__proto__.show = function(args) {
BCaptchaData = args;
return 1;
};
return BCaptcha;
};
}
});
然后,您可以像这样检索参数,例如 BCaptchaData.securityCheckResponseValidateId.
使用 SDK 库
- JavaScript / TypeScript
- Python
- C#
显示代码(浏览器)
// https://github.com/CapMonsterCloud/capmonster-nodejs-captcha-solver
import {
CapMonsterCloudClientFactory,
ClientOptions,
BinanceRequest
} from "@zennolab_com/capmonstercloud-client";
document.addEventListener("DOMContentLoaded", async () => {
const API_KEY = "YOUR_API_KEY"; // 请指定您的 CapMonster Cloud API 密钥
const client = CapMonsterCloudClientFactory.Create(
new ClientOptions({ clientKey: API_KEY })
);
// 不使用代理的基础示例
// CapMonster Cloud 会自动使用自己的代理
let binanceRequest = new BinanceRequest({
websiteURL: "https://yourwebsite.com/page-with-binance-captcha",
websiteKey: "your-website-key",
validateId: "your-validate-id",
});
// 使用您自己的代理的示例
// 如果您想使用自己的代理,请取消注释此代码块
/*
const proxy = {
proxyType: "http",
proxyAddress: "123.45.67.89",
proxyPort: 8080,
proxyLogin: "username",
proxyPassword: "password",
};
binanceRequest = new BinanceRequest({
websiteURL: "https://yourwebsite.com/page-with-binance-captcha",
websiteKey: "your-website-key",
validateId: "your-validate-id",
proxy,
});
*/
// 如有需要,可以检查余额
const balance = await client.getBalance();
console.log("Balance:", balance);
const result = await client.Solve(binanceRequest);
console.log("Solution:", result.solution);
});
显示代码(Node.js)
// https://github.com/CapMonsterCloud/capmonster-nodejs-captcha-solver
const {
CapMonsterCloudClientFactory,
ClientOptions,
BinanceRequest,
} = require("@zennolab_com/capmonstercloud-client");
const API_KEY = "YOUR_API_KEY"; // 请指定您的 CapMonster Cloud API 密钥
async function solveBinanceCaptcha() {
const client = CapMonsterCloudClientFactory.Create(
new ClientOptions({ clientKey: API_KEY }),
);
// 不使用代理的基础示例
// CapMonster Cloud 会自动使用自己的代理
let binanceRequest = new BinanceRequest({
websiteURL: "https://yourwebsite.com/page-with-binance-captcha",
websiteKey: "your-website-key",
validateId: "your-validate-id",
});
// 使用您自己的代理的示例
// 如果您想使用自己的代理,请取消注释此代码块
/*
const proxy = {
proxyType: "http",
proxyAddress: "123.45.67.89",
proxyPort: 8080,
proxyLogin: "username",
proxyPassword: "password",
};
binanceRequest = new BinanceRequest({
websiteURL: "https://yourwebsite.com/page-with-binance-captcha",
websiteKey: "your-website-key",
validateId: "your-validate-id",
proxy,
});
*/
// 如有需要,可以检查余额
const balance = await client.getBalance();
console.log("Balance:", balance);
const result = await client.Solve(binanceRequest);
console.log("Solution:", result.solution);
}
solveBinanceCaptcha().catch(console.error);
显示代码
# https://github.com/CapMonsterCloud/capmonster-python-captcha-solver
import asyncio
from capmonstercloudclient import CapMonsterClient, ClientOptions
from capmonstercloudclient.requests import BinanceTaskRequest
# 如果您计划使用自己的代理,请导入 ProxyInfo
from capmonstercloudclient.requests.proxy_info import ProxyInfo
API_KEY = "YOUR_API_KEY" # 请指定您的 CapMonster Cloud API 密钥
async def solve_binance_captcha():
client = CapMonsterClient(
options=ClientOptions(api_key=API_KEY)
)
# 不使用代理的基础示例
# CapMonster Cloud 会自动使用自己的代理
binance_request = BinanceTaskRequest(
websiteUrl="https://yourwebsite.com/page-with-binance-captcha",
websiteKey="your-website-key",
validateId="your-validate-id",
)
# 使用您自己的代理的示例
# 如果您想使用自己的代理,请取消注释此代码块
"""
proxy = ProxyInfo(
proxyType="http",
proxyAddress="123.45.67.89",
proxyPort=8080,
proxyLogin="username",
proxyPassword="password",
)
binance_request = BinanceTaskRequest(
websiteUrl="https://yourwebsite.com/page-with-binance-captcha",
websiteKey="your-website-key",
validateId="your-validate-id",
proxy=proxy,
)
"""
# 如有需要,可以检查余额
balance = await client.get_balance()
print("Balance:", balance)
result = await client.solve_captcha(binance_request)
print("Solution:", result)
asyncio.run(solve_binance_captcha())
显示代码
// https://github.com/CapMonsterCloud/capmonster-dotnet-captcha-solver
using System;
using System.Threading.Tasks;
using Zennolab.CapMonsterCloud;
using Zennolab.CapMonsterCloud.Requests;
class Program
{
static async Task Main(string[] args)
{
// 请指定您的 CapMonster Cloud API 密钥
var clientOptions = new ClientOptions
{
ClientKey = "YOUR_API_KEY"
};
var cmCloudClient = CapMonsterCloudClientFactory.Create(clientOptions);
// 不使用代理的基础示例
// CapMonster Cloud 会自动使用自己的代理
var binanceRequest = new BinanceTaskRequest
{
WebsiteUrl = "https://yourwebsite.com/page-with-binance-captcha",
WebsiteKey = "your-website-key",
ValidateId = "your-validate-id",
UserAgent = "userAgentPlaceholder"
};
// 使用您自己的代理的示例
// 如果您想使用自己的代理,请取消注释此代码块
/*
binanceRequest = new BinanceTaskRequest
{
WebsiteUrl = "https://yourwebsite.com/page-with-binance-captcha",
WebsiteKey = "your-website-key",
ValidateId = "your-validate-id",
UserAgent = "userAgentPlaceholder",
Proxy = new ProxyContainer(
"123.45.67.89",
8080,
ProxyType.Http,
"username",
"password"
)
};
*/
// 如有需要,可以检查余额
var balance = await cmCloudClient.GetBalanceAsync();
Console.WriteLine("Balance: " + balance);
var binanceResult = await cmCloudClient.SolveAsync(binanceRequest);
Console.WriteLine("Solution: " + binanceResult.Solution.Value);
}
}
