B 站视频转文字(逐字稿)接口
提取任意公开 B 站视频的完整逐字稿与分段字幕(优先原生字幕,缺失时自动语音转写)。每次 14 积分,失败不扣费。 通过 POST /v1/call/bilibili.transcript 或 MCP 的 call 工具直接调用,每次成功消耗 14 积分,调用失败不扣费。
返回字段
| 字段 | 类型 | 含义 |
|---|---|---|
text | string | 完整口播逐字稿全文 |
segments | array | 带起止时间的分段列表 |
source | string | 字幕来源(原生字幕或语音识别) |
media_urls | array | 提取到的音视频源地址 |
请求示例
接口地址:POST https://socialtoai.app/v1/call/bilibili.transcript,传入 id 参数及 Idempotency-Key 请求头即可:
curl -X POST "https://socialtoai.app/v1/call/bilibili.transcript" \
-H "Authorization: Bearer $SOCIALTOAI_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"id": "BV1xx411c7mD"}'Python 示例
import os, uuid, requests
resp = requests.post(
"https://socialtoai.app/v1/call/bilibili.transcript",
headers={
"Authorization": f"Bearer {os.environ['SOCIALTOAI_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={"id": "BV1xx411c7mD"},
timeout=30,
)
print(resp.json())在 MCP 中使用
在 Claude、ChatGPT、Cursor 或 Codex 中连接 https://socialtoai.app/mcp 后,直接发送公开链接让 AI 调用 call 工具(op="bilibili.transcript")即可获取结果。