I have a programming question about modeling transcript export state in a web app.
The flow is:
- User submits a YouTube URL or video id.
- Server checks whether transcript or subtitle text is available.
- Client shows readable transcript text when available.
- User can copy text or export TXT.
- If timed data is available, SRT or VTT export can be offered separately.
The part I want to model cleanly is the response shape. TXT is readable text, while SRT/VTT is timed subtitle data, so I do not want the UI to imply that all formats are always available. https://aiyoutubetranscript.com/
One possible shape:
type TranscriptFormat = "txt" | "srt" | "vtt";
type TranscriptResponse = {
source: "youtube";
transcriptAvailable: boolean;
language?: string;
readableText?: string;
availableExports: TranscriptFormat[];
caveats: string[];
};
Would you keep export availability in one list like this, or split readable text and timed subtitle exports into separate objects so the UI cannot accidentally label TXT as a subtitle file?