jackwener/OpenCLI · info · EmptyResultError
此视频没有发现外挂或智能字幕。
Error message
此视频没有发现外挂或智能字幕。
What it means
This is an EmptyResultError thrown by the bilibili subtitle command when the Bilibili player API returns a subtitle list that is an empty array. The library uses it to distinguish 'video genuinely has no subtitles' from an authentication problem: if subtitles are hidden behind login it throws AuthRequiredError instead. It means the request succeeded but no external (外挂) or AI-generated (智能) subtitle tracks exist for this video.
Source
Thrown at clis/bilibili/subtitle.js:67
catch (err) {
throw new CommandExecutionError(`获取视频播放信息失败: ${err?.message || err}`);
}
if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
throw new CommandExecutionError('获取到的视频播放信息对象不符合预期格式');
}
if (payload.code !== 0) {
throw new CommandExecutionError(`获取视频播放信息失败: ${payload.message} (${payload.code})`);
}
const needLoginSubtitle = payload.data?.need_login_subtitle === true;
const subtitles = payload.data?.subtitle?.subtitles;
if (!Array.isArray(subtitles)) {
throw new CommandExecutionError('获取到的字幕列表对象不符合数组格式');
}
if (subtitles.length === 0) {
if (needLoginSubtitle) {
throw new AuthRequiredError('bilibili.com', 'Bilibili subtitles are hidden behind login for this video. Please log in to bilibili.com in Chrome and retry.');
}
throw new EmptyResultError('bilibili subtitle', '此视频没有发现外挂或智能字幕。');
}
// 3. 选择目标字幕语言
const target = kwargs.lang
? subtitles.find((s) => s.lan === kwargs.lang) || subtitles[0]
: subtitles[0];
if (!target || typeof target !== 'object' || !Object.hasOwn(target, 'subtitle_url')) {
throw new CommandExecutionError('字幕条目缺少 subtitle_url 字段');
}
const targetSubUrl = typeof target.subtitle_url === 'string' ? target.subtitle_url.trim() : '';
if (!targetSubUrl) {
throw new AuthRequiredError('bilibili.com', '[风控拦截/未登录] 获取到的 subtitle_url 为空!请确保 CLI 已成功登录且风控未封锁此账号。');
}
const finalUrl = targetSubUrl.startsWith('//') ? 'https:' + targetSubUrl : targetSubUrl;
if (!/^https?:\/\//i.test(finalUrl)) {
throw new CommandExecutionError(`字幕 URL 非法: ${finalUrl}`);
}
// 4. 解析并拉取 CDN 的 JSON 文件
const fetchJs = `View on GitHub (pinned to 49907e53dc)
Solutions
- Confirm the video actually has subtitles by checking manually in the web player (CC button / 字幕 menu).
- Try a different video or different cid (e.g. multi-P videos need the right page).
- If subtitles should exist, log in to bilibili.com in Chrome and retry — some subtitle data is only returned to logged-in sessions.
- Handle EmptyResultError in your wrapper and treat it as 'no subtitles available' rather than a failure.
Example fix
// before
await run('bilibili subtitle', { url });
// after
try {
await run('bilibili subtitle', { url });
} catch (e) {
if (e instanceof EmptyResultError) return null; // video has no subtitles
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
// No pre-call validation possible; check the video has a CC button in the web player first.
Try / catch
try {
const subs = await run('bilibili subtitle', { url });
} catch (e) {
if (e.name === 'EmptyResultError') return null; // no subtitles for this video
throw e;
} Prevention
- Check the video's CC/字幕 menu manually before automating.
- Log in to bilibili.com in Chrome so login-gated subtitles are returned.
- Treat EmptyResultError as a normal 'no data' outcome, not a crash.
- For multi-P videos, ensure the correct page/cid is targeted.
When it happens
Trigger: Calling the bilibili subtitle CLI for a video whose /player/wbi/v2 API returns subtitles: [] — i.e. the uploader added no CC subtitles and Bilibili generated no AI subtitles.
Common situations: Fetching subtitles for fan-uploaded videos without CC tracks; videos where the uploader disabled subtitles; regional restriction where AI subtitle generation is unavailable; recently uploaded videos where AI subtitles have not been generated yet.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- 字幕文件中没有字幕片段。
- bilibili pinned comments: ${bvid}
- bilibili comment replies: ${parent}
- bilibili creator-stats ${bvid}
- 字幕条目缺少 subtitle_url 字段
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/75581819878b7697.
Report an issue: GitHub.