Skip to content

feat: add --format, --segments, --list-languages and --proxy - #12

Merged
solrevdev merged 2 commits into
masterfrom
feat/formats-proxy-languages
Oct 8, 2026
Merged

solrevdev merged 2 commits into
masterfrom
feat/formats-proxy-languages

Conversation

@solrevdev

Copy link
Copy Markdown
Owner

Refs #3, covering the first four items under "Features" in its suggested plan. It is stacked on #11.

Changes

  • --format md|txt|srt|vtt writes only the transcript.
    • txt puts one caption per line.
    • SRT and WebVTT keep millisecond cue times from the caption offset and duration.
    • In WebVTT, a literal --> in the text is written as -> so it can't break a cue.
    • With no transcript, stdout is empty and stderr says why. Exit codes match JSON mode.
  • --segments adds segments: [{start, end, text}] to the JSON, with times in seconds rounded to the millisecond. Without the flag the field is null, so every document keeps the same keys. The field is opt-in because long videos are already large: transcript is about 2.9× the size of transcriptRaw.
  • --list-languages writes {videoId, tracks: [{code, name, isAutoGenerated}]} and exits.
  • --proxy <url> accepts http, https, socks4, socks4a and socks5 URLs. Without it, HttpClient's default proxy is kept, which reads HTTPS_PROXY, HTTP_PROXY and NO_PROXY and falls back to the system proxy. This is now documented.
  • Conflicting options are usage errors (exit 2). Examples are --format srt --metadata-only and --list-languages --segments.

Verification

  • 118 tests pass on net8.0. They cover SRT and VTT golden strings (including 100+ hour cues and --> escaping), segment rounding, blank-caption skipping, track listing, option parsing and conflicts, and a segments array in the golden JSON.
  • Live checks:
    • --list-languages on iG9CE55wbtY lists every track.
    • -f srt, -f vtt, -f txt and -f md all produce well-formed output.
    • --segments returns 427 segments.
    • --proxy http://127.0.0.1:9 and HTTPS_PROXY=http://127.0.0.1:9 both fail with "Connection refused", which shows that requests go through the proxy.

Not included

🤖 Generated with Claude Code

https://claude.ai/code/session_01FPou7f8nRjX78T2qR7hTjb

- --format md|txt|srt|vtt writes only the transcript; SRT and WebVTT
  keep millisecond cue times.
- --segments adds a segments array of {start, end, text} to the JSON.
- --list-languages prints the caption tracks as JSON.
- --proxy routes requests through an http, https or socks proxy;
  HTTPS_PROXY was already honoured and is now documented.

Refs #3

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FPou7f8nRjX78T2qR7hTjb
@solrevdev
solrevdev merged commit 4d0bdd4 into master Oct 8, 2026
2 checks passed
@solrevdev
solrevdev deleted the feat/formats-proxy-languages branch October 8, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant