[YouTube][Loon] Official 模式下需要翻译的视频报「加载字幕时出错」,ShowOnly=on 正常(疑似 Composite 内部请求残留 subtype 参数) #45
mashutong
started this conversation in
General 综合
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
TL;DR (English)
On Loon + the YouTube iOS app with
Type=Official,AutoCC=on,ShowOnly=off, every video that lacks a target-language caption track (i.e. actually needs translation) fails with the in-app error "加载字幕时出错" (Error loading subtitles). TurningShowOnlyon (passthrough of the tlang-translated response, no compositing) works, andTranslatemode works — so YouTube's server-side auto-translation succeeds and the failure is isolated to the dual-subtitle compositing path inComposite.Subtitles.response.js. Since every parse/merge exception in that script is caught by the top-levelcatchand would gracefully fall back to the single-language body, a client-visible error suggests the script never reacheddone()(killed on timeout), pointing at the internal re-fetch of the original subtitle. That request is built by only deletingtlang— the plugin's ownsubtype=Officialrouting parameter is left on the URL. Suggested one-line fix:url.searchParams.delete("subtype")before constructing the internal request.环境
Composite.Subtitles.response.js等的压缩版)Official、自动显示翻译字幕on、仅显示"自动翻译"字幕off、原文字幕位置Forward现象
排查(A/B 测试)
Official+ShowOnly=off(走 Composite 双语合成)Official+ShowOnly=on(机翻响应透传,不合成)Translate模式结论:注入
tlang后 YouTube 服务端返回的官方机翻响应本身是正常的,问题被隔离在 Composite 双语合成环节。分析(推测,未在 Loon 内核层面验证)
Composite.Subtitles.response.js中所有解析/合并异常都会被顶层.catch(e => Console.error(e)).finally(() => done($response))兜住,任何一步抛错都应降级为"只显示机翻单语字幕"(即与ShowOnly=on表现一致),而不是客户端报错。客户端能看到报错,更可能是脚本未正常done()(执行超时被强杀),指向内部重取原文字幕的请求挂起。tlang,插件自己注入的路由参数subtype=Official残留在 URL 上(src/Composite.Subtitles.response.js#L84-L90):若脚本发起的请求在 Loon 中会再次经过 rewrite/script 规则,残留的
subtype=Official会再次命中timedtext\?(.*)subtype=(Official|External)的 http-response 规则,造成递归/挂起;即使不会二次匹配,内部路由标记参数也不宜发给服务端。建议修复
构造内部请求前清理路由参数(一行):
如需 Loon 脚本日志或抓包进一步定位,我可以补充。
Beta Was this translation helpful? Give feedback.
All reactions