Most Chinese video platforms don't give you a usable transcript. Douyin's subtitle endpoint needs signed requests and a valid session. Bilibili's CC/AI subtitles return an empty array for anonymous requests — you need a logged-in SESSDATA cookie. And even when you do get subtitles, they cover maybe 20% of uploads.
So you end up writing the same pipeline over and over: download video → extract audio → run Whisper → stitch timestamps together. Each step has its own failure mode.
There is a way to skip all of it.
What this gets you
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"]) # full transcript
print(item["segments"]) # timestamped chunks
One HTTP call. No API key for the transcription service, no cookie handling, no ffmpeg, no model downloads.
The output shape
One JSON object per video:
{
"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
}
Two fields worth paying attention to:
-
segmentscarries second-level timestamps, so you can cite a specific moment rather than a wall of text. -
qualityCheckis a self-check flag. It'strueonly when the transcript is non-empty and the last timestamp falls within 1.25× the audio duration. If a platform returns a placeholder or a truncated file, this goesfalseinstead of silently giving you garbage.
Supported inputs
| Input | Example |
|---|---|
| Douyin video | https://www.douyin.com/video/7534679152504376595 |
| Douyin short link |
https://v.douyin.com/xxxxx/ (redirects are followed) |
| Bilibili video | https://www.bilibili.com/video/BV1MzWU65Ewn |
| Bilibili ID |
BV1MzWU65Ewn / av170001
|
| Direct media |
https://.../video.mp4, .m4a, .mp3, .wav, .m3u8
|
Batch up to 50 per run (maxItems). One failure doesn't abort the batch — it comes back as an errorCode with a hint while the rest keep going.
Recipe: video → RAG chunks
The reason I wanted timestamps in the first place was chunking. Splitting a transcript by character count breaks sentences; splitting on segment boundaries doesn't.
run = client.actor("jfishpw/chinese-video-transcript").call(
run_input={
"videoUrls": ["https://www.bilibili.com/video/BV1MzWU65Ewn"],
"modelSize": "base",
"withTimestamps": True,
},
)
chunks = []
for video in client.dataset(run["defaultDatasetId"]).iterate_items():
if not video.get("hasTranscript"):
continue
for seg in video.get("segments") or []:
chunks.append({
"content": seg["text"],
"metadata": {
"source": video["url"],
"title": video["title"],
"start": seg["start"],
"end": seg["end"],
},
})
print(f"{len(chunks)} chunks ready for the vector store")
Recipe: generating subtitles
Same data, SRT out:
def to_srt(segments):
def ts(seconds):
h, rem = divmod(int(seconds), 3600)
m, s = divmod(rem, 60)
ms = int((seconds - int(seconds)) * 1000)
return f"{h:02d}:{m:02d}:{s:02d},{ms:03d}"
return "".join(
f"{i}\n{ts(seg['start'])} --> {ts(seg['end'])}\n{seg['text']}\n\n"
for i, seg in enumerate(segments, 1)
)
Recipe: scraping competitor scripts
A common reason to want this: seeing what a competitor's video actually says.
import csv
run = client.actor("jfishpw/chinese-video-transcript").call(
run_input={"videoUrls": competitor_urls, "modelSize": "base"},
)
with open("scripts.csv", "w", newline="", encoding="utf-8") as fh:
writer = csv.writer(fh)
writer.writerow(["title", "url", "duration", "text"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
writer.writerow([item["title"], item["url"], item["durationSec"], item["text"]])
Accuracy and cost knobs
| Setting | Default | Notes |
|---|---|---|
modelSize |
base |
tiny is fastest/cheapest, small is most accurate and most expensive |
language |
zh |
zh / auto / en
|
withTimestamps |
true |
Segment boundaries |
includeMetadata |
true |
Title, author, view/like counts |
maxDurationSec |
300 |
Longer videos are skipped before download, so you don't pay for them |
Pricing is $0.008 per transcript plus $0.01 per minute of audio. A one-minute video lands around $0.018. Failed items, skipped videos, and unsupported sources don't bill.
Things that don't work (yet)
-
Xiaohongshu — returns
UNSUPPORTED_SOURCE, no charge -
Silent video / music only — returns
EMPTY_TRANSCRIPT, no charge -
Videos over
maxDurationSec— returnsMEDIA_TOO_LONG, rejected before download, no charge
One more thing worth knowing: Bilibili's own subtitles are not used, even when they exist. The anonymous subtitle endpoint returns empty, and going through a logged-in cookie adds a credential you don't want to manage. Running ASR on the audio directly means every video gets a transcript, and the output is consistent across platforms.
Calling it from your AI agent
Via Apify's MCP server, Claude and Cursor can call it as a tool:
claude mcp add --transport http apify "https://mcp.apify.com?tools=jfishpw/chinese-video-transcript"
{
"mcpServers": {
"apify": {
"url": "https://mcp.apify.com?tools=jfishpw/chinese-video-transcript"
}
}
}
Then just say "transcribe this Bilibili video" and let the agent handle it.
Links
- Actor: https://apify.com/jfishpw/chinese-video-transcript
- Try it with a prefilled Bilibili URL: https://apify.com/jfishpw/chinese-video-transcript/examples/bilibili-video-to-text
- The RAG-focused example: https://apify.com/jfishpw/chinese-video-transcript/examples/video-transcript-for-rag
- Runnable scripts: https://github.com/jfishpw/chinese-video-transcript-examples
The Actor is pay-per-event, so you only pay for transcripts you actually get.
Top comments (0)