You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Use platformdirs for config path (macOS/Linux/Windows native locations)
- Default output_dir to ~/Downloads instead of current directory
- Fall back to notepad on Windows when $EDITOR is unset
- Add ffmpeg to requirements docs; expand install instructions for all platforms
- Document HuggingFace model cache paths per platform
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+
## Commands
6
+
7
+
```bash
8
+
just install # create venv and install dependencies via uv
9
+
just run <url># transcribe a YouTube URL or bare video ID
10
+
just config --show # print current config
11
+
just config --edit # open config in $EDITOR
12
+
just models # list available Whisper model sizes
13
+
```
14
+
15
+
There are no tests and no linter configured.
16
+
17
+
## Architecture
18
+
19
+
Two source files under `src/transcribe/`:
20
+
21
+
-**`cli.py`** — all CLI logic via Typer. Two commands: `run` (transcribe) and `config` (show/edit config file). The `run` command tries YouTube captions first (`fetch_youtube_captions`), falls back to Whisper (`transcribe_with_whisper`). Output path resolution order: `--output` flag → `output_dir` in config → `~/Downloads`.
22
+
23
+
-**`config.py`** — loads `~/.config/yt-transcribe/config.toml` (path determined by `platformdirs.user_config_dir`). Merges user TOML over hardcoded `_DEFAULTS`. Creates the file with documented defaults on `config --edit` if it doesn't exist yet.
24
+
25
+
## Key behaviours
26
+
27
+
-`faster-whisper` and `yt-dlp` are lazy imports — only loaded when captions are unavailable, so caption-only runs have no heavy dependency startup cost.
28
+
- Audio is downloaded to `tempfile.TemporaryDirectory()` and deleted automatically after transcription.
-`--print` suppresses all Rich console output and writes only the transcript to stdout — safe for piping.
31
+
- Config path is platform-specific via `platformdirs`: `~/Library/Application Support/yt-transcribe/` on macOS, `~/.config/yt-transcribe/` on Linux, `%LOCALAPPDATA%\yt-transcribe\` on Windows.
For other distros replace `apt install ffmpeg` with your package manager (`dnf`, `pacman`, etc.). The `just` binary can also be downloaded from its [GitHub releases](https://github.com/casey/just/releases).
32
+
33
+
### Windows
34
+
35
+
```powershell
36
+
winget install astral-sh.uv
37
+
winget install Casey.Just
38
+
winget install ffmpeg
39
+
```
40
+
41
+
Then restart your terminal so the new PATH entries take effect.
42
+
43
+
> **Note:**`faster-whisper` requires the [Microsoft Visual C++ Redistributable](https://aka.ms/vs/17/release/vc_redist.x64.exe) (x64). Install it if you see a DLL error on first Whisper run.
10
44
11
45
## Setup
12
46
@@ -18,15 +52,19 @@ just install
18
52
## Usage
19
53
20
54
```bash
21
-
# Fetch captions if available, otherwise run Whisper — saves to current dir by default
55
+
# Fetch captions if available, otherwise run Whisper — saves to ~/Downloads by default
22
56
just run "https://youtube.com/watch?v=VIDEO_ID"
23
57
24
58
# Save to a specific file
25
59
just run "https://youtube.com/watch?v=VIDEO_ID" --output transcript.txt
26
60
27
61
# Print to stdout (all status output suppressed — safe to pipe)
28
62
just run "https://youtube.com/watch?v=VIDEO_ID" --print
63
+
64
+
# Copy to clipboard (macOS: pbcopy, Linux: xclip, Windows: clip)
29
65
just run "https://youtube.com/watch?v=VIDEO_ID" --print | pbcopy
66
+
just run "https://youtube.com/watch?v=VIDEO_ID" --print | xclip -selection clipboard
67
+
just run "https://youtube.com/watch?v=VIDEO_ID" --print | clip
30
68
31
69
# Force Whisper even if captions exist
32
70
just run "https://youtube.com/watch?v=VIDEO_ID" --force-whisper
@@ -43,12 +81,18 @@ just models
43
81
44
82
## Config
45
83
46
-
Defaults are stored in `~/.config/yt-transcribe/config.toml`. On first run with `just config --edit` the file is created with all options documented inline.
84
+
Defaults are stored in a platform-specific config file:
**`output_dir`** — when set, every transcription is auto-saved to `<output_dir>/<video title>.<output_extension>` without needing `--output`. Useful for batch use.
114
+
**`output_dir`** — when set, every transcription is auto-saved to `<output_dir>/<video title>.<output_extension>` without needing `--output`. Useful for batch use. Supports `~` expansion.
|`--language`|`-l`| auto-detect | Override language, e.g. `en`, `fr`, `de`. Omit to auto-detect — useful only when detection gets it wrong or the video has mixed-language content. |
80
124
|`--force-whisper`|`-w`| off | Skip caption lookup, always use Whisper |
81
125
82
-
By default the transcript is **saved to a file**— to `output_dir` from config if set, otherwise to the current directory, using the video title as the filename. Use `--print` to get stdout behaviour instead.
126
+
By default the transcript is **saved to `~/Downloads`**using the video title as the filename. Change `output_dir` in config to save elsewhere. Use `--print` to get stdout behaviour instead.
83
127
84
128
CLI flags always override config values.
85
129
86
130
## Whisper models
87
131
88
-
Model weights are downloaded from HuggingFace on first use and cached at `~/.cache/huggingface/hub/`. Subsequent runs use the cached copy — no re-download. Override the location with the `HF_HUB_CACHE` environment variable.
132
+
Model weights are downloaded from HuggingFace on first use and cached at `~/.cache/huggingface/hub/` (macOS/Linux) or `%USERPROFILE%\.cache\huggingface\hub\` (Windows). Subsequent runs use the cached copy — no re-download. Override with the `HF_HUB_CACHE` environment variable.
89
133
90
134
| Model | Size | Speed | Accuracy |
91
135
|---|---|---|---|
@@ -115,7 +159,7 @@ Model weights are downloaded from HuggingFace on first use and cached at `~/.cac
0 commit comments