room_idstring必填
Room ID
https://api.sandbase.ai/v1/api/douyin/web/generate-wss-xb-signatureReturns a signed xb parameter for Douyin web barrage WebSocket connections using a specified room ID, user browser agent, and unique user identifier.
[
{
"data": {
"x_bogus": "6M1MxCZygNhw8QPX"
}
}
]选择一个示例,将其输入和结果加载到 playground 中。
Returns a signature string for a Douyin live room barrage (danmaku) WebSocket connection. It needs a room_id, a browser user_agent string, and a user_unique_id.
user_agent you send in your WebSocket headers.curl -X POST "https://api.sandbase.ai/v1/api/douyin/web/generate-wss-xb-signature" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"room_id": "7382517534467115826", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0", "user_unique_id": "7382524529011246630"}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
room_id | string | Yes | Room ID |
user_agent | string | Yes | User browser agent |
user_unique_id | string | Yes | User unique ID |
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"x_bogus": "6kux4VFjvCR1Mnox"
}
| Field | Meaning |
|---|---|
x_bogus | The signature string. The response holds only this one key, and its value is a short string such as 6kux4VFjvCR1Mnox. |
x_bogus | The value is built from the room_id, user_agent, and user_unique_id you sent. A different input set gives a different signature. |
x_bogus | Use this value as the xb signature in the barrage WebSocket connection for that room. |
room_id with Douyin Webcast ID to Room ID.user_agent and user_unique_id in the WebSocket connection that you used to create the signature.$0.001 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.
开始构建
具备统一身份验证和使用情况跟踪的平台 API 端点。
curl -X POST "https://api.sandbase.ai/v1/api/douyin/web/generate-wss-xb-signature" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"room_id": "example",
"user_agent": "example",
"user_unique_id": "example"
}'将您的 SandBase API 密钥设置到服务器环境中。请求使用 Bearer 身份验证。
export SANDBASE_API_KEY="YOUR_API_KEY"请将密钥保存在服务器端。不要在浏览器代码中暴露它。
room_idstring必填Room ID
user_agentstring必填User browser agent
user_unique_idstring必填User unique ID
这是该 API 保存的示例响应;查看时不会发起实时请求。
[
{
"data": {
"x_bogus": "6M1MxCZygNhw8QPX"
}
}
]探索更多
| API | 价格 | 响应 |
|---|---|---|
Douyin | $0.001 每次调用 | JSON |
Douyin | $0.001 每次调用 | JSON |
Douyin | $0.001 每次调用 | JSON |
Douyin | $0.001 每次调用 | JSON |
Douyin | $0.001 每次调用 | JSON |
Douyin | $0.03 每次调用 | JSON |
问题
向 https://api.sandbase.ai/v1/api/douyin/web/generate-wss-xb-signature 发送 POST 请求,在 Authorization 请求头中使用您的 SandBase API key(Bearer),并将参数作为 JSON 请求体传入。您也可以直接在本页的 Playground 中试用,无需编写代码。
每次调用 $0.001,从您的 SandBase 余额中扣费。您只需为实际调用付费;无需订阅。
必填:room_id (string), user_agent (string) 和 user_unique_id (string)。 Parameters 表和本页的 Playground 列出了每个字段。
在同一个 HTTP 请求中返回的 JSON 响应(同步)。 本页的 README 包含一个示例响应。
不需要。Douyin Barrage WSS XB Signature 通过 SandBase 运行,因此一个 SandBase API key 即可覆盖此端点以及目录中的其他所有 API 和模型。您无需单独申请 Douyin API 访问权限。