@caddis/cli 0.4.9 → 0.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/antigravity-plugin/agents/code-reviewer.md +2 -2
- package/bundles/antigravity-plugin/plugin.json +1 -1
- package/bundles/antigravity-plugin/scripts/enforcement_inventory.py +1 -1
- package/bundles/antigravity-plugin/scripts/oss_review.py +10 -2
- package/bundles/antigravity-plugin/skills/_registry.md +0 -1
- package/bundles/antigravity-plugin/skills/brainstorming/SKILL.md +2 -2
- package/bundles/antigravity-plugin/skills/cross-review/SKILL.md +5 -2
- package/bundles/antigravity-plugin/skills/explainer-doc/SKILL.md +1 -1
- package/bundles/antigravity-plugin/skills/ship-pr/SKILL.md +1 -1
- package/bundles/antigravity-plugin/skills/spawn-session/SKILL.md +2 -2
- package/bundles/antigravity-plugin-extras/plugin.json +1 -1
- package/bundles/antigravity-plugin-extras/skills/_registry.md +1 -19
- package/bundles/codex/.codex/skills/docs/explainer-doc/SKILL.md +1 -1
- package/bundles/codex/.codex/skills/workflow/brainstorming/SKILL.md +2 -2
- package/bundles/manifest.json +3 -3
- package/package.json +1 -1
- package/bundles/antigravity-plugin-extras/skills/competitive-ads-extractor/SKILL.md +0 -294
- package/bundles/antigravity-plugin-extras/skills/content-research-writer/SKILL.md +0 -539
- package/bundles/antigravity-plugin-extras/skills/domain-name-brainstormer/SKILL.md +0 -213
- package/bundles/antigravity-plugin-extras/skills/humanizer/SKILL.md +0 -194
- package/bundles/antigravity-plugin-extras/skills/image-enhancer/SKILL.md +0 -100
- package/bundles/antigravity-plugin-extras/skills/invoice-organizer/SKILL.md +0 -447
- package/bundles/antigravity-plugin-extras/skills/job-application/SKILL.md +0 -188
- package/bundles/antigravity-plugin-extras/skills/lead-research-assistant/SKILL.md +0 -200
- package/bundles/antigravity-plugin-extras/skills/meeting-insights-analyzer/SKILL.md +0 -328
- package/bundles/antigravity-plugin-extras/skills/notebooklm/AUTHENTICATION.md +0 -154
- package/bundles/antigravity-plugin-extras/skills/notebooklm/SKILL.md +0 -270
- package/bundles/antigravity-plugin-extras/skills/notebooklm/references/api_reference.md +0 -309
- package/bundles/antigravity-plugin-extras/skills/notebooklm/references/troubleshooting.md +0 -376
- package/bundles/antigravity-plugin-extras/skills/notebooklm/references/usage_patterns.md +0 -338
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/__init__.py +0 -81
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/ask_question.py +0 -256
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/auth_manager.py +0 -358
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/browser_session.py +0 -255
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/browser_utils.py +0 -107
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/cleanup_manager.py +0 -302
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/config.py +0 -44
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/notebook_manager.py +0 -410
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/run.py +0 -102
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/setup_environment.py +0 -204
- package/bundles/antigravity-plugin-extras/skills/onboard-project/SKILL.md +0 -192
- package/bundles/antigravity-plugin-extras/skills/pipeline-state/SKILL.md +0 -208
- package/bundles/antigravity-plugin-extras/skills/raffle-winner-picker/SKILL.md +0 -159
- package/bundles/antigravity-plugin-extras/skills/relay/SKILL.md +0 -246
- package/bundles/antigravity-plugin-extras/skills/requesting-code-review/SKILL.md +0 -105
- package/bundles/antigravity-plugin-extras/skills/requesting-code-review/code-reviewer.md +0 -146
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/LICENSE.txt +0 -202
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/SKILL.md +0 -646
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/color_palettes.py +0 -302
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/easing.py +0 -230
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/frame_composer.py +0 -469
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/gif_builder.py +0 -246
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/typography.py +0 -357
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/validators.py +0 -264
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/visual_effects.py +0 -494
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/requirements.txt +0 -4
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/bounce.py +0 -106
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/explode.py +0 -331
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/fade.py +0 -329
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/flip.py +0 -291
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/kaleidoscope.py +0 -211
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/morph.py +0 -329
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/move.py +0 -293
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/pulse.py +0 -268
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/shake.py +0 -127
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/slide.py +0 -291
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/spin.py +0 -269
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/wiggle.py +0 -300
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/zoom.py +0 -312
- package/bundles/antigravity-plugin-extras/skills/state-tracking/SKILL.md +0 -131
- package/bundles/antigravity-plugin-extras/skills/video-downloader/SKILL.md +0 -107
- package/bundles/antigravity-plugin-extras/skills/youtube-transcript/SKILL.md +0 -416
- package/bundles/codex/.codex/skills/workflow/golden-plan/SKILL.md +0 -586
- /package/bundles/{antigravity-plugin → antigravity-plugin-extras}/skills/golden-plan/SKILL.md +0 -0
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: youtube-transcript
|
|
3
|
-
context: fork
|
|
4
|
-
description: Download YouTube video transcripts when user provides a YouTube URL or asks to download/get/fetch a transcript from YouTube. Also use when user wants to transcribe or get captions/subtitles from a YouTube video.
|
|
5
|
-
allowed-tools: Bash,Read,Write
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# YouTube Transcript Downloader
|
|
9
|
-
|
|
10
|
-
This skill helps download transcripts (subtitles/captions) from YouTube videos using yt-dlp.
|
|
11
|
-
|
|
12
|
-
## When to Use This Skill
|
|
13
|
-
|
|
14
|
-
Activate this skill when the user:
|
|
15
|
-
- Provides a YouTube URL and wants the transcript
|
|
16
|
-
- Asks to "download transcript from YouTube"
|
|
17
|
-
- Wants to "get captions" or "get subtitles" from a video
|
|
18
|
-
- Asks to "transcribe a YouTube video"
|
|
19
|
-
- Needs text content from a YouTube video
|
|
20
|
-
|
|
21
|
-
## How It Works
|
|
22
|
-
|
|
23
|
-
### Priority Order:
|
|
24
|
-
1. **Check if yt-dlp is installed** - install if needed
|
|
25
|
-
2. **List available subtitles** - see what's actually available
|
|
26
|
-
3. **Try manual subtitles first** (`--write-sub`) - highest quality
|
|
27
|
-
4. **Fallback to auto-generated** (`--write-auto-sub`) - usually available
|
|
28
|
-
5. **Last resort: Whisper transcription** - if no subtitles exist (requires user confirmation)
|
|
29
|
-
6. **Confirm the download** and show the user where the file is saved
|
|
30
|
-
7. **Optionally clean up** the VTT format if the user wants plain text
|
|
31
|
-
|
|
32
|
-
## Installation Check
|
|
33
|
-
|
|
34
|
-
**IMPORTANT**: Always check if yt-dlp is installed first:
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
which yt-dlp || command -v yt-dlp
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### If Not Installed
|
|
41
|
-
|
|
42
|
-
Attempt automatic installation based on the system:
|
|
43
|
-
|
|
44
|
-
**macOS (Homebrew)**:
|
|
45
|
-
```bash
|
|
46
|
-
brew install yt-dlp
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
**Linux (apt/Debian/Ubuntu)**:
|
|
50
|
-
```bash
|
|
51
|
-
sudo apt update && sudo apt install -y yt-dlp
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
**Alternative (pip - works on all systems)**:
|
|
55
|
-
```bash
|
|
56
|
-
pip3 install yt-dlp
|
|
57
|
-
# or
|
|
58
|
-
python3 -m pip install yt-dlp
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
**If installation fails**: Inform the user they need to install yt-dlp manually and provide them with installation instructions from https://github.com/yt-dlp/yt-dlp#installation
|
|
62
|
-
|
|
63
|
-
## Check Available Subtitles
|
|
64
|
-
|
|
65
|
-
**ALWAYS do this first** before attempting to download:
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
yt-dlp --list-subs "YOUTUBE_URL"
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
This shows what subtitle types are available without downloading anything. Look for:
|
|
72
|
-
- Manual subtitles (better quality)
|
|
73
|
-
- Auto-generated subtitles (usually available)
|
|
74
|
-
- Available languages
|
|
75
|
-
|
|
76
|
-
## Download Strategy
|
|
77
|
-
|
|
78
|
-
### Option 1: Manual Subtitles (Preferred)
|
|
79
|
-
|
|
80
|
-
Try this first - highest quality, human-created:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
yt-dlp --write-sub --skip-download --output "OUTPUT_NAME" "YOUTUBE_URL"
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### Option 2: Auto-Generated Subtitles (Fallback)
|
|
87
|
-
|
|
88
|
-
If manual subtitles aren't available:
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
yt-dlp --write-auto-sub --skip-download --output "OUTPUT_NAME" "YOUTUBE_URL"
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Both commands create a `.vtt` file (WebVTT subtitle format).
|
|
95
|
-
|
|
96
|
-
## Option 3: Whisper Transcription (Last Resort)
|
|
97
|
-
|
|
98
|
-
**ONLY use this if both manual and auto-generated subtitles are unavailable.**
|
|
99
|
-
|
|
100
|
-
### Step 1: Show File Size and Ask for Confirmation
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
# Get audio file size estimate
|
|
104
|
-
yt-dlp --print "%(filesize,filesize_approx)s" -f "bestaudio" "YOUTUBE_URL"
|
|
105
|
-
|
|
106
|
-
# Or get duration to estimate
|
|
107
|
-
yt-dlp --print "%(duration)s %(title)s" "YOUTUBE_URL"
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
**IMPORTANT**: Display the file size to the user and ask: "No subtitles are available. I can download the audio (approximately X MB) and transcribe it using Whisper. Would you like to proceed?"
|
|
111
|
-
|
|
112
|
-
**Wait for user confirmation before continuing.**
|
|
113
|
-
|
|
114
|
-
### Step 2: Check for Whisper Installation
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
command -v whisper
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
If not installed, ask user: "Whisper is not installed. Install it with `pip install openai-whisper` (requires ~1-3GB for models)? This is a one-time installation."
|
|
121
|
-
|
|
122
|
-
**Wait for user confirmation before installing.**
|
|
123
|
-
|
|
124
|
-
Install if approved:
|
|
125
|
-
```bash
|
|
126
|
-
pip3 install openai-whisper
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### Step 3: Download Audio Only
|
|
130
|
-
|
|
131
|
-
```bash
|
|
132
|
-
yt-dlp -x --audio-format mp3 --output "audio_%(id)s.%(ext)s" "YOUTUBE_URL"
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Step 4: Transcribe with Whisper
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
# Auto-detect language (recommended)
|
|
139
|
-
whisper audio_VIDEO_ID.mp3 --model base --output_format vtt
|
|
140
|
-
|
|
141
|
-
# Or specify language if known
|
|
142
|
-
whisper audio_VIDEO_ID.mp3 --model base --language en --output_format vtt
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
**Model Options** (stick to `base` for now):
|
|
146
|
-
- `tiny` - fastest, least accurate (~1GB)
|
|
147
|
-
- `base` - good balance (~1GB) ← **USE THIS**
|
|
148
|
-
- `small` - better accuracy (~2GB)
|
|
149
|
-
- `medium` - very good (~5GB)
|
|
150
|
-
- `large` - best accuracy (~10GB)
|
|
151
|
-
|
|
152
|
-
### Step 5: Cleanup
|
|
153
|
-
|
|
154
|
-
After transcription completes, ask user: "Transcription complete! Would you like me to delete the audio file to save space?"
|
|
155
|
-
|
|
156
|
-
If yes:
|
|
157
|
-
```bash
|
|
158
|
-
rm audio_VIDEO_ID.mp3
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
## Getting Video Information
|
|
162
|
-
|
|
163
|
-
### Extract Video Title (for filename)
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
yt-dlp --print "%(title)s" "YOUTUBE_URL"
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
Use this to create meaningful filenames based on the video title. Clean the title for filesystem compatibility:
|
|
170
|
-
- Replace `/` with `-`
|
|
171
|
-
- Replace special characters that might cause issues
|
|
172
|
-
- Consider using sanitized version: `$(yt-dlp --print "%(title)s" "URL" | tr '/' '-' | tr ':' '-')`
|
|
173
|
-
|
|
174
|
-
## Post-Processing
|
|
175
|
-
|
|
176
|
-
### Convert to Plain Text (Recommended)
|
|
177
|
-
|
|
178
|
-
YouTube's auto-generated VTT files contain **duplicate lines** because captions are shown progressively with overlapping timestamps. Always deduplicate when converting to plain text while preserving the original speaking order.
|
|
179
|
-
|
|
180
|
-
```bash
|
|
181
|
-
python3 -c "
|
|
182
|
-
import sys, re
|
|
183
|
-
seen = set()
|
|
184
|
-
with open('transcript.en.vtt', 'r') as f:
|
|
185
|
-
for line in f:
|
|
186
|
-
line = line.strip()
|
|
187
|
-
if line and not line.startswith('WEBVTT') and not line.startswith('Kind:') and not line.startswith('Language:') and '-->' not in line:
|
|
188
|
-
clean = re.sub('<[^>]*>', '', line)
|
|
189
|
-
clean = clean.replace('&', '&').replace('>', '>').replace('<', '<')
|
|
190
|
-
if clean and clean not in seen:
|
|
191
|
-
print(clean)
|
|
192
|
-
seen.add(clean)
|
|
193
|
-
" > transcript.txt
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### Complete Post-Processing with Video Title
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
|
-
# Get video title
|
|
200
|
-
VIDEO_TITLE=$(yt-dlp --print "%(title)s" "YOUTUBE_URL" | tr '/' '_' | tr ':' '-' | tr '?' '' | tr '"' '')
|
|
201
|
-
|
|
202
|
-
# Find the VTT file
|
|
203
|
-
VTT_FILE=$(ls *.vtt | head -n 1)
|
|
204
|
-
|
|
205
|
-
# Convert with deduplication
|
|
206
|
-
python3 -c "
|
|
207
|
-
import sys, re
|
|
208
|
-
seen = set()
|
|
209
|
-
with open('$VTT_FILE', 'r') as f:
|
|
210
|
-
for line in f:
|
|
211
|
-
line = line.strip()
|
|
212
|
-
if line and not line.startswith('WEBVTT') and not line.startswith('Kind:') and not line.startswith('Language:') and '-->' not in line:
|
|
213
|
-
clean = re.sub('<[^>]*>', '', line)
|
|
214
|
-
clean = clean.replace('&', '&').replace('>', '>').replace('<', '<')
|
|
215
|
-
if clean and clean not in seen:
|
|
216
|
-
print(clean)
|
|
217
|
-
seen.add(clean)
|
|
218
|
-
" > "${VIDEO_TITLE}.txt"
|
|
219
|
-
|
|
220
|
-
echo "✓ Saved to: ${VIDEO_TITLE}.txt"
|
|
221
|
-
|
|
222
|
-
# Clean up VTT file
|
|
223
|
-
rm "$VTT_FILE"
|
|
224
|
-
echo "✓ Cleaned up temporary VTT file"
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
## Output Formats
|
|
228
|
-
|
|
229
|
-
- **VTT format** (`.vtt`): Includes timestamps and formatting, good for video players
|
|
230
|
-
- **Plain text** (`.txt`): Just the text content, good for reading or analysis
|
|
231
|
-
|
|
232
|
-
## Tips
|
|
233
|
-
|
|
234
|
-
- The filename will be `{output_name}.{language_code}.vtt` (e.g., `transcript.en.vtt`)
|
|
235
|
-
- Most YouTube videos have auto-generated English subtitles
|
|
236
|
-
- Some videos may have multiple language options
|
|
237
|
-
- If auto-subtitles aren't available, try `--write-sub` instead for manual subtitles
|
|
238
|
-
|
|
239
|
-
## Complete Workflow Example
|
|
240
|
-
|
|
241
|
-
```bash
|
|
242
|
-
VIDEO_URL="https://www.youtube.com/watch?v=dQw4w9WgXcQ"
|
|
243
|
-
|
|
244
|
-
# Get video title for filename
|
|
245
|
-
VIDEO_TITLE=$(yt-dlp --print "%(title)s" "$VIDEO_URL" | tr '/' '_' | tr ':' '-' | tr '?' '' | tr '"' '')
|
|
246
|
-
OUTPUT_NAME="transcript_temp"
|
|
247
|
-
|
|
248
|
-
# ============================================
|
|
249
|
-
# STEP 1: Check if yt-dlp is installed
|
|
250
|
-
# ============================================
|
|
251
|
-
if ! command -v yt-dlp &> /dev/null; then
|
|
252
|
-
echo "yt-dlp not found, attempting to install..."
|
|
253
|
-
if command -v brew &> /dev/null; then
|
|
254
|
-
brew install yt-dlp
|
|
255
|
-
elif command -v apt &> /dev/null; then
|
|
256
|
-
sudo apt update && sudo apt install -y yt-dlp
|
|
257
|
-
else
|
|
258
|
-
pip3 install yt-dlp
|
|
259
|
-
fi
|
|
260
|
-
fi
|
|
261
|
-
|
|
262
|
-
# ============================================
|
|
263
|
-
# STEP 2: List available subtitles
|
|
264
|
-
# ============================================
|
|
265
|
-
echo "Checking available subtitles..."
|
|
266
|
-
yt-dlp --list-subs "$VIDEO_URL"
|
|
267
|
-
|
|
268
|
-
# ============================================
|
|
269
|
-
# STEP 3: Try manual subtitles first
|
|
270
|
-
# ============================================
|
|
271
|
-
echo "Attempting to download manual subtitles..."
|
|
272
|
-
if yt-dlp --write-sub --skip-download --output "$OUTPUT_NAME" "$VIDEO_URL" 2>/dev/null; then
|
|
273
|
-
echo "✓ Manual subtitles downloaded successfully!"
|
|
274
|
-
ls -lh ${OUTPUT_NAME}.*
|
|
275
|
-
else
|
|
276
|
-
# ============================================
|
|
277
|
-
# STEP 4: Fallback to auto-generated
|
|
278
|
-
# ============================================
|
|
279
|
-
echo "Manual subtitles not available. Trying auto-generated..."
|
|
280
|
-
if yt-dlp --write-auto-sub --skip-download --output "$OUTPUT_NAME" "$VIDEO_URL" 2>/dev/null; then
|
|
281
|
-
echo "✓ Auto-generated subtitles downloaded successfully!"
|
|
282
|
-
ls -lh ${OUTPUT_NAME}.*
|
|
283
|
-
else
|
|
284
|
-
# ============================================
|
|
285
|
-
# STEP 5: Last resort - Whisper transcription
|
|
286
|
-
# ============================================
|
|
287
|
-
echo "⚠ No subtitles available for this video."
|
|
288
|
-
|
|
289
|
-
# Get file size
|
|
290
|
-
FILE_SIZE=$(yt-dlp --print "%(filesize_approx)s" -f "bestaudio" "$VIDEO_URL")
|
|
291
|
-
DURATION=$(yt-dlp --print "%(duration)s" "$VIDEO_URL")
|
|
292
|
-
TITLE=$(yt-dlp --print "%(title)s" "$VIDEO_URL")
|
|
293
|
-
|
|
294
|
-
echo "Video: $TITLE"
|
|
295
|
-
echo "Duration: $((DURATION / 60)) minutes"
|
|
296
|
-
echo "Audio size: ~$((FILE_SIZE / 1024 / 1024)) MB"
|
|
297
|
-
echo ""
|
|
298
|
-
echo "Would you like to download and transcribe with Whisper? (y/n)"
|
|
299
|
-
read -r RESPONSE
|
|
300
|
-
|
|
301
|
-
if [[ "$RESPONSE" =~ ^[Yy]$ ]]; then
|
|
302
|
-
# Check for Whisper
|
|
303
|
-
if ! command -v whisper &> /dev/null; then
|
|
304
|
-
echo "Whisper not installed. Install now? (requires ~1-3GB) (y/n)"
|
|
305
|
-
read -r INSTALL_RESPONSE
|
|
306
|
-
if [[ "$INSTALL_RESPONSE" =~ ^[Yy]$ ]]; then
|
|
307
|
-
pip3 install openai-whisper
|
|
308
|
-
else
|
|
309
|
-
echo "Cannot proceed without Whisper. Exiting."
|
|
310
|
-
exit 1
|
|
311
|
-
fi
|
|
312
|
-
fi
|
|
313
|
-
|
|
314
|
-
# Download audio
|
|
315
|
-
echo "Downloading audio..."
|
|
316
|
-
yt-dlp -x --audio-format mp3 --output "audio_%(id)s.%(ext)s" "$VIDEO_URL"
|
|
317
|
-
|
|
318
|
-
# Get the actual audio filename
|
|
319
|
-
AUDIO_FILE=$(ls audio_*.mp3 | head -n 1)
|
|
320
|
-
|
|
321
|
-
# Transcribe
|
|
322
|
-
echo "Transcribing with Whisper (this may take a few minutes)..."
|
|
323
|
-
whisper "$AUDIO_FILE" --model base --output_format vtt
|
|
324
|
-
|
|
325
|
-
# Cleanup
|
|
326
|
-
echo "Transcription complete! Delete audio file? (y/n)"
|
|
327
|
-
read -r CLEANUP_RESPONSE
|
|
328
|
-
if [[ "$CLEANUP_RESPONSE" =~ ^[Yy]$ ]]; then
|
|
329
|
-
rm "$AUDIO_FILE"
|
|
330
|
-
echo "Audio file deleted."
|
|
331
|
-
fi
|
|
332
|
-
|
|
333
|
-
ls -lh *.vtt
|
|
334
|
-
else
|
|
335
|
-
echo "Transcription cancelled."
|
|
336
|
-
exit 0
|
|
337
|
-
fi
|
|
338
|
-
fi
|
|
339
|
-
fi
|
|
340
|
-
|
|
341
|
-
# ============================================
|
|
342
|
-
# STEP 6: Convert to readable plain text with deduplication
|
|
343
|
-
# ============================================
|
|
344
|
-
VTT_FILE=$(ls ${OUTPUT_NAME}*.vtt 2>/dev/null || ls *.vtt | head -n 1)
|
|
345
|
-
if [ -f "$VTT_FILE" ]; then
|
|
346
|
-
echo "Converting to readable format and removing duplicates..."
|
|
347
|
-
python3 -c "
|
|
348
|
-
import sys, re
|
|
349
|
-
seen = set()
|
|
350
|
-
with open('$VTT_FILE', 'r') as f:
|
|
351
|
-
for line in f:
|
|
352
|
-
line = line.strip()
|
|
353
|
-
if line and not line.startswith('WEBVTT') and not line.startswith('Kind:') and not line.startswith('Language:') and '-->' not in line:
|
|
354
|
-
clean = re.sub('<[^>]*>', '', line)
|
|
355
|
-
clean = clean.replace('&', '&').replace('>', '>').replace('<', '<')
|
|
356
|
-
if clean and clean not in seen:
|
|
357
|
-
print(clean)
|
|
358
|
-
seen.add(clean)
|
|
359
|
-
" > "${VIDEO_TITLE}.txt"
|
|
360
|
-
echo "✓ Saved to: ${VIDEO_TITLE}.txt"
|
|
361
|
-
|
|
362
|
-
# Clean up temporary VTT file
|
|
363
|
-
rm "$VTT_FILE"
|
|
364
|
-
echo "✓ Cleaned up temporary VTT file"
|
|
365
|
-
else
|
|
366
|
-
echo "⚠ No VTT file found to convert"
|
|
367
|
-
fi
|
|
368
|
-
|
|
369
|
-
echo "✓ Complete!"
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
**Note**: This complete workflow handles all scenarios with proper error checking and user prompts at each decision point.
|
|
373
|
-
|
|
374
|
-
## Error Handling
|
|
375
|
-
|
|
376
|
-
### Common Issues and Solutions:
|
|
377
|
-
|
|
378
|
-
**1. yt-dlp not installed**
|
|
379
|
-
- Attempt automatic installation based on system (Homebrew/apt/pip)
|
|
380
|
-
- If installation fails, provide manual installation link
|
|
381
|
-
- Verify installation before proceeding
|
|
382
|
-
|
|
383
|
-
**2. No subtitles available**
|
|
384
|
-
- List available subtitles first to confirm
|
|
385
|
-
- Try both `--write-sub` and `--write-auto-sub`
|
|
386
|
-
- If both fail, offer Whisper transcription option
|
|
387
|
-
- Show file size and ask for user confirmation before downloading audio
|
|
388
|
-
|
|
389
|
-
**3. Invalid or private video**
|
|
390
|
-
- Check if URL is correct format: `https://www.youtube.com/watch?v=VIDEO_ID`
|
|
391
|
-
- Some videos may be private, age-restricted, or geo-blocked
|
|
392
|
-
- Inform user of the specific error from yt-dlp
|
|
393
|
-
|
|
394
|
-
**4. Whisper installation fails**
|
|
395
|
-
- May require system dependencies (ffmpeg, rust)
|
|
396
|
-
- Provide fallback: "Install manually with: `pip3 install openai-whisper`"
|
|
397
|
-
- Check available disk space (models require 1-10GB depending on size)
|
|
398
|
-
|
|
399
|
-
**5. Download interrupted or failed**
|
|
400
|
-
- Check internet connection
|
|
401
|
-
- Verify sufficient disk space
|
|
402
|
-
- Try again with `--no-check-certificate` if SSL issues occur
|
|
403
|
-
|
|
404
|
-
**6. Multiple subtitle languages**
|
|
405
|
-
- By default, yt-dlp downloads all available languages
|
|
406
|
-
- Can specify with `--sub-langs en` for English only
|
|
407
|
-
- List available with `--list-subs` first
|
|
408
|
-
|
|
409
|
-
### Best Practices:
|
|
410
|
-
|
|
411
|
-
- ✅ Always check what's available before attempting download (`--list-subs`)
|
|
412
|
-
- ✅ Verify success at each step before proceeding to next
|
|
413
|
-
- ✅ Ask user before large downloads (audio files, Whisper models)
|
|
414
|
-
- ✅ Clean up temporary files after processing
|
|
415
|
-
- ✅ Provide clear feedback about what's happening at each stage
|
|
416
|
-
- ✅ Handle errors gracefully with helpful messages
|