Non-English videos transcribe the English auto-translation instead of native captions (+ cp949 crash, unescaped entities)
Three issues hit while running /watch on a Korean YouTube video on Windows (Korean locale, cp949). Tested with v0.2.0, --detail transcript.
Test video: https://youtu.be/xT5iR-ZChLg (Korean, 36:18, has ko + ko-orig auto-captions among 159 languages).
1. Non-English videos get machine-translated captions, and the meaning flips
--sub-langs "en.*" is hardcoded in two places (download.py:78, download.py:135), and _pick_subtitle() then explicitly prefers .en. / .en-US. / .en-GB. / .en-orig.. So for a Korean video with native Korean captions available, /watch transcribes YouTube's English auto-translation instead of the original.
That is not just a fidelity loss — the translation inverts meaning:
| time | what /watch returns (en-US) |
Korean original (ko) | actual meaning |
|---|---|---|---|
| 00:02 | My stomach is about to explode. | 나 배폭발한다. | (same) |
| 00:10 | You said there's one more person? | 한 분 더 있다 하면서요. | (same) |
| 00:27 | We can't film today. | 오늘 찍어. | "Let's film today" — opposite |
Anyone quoting the transcript gets a sentence that means the reverse of what was said.
Fixing --sub-langs alone is not enough: with both tracks downloaded, sorted(out_dir.glob("video*.vtt")) puts video.en-US.vtt before video.ko.vtt alphabetically, so English still wins.
A minimal fix would be a --sub-lang CLI flag (and/or a WATCH_SUB_LANG env var) that feeds both the yt-dlp --sub-langs value and the _pick_subtitle() priority order, defaulting to today's English-first behavior. Locally I patched it as:
def _pick_subtitle(out_dir: Path) -> Path | None:
candidates = sorted(out_dir.glob("video*.vtt"))
if not candidates:
return None
for marker in (".ko-orig.", ".ko.", ".en.", ".en-US.", ".en-GB.", ".en-orig."):
for c in candidates:
if marker in c.name:
return c
return candidates[0]which is obviously not the general fix — the language list should be configurable rather than hardcoded to another single language.
2. UnicodeEncodeError on Windows consoles that are not UTF-8
watch.py:387 prints an em-dash:
print(f"_Work dir: `{work}` — delete when done._")On a Korean Windows install, Python's stdout defaults to cp949 and the script dies on that last line:
File "...\watch.py", line 387, in main
print(f"_Work dir: `{work}` — delete when done._")
UnicodeEncodeError: 'cp949' codec can't encode character '—' in position 58: illegal multibyte sequenceExit code is 1 even though the whole report (51 KB) was already written, so a caller that checks the exit status treats a successful run as a failure. watch.py:98 prints … (U+2026) too, and any non-ASCII video title hits the same path.
This affects every non-UTF-8 Windows locale (cp949, cp932, cp936, cp1252 for the em-dash), not just Korean.
Patched locally by reconfiguring the streams right after import sys:
for _s in (sys.stdout, sys.stderr):
try:
_s.reconfigure(encoding="utf-8", errors="replace")
except (AttributeError, ValueError):
pass3. HTML entities are not unescaped when parsing VTT
parse_vtt() strips tags but leaves entities, so the transcript contains raw >> where the caption track uses >> speaker markers:
[00:11] >> 한 분 더 있다 하면서요. >> 아 진짜요?An html.unescape() on the cue text would cover this.
Happy to open a PR for any of these if the approach sounds right — particularly whether you'd want #1 as a --sub-lang flag, a config key in ~/.config/watch/.env, or auto-detection from the video's own metadata language.
Source: bradautomates/claude-video