# 抖音/B站视频转文字 — Douyin & Bilibili Transcript API (`jfishpw/chinese-video-transcript`) Actor

Douyin (抖音) & Bilibili video links to clean Chinese transcripts for LLM, RAG and search. Works out of the box — no API key, no signup on your side. Returns full text, timestamped segments, metadata and a quality self-check field; batch up to 50 videos. B站音频下载与语音识别在 Apify 容器内完成，抖音走服务端直出，无需任何第三方配置。

- **URL**: https://apify.com/jfishpw/chinese-video-transcript.md
- **Developed by:** [peng wang](https://apify.com/jfishpw) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $8.00 / 1,000 transcript results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## 抖音/B站视频转文字 — Douyin & Bilibili Transcript API

把 **抖音 / B站视频链接** 或直链媒体（mp4/m4a/m3u8）变成**干净、带时间戳的中文文字稿**，输出统一 JSON schema，直接喂给 LLM / RAG / 向量库 / 搜索引擎。

**开箱即用，无需任何配置、无需注册任何第三方服务。** 抖音与 B站路径全部由服务端处理，你只需提供视频链接；B站音频下载和语音识别全部在 Apify 容器内完成。

**价格：`$0.008` 每条 + `$0.01` 每分钟**（按成功产出的文字稿计费，失败/超时/不支持的输入不计费）。

> 中文用户常搜的词都埋在这里：抖音视频转文字 / 抖音文案提取 / 抖音字幕 / B站视频转文字 / B站字幕提取 / 中文视频转文字 / 视频文案 / Douyin transcript / Bilibili transcript / Chinese speech to text / ASR / LLM / RAG

### 它能做什么

- 输入抖音视频 URL / 分享短链（v.douyin.com）→ 服务端直出转写文案（秒级返回，含标题元数据）
- 输入 B站视频 URL / BV 号 / av 号 → 自动解析音频 → 本地 Whisper 转写
- 输入直链媒体 URL（mp4 / m4a / mp3 / wav / m3u8）→ 直接转写
- 输出：完整文字 `text` + 带时间戳 `segments` + 自证字段 `qualityCheck` / `hasTranscript`
- 单条失败只返回 `errorCode` + `hint`，不影响同一批次其他视频

### 用它做什么（Use cases）

| 你的目标 | 怎么做 | 大概花多少 |
|---|---|---|
| **喂给 LLM / RAG 建知识库** | 传视频链接，拿到 `text` + `segments`，直接写进向量库；`segments` 带时间戳，可以做片段级引用 | 1 分钟视频 ≈ $0.018 |
| **扒竞品的口播文案** | 批量传竞品视频链接，一次最多 50 条，一条一个 JSON 行 | 每条 ≈ $0.008 + 时长费 |
| **给无字幕视频补字幕** | B站视频默认没有可用字幕（匿名接口恒返回空），这个 Actor 直接用 ASR 出稿 | 同上 |
| **搜索/内容审核流水线** | 视频链接 → 文字稿 → 关键词过滤/情感分析/合规检查 | 同上 |
| **会议/课程/直播回放存档** | 直链 mp4/m4a 也支持，转成可全文检索的文字 | 同上 |

> 不确定从哪开始？直接看下面的 **Task examples**，点开就能跑，链接已经预填好了。

### 常见问题（FAQ）

**需要配置 API key 或注册第三方服务吗？**
不需要。抖音和 B站两条路径的服务端凭据都内置在 Actor 里，你只需要给视频链接。

**支持小红书吗？**
v1 不支持，输入会返回 `UNSUPPORTED_SOURCE` 且不计费。

**有字幕的视频会走字幕吗？**
不会。B站匿名接口的 CC/AI 字幕恒返回空（需要登录态 SESSDATA），所以统一用本地 ASR 转写，保证任何视频都有稿。

**视频没有说话 / 纯音乐会怎样？**
返回 `EMPTY_TRANSCRIPT`，不计费。

**转写结果准不准？**
每行都带 `qualityCheck` 字段（`hasTranscript` 且最后时间戳 ≤ 音频时长 × 1.25）。默认 `modelSize=base`，要更高准确度可改 `small`。

**一次能跑多少条？**
`maxItems` 默认 10，最大 50。单条失败不影响同批次其他视频。

**能接入我的 AI agent 吗？**
可以。通过 Apify MCP server 直接作为工具调用，见下方 [Connect to AI agents through MCP](#connect-to-ai-agents-through-mcp)。

### v1 明确不支持（避免误解）

| 输入 | v1 行为 |
|---|---|
| 小红书链接 | 返回 `UNSUPPORTED_SOURCE`，不计费（v1 暂不支持） |
| 无字幕/纯音乐 | 返回 `EMPTY_TRANSCRIPT`，不计费 |
| B站平台自带 CC/AI 字幕 | 不读取：匿名接口恒返回空，需 SESSDATA 登录态；v1 统一用 ASR |
| 超过 `maxDurationSec` 的视频 | 返回 `MEDIA_TOO_LONG`，在下载/转写前拦截，不计费 |
| 纯音乐 / 无人声 | 返回 `EMPTY_TRANSCRIPT`，不计费 |

### 输入示例

```json
{
  "videoUrls": [
    "https://www.douyin.com/video/7534679152504376595",
    "https://www.bilibili.com/video/BV1MzWU65Ewn"
  ],
  "modelSize": "base",
  "language": "zh",
  "withTimestamps": true,
  "includeMetadata": true,
  "maxItems": 10,
  "maxDurationSec": 300
}
```

- `modelSize`：`base`（默认，准确度与成本平衡）/ `tiny`（最快最便宜，错字较多）/ `small`（最准，算力最高）
- `language`：`zh`（默认）/ `auto` / `en`

### 怎么调用（API / SDK）

**Python**

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_API_TOKEN>")
run = client.actor("jfishpw/chinese-video-transcript").call(
    run_input={"videoUrls": ["https://www.bilibili.com/video/BV1MzWU65Ewn"]},
)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["text"])          # 完整文字稿
    print(item["segments"])      # 带时间戳的分段
```

**JavaScript**

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_API_TOKEN>' });
const run = await client.actor('jfishpw/chinese-video-transcript').call({
  videoUrls: ['https://www.bilibili.com/video/BV1MzWU65Ewn'],
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items[0].text);
```

**cURL**

```bash
curl "https://api.apify.com/v2/acts/jfishpw/chinese-video-transcript/runs?token=<YOUR_API_TOKEN>" \
  -X POST -H "Content-Type: application/json" \
  -d '{"videoUrls":["https://www.bilibili.com/video/BV1MzWU65Ewn"]}'
```

### 输出示例（dataset 一行）

```json
{
  "url": "https://www.bilibili.com/video/BV1MzWU65Ewn",
  "platform": "bilibili",
  "videoId": "BV1MzWU65Ewn",
  "title": "普通话水平测试网站（免费）",
  "author": "...",
  "durationSec": 23.8,
  "source": "asr",
  "modelSize": "base",
  "language": "zh",
  "text": "烤普通话,别再下毒了...",
  "segments": [{"start": 0.0, "end": 4.4, "text": "..."}],
  "segmentCount": 2,
  "charCount": 118,
  "billableMinutes": 1,
  "hasTranscript": true,
  "qualityCheck": true,
  "errorCode": null,
  "hint": null,
  "fetchedAt": "2026-11-18T07:15:00+00:00"
}
```

### 计费（PPE）

| 事件 | 价格 | 触发条件 |
|---|---|---|
| `transcriptResult` | **$0.008 / 条** | 成功产出的每个 transcript 行 |
| `transcriptMinute` | **$0.01 / 分钟** | 成功产出文字稿，按音频时长向上取整 |
| `apify-actor-start` | 平台默认 | 每次启动 |

失败项、超长视频、不支持的平台**不产生 transcript 事件费用**。先 push 数据再 charge。

举例：一条 1 分钟的 B站视频 ≈ $0.008 + $0.01 = **$0.018**。

### 技术说明

- 音频获取：`yt-dlp`（bestaudio）优先；失败时自动走 B站 API 备用链路
  （依次尝试 `api.bilibili.com` → `api.biliapi.net` → `api.bilibili.cn`）。
  **Apify 海外节点访问 `www.bilibili.com` 和 `api.bilibili.com` 都可能返回 HTTP 412**，
  镜像域名可以在不登录的情况下绕过；这是平台实测得出的结论。
- 代理：`proxyConfiguration` 输入使用 Apify 标准 proxy editor，默认 `RESIDENTIAL`。
  代理只用于绕过海外 IP 风控，URL 含凭据、绝不写日志。代理流量很小（一条 24 秒视频约 0.35 MB）。
- 语音识别：`faster-whisper`（CPU int8），模型 tiny/base/small 可选
- `av` 必须锁 15.1.0：faster-whisper 1.2.1 与 PyAV 19 不兼容（`metadata_errors` 参数错误）
- 质量自证：`qualityCheck = hasTranscript && 最后一个时间戳 <= 音频时长 × 1.25`

### 平台实测（2026-11-18，Apify 海外节点）

```
输入: BV1MzWU65Ewn (24 秒), modelSize=tiny, RESIDENTIAL proxy
结果: hasTranscript=true, qualityCheck=true, 115 字, 1 分钟计费
usage: 0.0227 CU, residential 0.00035 GB
chargedEventCounts: {"transcriptMinute": 1, "transcriptResult": 1}
```

结论：本地 PASS 不够，必须在 Apify 平台跑一次——这正是此项目踩到的 412 坑。

### Connect to AI agents through MCP

把这个 Actor 直接接到 Claude Code / Cursor / Claude Desktop 等 AI agent，不用写任何胶水代码：

```bash
## Claude Code
claude mcp add --transport http apify "https://mcp.apify.com?tools=jfishpw/chinese-video-transcript"

## Claude Desktop / Cursor / VS Code (JSON 配置)
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=jfishpw/chinese-video-transcript"
    }
  }
}
```

选中该 Actor 后，MCP server 还会附带 `get-actor-run`、`get-dataset-items`、`abort-actor-run` 等辅助工具。
直接对 agent 说「把这个 B站视频转成文字稿」即可。

### 关键词

中文视频转文字 / B站字幕提取 / 视频文案 / 语音转写 / ASR / transcript / Bilibili / Chinese speech to text / LLM-ready / RAG / MCP

# Actor input Schema

## `videoUrls` (type: `array`):

Bilibili video URLs or BV/av IDs (built-in ASR), Douyin video/share links (https://www.douyin.com/video/... or https://v.douyin.com/...), or direct media URLs (mp4/m4a/m3u8). An empty list is a valid no-op run. No token configuration needed.

## `modelSize` (type: `string`):

tiny = fastest/cheapest, base = better accuracy (recommended default), small = best accuracy but slower and more compute.

## `language` (type: `string`):

zh = Chinese (default), auto = detect, en = English.

## `withTimestamps` (type: `boolean`):

Return segments with start/end seconds in addition to full text.

## `includeMetadata` (type: `boolean`):

Include public title, author, duration and view/like counts where available.

## `maxItems` (type: `integer`):

Cost guard: at most this many videos are processed in one run.

## `maxDurationSec` (type: `integer`):

Videos longer than this are skipped with MEDIA_TOO_LONG; protects your budget.

## `proxyConfiguration` (type: `object`):

Bilibili blocks Apify datacenter IPs with HTTP 412 and Douyin risk-controls unknown IPs. Use Apify Proxy with the RESIDENTIAL group for B站 and 抖音 URLs. Direct media URLs work without proxy.

## Actor input object example

```json
{
  "videoUrls": [],
  "modelSize": "base",
  "language": "zh",
  "withTimestamps": true,
  "includeMetadata": true,
  "maxItems": 10,
  "maxDurationSec": 300,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `transcripts` (type: `string`):

Each record contains the clean transcript text, timed segments and quality checks.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("jfishpw/chinese-video-transcript").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("jfishpw/chinese-video-transcript").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call jfishpw/chinese-video-transcript --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,jfishpw/chinese-video-transcript"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/zMNuDCfHdG8tyNRfc/builds/Vza8nXtfZjDInDOwQ/openapi.json
