Enter a YouTube video link to extract the video transcript (spoken script) in one click, with terminal display + Markdown archive + optional Excel export.
Supported link formats (video links must include the video ID):
- Full URL:
https://www.youtube.com/watch?v=dQw4w9WgXcQ - Short URL:
https://youtu.be/dQw4w9WgXcQ - Video ID:
dQw4w9WgXcQ
Default behavior (important):
- Default outputwithout timestampsplain text; add this when you need a timestamped version:
--timestamp - Subtitles are selected by track priority in this order:
zh,en,asrPriority track selection:If the video has a Chinese subtitle track, output Chinese directly; if there is no Chinese track, fall back to English, andthe script automatically translates non-Chinese subtitles into Chinese(based on Google Translate, batch translation improves efficiency); add--no-translateto disable automatic translation and keep the original text - Video metadata (title/channel) is automatically retrieved by default, with no additional parameters required
An API Key must be configured first, passed via the environment variable REDFOX_API_KEY or the --api-key parameter. Transcript source: video subtitle tracks (manual subtitles + auto-generated subtitles asr), with track selection by language priority and Chinese tracks preferred; non-Chinese subtitles are automatically translated to Chinese by the script.
Use cases
When you need to perform the following tasks, you should prioritize this skill:
| Scenario | Example |
|---|---|
| Video to transcript | Drop in a YouTube link and get the complete spoken script |
| Study note organization | Extract tutorial/speech transcripts, then have AI summarize them into chapter notes |
| Content secondary creation | Extract English video transcripts → AI translation and rewriting → public account article |
| Podcast/interview archiving | Extract the full interview transcript and export it to Excel for archiving |
| Competitor content analysis | Batch extract peer video transcripts and analyze wording and structure |
| Video topic research | Extract the transcript first, then quickly judge whether the video is worth watching in depth |
How to use
# 基础提取(默认:不带时间戳 + 自动获取标题等元数据)
python3 "$SKILL_PATH/scripts/extract.py" "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
# 支持短链和纯视频 ID
python3 "$SKILL_PATH/scripts/extract.py" "https://youtu.be/dQw4w9WgXcQ"
python3 "$SKILL_PATH/scripts/extract.py" "dQw4w9WgXcQ"
# 带时间戳版本(方便定位原片进度)
python3 "$SKILL_PATH/scripts/extract.py" "URL" --timestamp
# 同时导出 Excel(标题/时长/视频链接/文案内容 四列)
python3 "$SKILL_PATH/scripts/extract.py" "URL" --excel
# 带时间戳文案 + 导出 Excel(Excel 内容与当前模式一致)
python3 "$SKILL_PATH/scripts/extract.py" "URL" --timestamp --excel
# 指定语言优先级(如只要英文字幕)
python3 "$SKILL_PATH/scripts/extract.py" "URL" --language "en"
# 输出原始 JSON / 不保存文件 / 不获取元数据
python3 "$SKILL_PATH/scripts/extract.py" "URL" --json
python3 "$SKILL_PATH/scripts/extract.py" "URL" --no-save
python3 "$SKILL_PATH/scripts/extract.py" "URL" --no-metadata
Terminal output: video summary (title/language/number of segments/total duration) + the full plain text transcript.
The Markdown archive is saved by default in ~/Downloads/QoderYoutubeDigest/, filename {视频ID}_{时间戳}.md, containing a video information header table + full text; Excel (.xlsx) in the same directory.
Workflow (AI must follow)
- Extraction: run the script to get the transcript
- Table display: present it in a table according to the "Return result display specification" (title/duration/transcript content), with the transcript content column showingthe full Chinese translation(no timestamps; non-Chinese subtitles have already been automatically translated)
- Closing inquiry: after the display ends,you must proactively ask the user:
"Do you need a timestamped transcript version (convenient for locating progress in the original video)? I can also export Excel for you."
- User wants timestamps → add
--timestamprerun and display - User wants Excel → add
--excelrerun (if timestamps are needed, also add--timestamp), provide the file path
- User wants timestamps → add
Note: The script automatically translates non-Chinese subtitles into Chinese by default. If the user explicitly requests to keep the original text, add
--no-translatererun.
Returned result display specification
When displaying the extraction results to the user,you mustuse the following table, and do not omit fields:
| No. | Field | Description |
|---|---|---|
| 1 | Title | Video title (from metadata) |
| 2 | Duration | Format MM:SS or HH:MM:SS |
| 3 | Transcript content | Without timestampsfull transcript text; non-Chinese subtitles have been automatically translated into Chinese |
Display example:
| 标题 | 时长 | 文案内容 |
|------|------|----------|
| Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster) | 03:31 | 我们对爱情并不陌生 / 你知道规则,我也一样 / ……(中文译文全文) |
- Transcript content column: multi-paragraph transcripts are joined within the cell using "/" or line breaks, kept complete without truncation; non-Chinese subtitles are automatically translated into Chinese for display
- One line of archive information is appended after the table:
已存档:~/Downloads/QoderYoutubeDigest/dQw4w9WgXcQ_xxx.md
Parameter description
| Parameter | Description | Default value |
|---|---|---|
video_url |
YouTube video link (full URL/short URL/video ID, must contain the video ID, required positional parameter) | — |
--language |
Subtitle language priority, comma-separated (Chinese track first,asr as fallback for auto-generated subtitles; track selection only, no translation) |
zh,en,asr |
--timestamp |
Output transcript with [MM:SS] timestamps |
Defaultwithouttimestamps |
--excel |
Also export Excel (.xlsx, four columns: title/duration/video link/transcript content) | Do not export |
--no-metadata |
Do not fetch video metadata | Fetched by default (title/channel) |
--json |
Output the raw JSON response in the terminal | — |
--no-save |
Do not save a Markdown file | Auto-save |
--output-dir |
Output directory | ~/Downloads/QoderYoutubeDigest |
--no-translate |
Disable automatic translation and keep the original subtitle text in the output | Defaultautomatic translationof non-Chinese subtitles into Chinese |
--api-key |
Specify the RedFox API Key | — |
API Key configuration
Choose any one method to configure your personal Key:
| Method | Command |
|---|---|
| Environment variable (recommended) | export REDFOX_API_KEY=ak_你的密钥 |
| Command-line parameter | --api-key ak_你的密钥 |
| Configuration file | echo '{"api_key":"ak_你的密钥"}' > ~/.qoder/apis/redfox.json |
Registration address:redfox.hk
Features
- Three input formats: full URL,
youtu.beshort link, or plain video ID, automatically recognized - Plain transcript by default: no timestamps, directly readable, and can be fed directly to AI for further processing;
--timestampswitch anytime - Automatic translation: non-Chinese subtitles are automatically translated into Chinese (based on Google Translate); add
--no-translateto keep the original text - Tabular delivery: presented in a three-field table of title/duration/transcript content, with information at a glance
- Excel export:
--excelOne-click export to xlsx (auto line wrapping, column width adaptation), suitable for archiving and sharing - Chinese track priority: select tracks by
zh,en,asrpriority; if Chinese subtitles are available, output Chinese directly; otherwise fall back to the English track and automatically translate to Chinese - Robust retries: on network anomalies/status code errors/empty data, automatically retry with increasing delay (0.5s→1.0s); for rate limiting (3108), automatically wait 5 seconds and retry
- AI-friendly: can connect to follow-up skills such as summarization, translation, rewriting, and WeChat Official Account formatting and publishing
Dependencies
pip3 install requests openpyxl deep-translator
(openpyxl Only required for Excel export;deep-translator Only required for automatic translation; if not installed, the corresponding feature automatically degrades, and other features are unaffected)
FAQ
Q: Does the default text include timestamps?
A: No. By default, it outputs plain text; add --timestamp to output the [MM:SS] timestamp version. After extraction is complete, the AI will also proactively ask whether it is needed.
Q: Can an English video directly give me Chinese text?
A: Yes. When the script detects non-Chinese subtitles, it automatically translates them into Chinese (based on Google Translate). If the video has a Chinese track, it outputs Chinese directly; if there is no Chinese track, it falls back to English and then automatically translates. If you need to keep the original text, add --no-translate。
Q: What is in the Excel file?
A: Four columns—title, duration, video link, and text content. The text content is consistent with the current mode: when --timestamp is added, the Excel file contains timestamps; otherwise it is plain text.
Q: Why does extraction fail with the prompt "the video may have no subtitles"? A: The transcript comes from the video's subtitle track. Videos with no subtitles at all (including automatically generated subtitles) cannot be extracted; some restricted/private videos are also unsupported.
Q: What should I do if the link reports an error?
A: An invalid link returns Invalid YouTube URL or video ID(credits are not deducted). Please check whether the link contains the correct video ID; for an invalid Key (3106/3107), please check the API Key configuration; for rate limiting (3108), it will automatically wait and retry.
Q: What can I do after getting the text? A: You can have the AI directly summarize it into notes, translate it into Chinese, or rewrite it into a WeChat Official Account article (with gzh-design formatting and md-to-wechat one-click draft push).
Q: What should I do when the quota is used up? A: Go to redfox.hk to register and obtain a Token.