youtube-download
Skill2 starsChanged 2 months agoMITView on GitHub
Download YouTube (and other yt-dlp sites) audio or video with quality selection, bilingual English + Simplified Chinese subtitles, and browser-cookie authentication. Use when the user asks to download a YouTube video, extract music/audio, save a playlist, or fetch subtitles.
- Installs packages
In this repository8 other files it gives its agents.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
Ask the user for the audio/video quality every time before starting a download, unless they already stated it:
- Very specific: line 24
When run directly in a terminal, youtube_download.py prompts for mode and quality itself.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
YouTube Download
Download audio or video from YouTube with quality selection, using the local browser login to pass bot checks.
When To Use
- Download a YouTube video (single video or playlist).
- Extract audio as
m4a,opus,flac,mp3, or the native best stream. - Fetch subtitles, including bilingual English + Simplified Chinese.
- Any yt-dlp-supported URL (Vimeo, Bilibili, etc.) with the same workflow.
Before Downloading: Always Ask Quality
Ask the user for the audio/video quality every time before starting a download, unless they already stated it:
- Audio:
m4a(default),opus,flac,mp3,best. - Video: max height
2160/1440/1080(default) /720/480.
When run directly in a terminal, youtube_download.py prompts for mode and quality itself. When driving it from an agent, ask the user with the agent's question tool, then pass the answer as -f (audio) or -r (video) so the script does not prompt again.
Quick Start
pip install -U yt-dlp mutagen # yt-dlp + cover-art embedding
# ffmpeg and node must be on PATH
# Unified entry: asks audio/video, then quality
python3 scripts/youtube_download.py "URL"
# Audio only, saved to audios/
python3 scripts/yt_audio_downloader.py -f flac "URL"
python3 scripts/yt_audio_downloader.py -f m4a -i urls.md
# Video, saved to videos/, default mkv + bilingual subtitles
python3 scripts/yt_video_downloader.py -r 1080 "URL"
python3 scripts/yt_video_downloader.py -r 2160 --codec av1 "URL"Output layout (relative to the working directory):
audios/ # audio downloads
videos/ # video downloadsDefaults
- Video container:
mkv(stream copy, no re-encode). - Video subtitles:
--subs auto, languagesen,zh-Hans. - Bilingual subtitle: English on top, Simplified Chinese below, both at font size
38; written as a.bilingual.srtsidecar and embedded as ASS in the mkv. - Audio: original stream, no re-encode.
Implementation Details
Authentication and JS challenges
YouTube returns Sign in to confirm you're not a bot for datacenter IPs and headless requests. The scripts pass:
--cookies-from-browser chrometo reuse the local login session.--js-runtimes node:<path>plus--remote-components ejs:githubto solve the signature/nchallenges.
yd_common.find_node() also locates nvm installs not on PATH.
Bilingual subtitles
make_bilingual_subs.py merges two auto-caption SRT tracks:
- Parse SRT tolerating blank lines inside cue text.
- De-roll YouTube's rolling two-line window (each cue repeats the previous line).
- Align English and Chinese cues by start timestamp.
- Emit a bilingual
.srtand a styled.ass(English + Chinese stacked via{\rEN}...\N{\rCN}...).
yd_common.postprocess_bilingual() runs after yt-dlp, then remuxes the ASS into the mkv with ffmpeg -c copy -c:s ass.
Audio format facts
YouTube audio is already lossy (AAC ~128k or Opus ~137k), so flac/wav only store the lossy source without extra loss, they do not improve quality; it is the largest option. To keep the source exactly, use best; for compatibility use m4a; for small size use opus.
Troubleshooting
| Symptom | Fix |
Sign in to confirm you're not a bot | Ensure --cookies-from-browser chrome points at a logged-in browser |
| Formats missing / signature errors | Install Node.js; keep --remote-components ejs:github |
| Chinese shows as boxes | Install a CJK font such as Noto Sans CJK SC |
NoneType thumbnail warning | pip install mutagen for ASS/FLAC cover embedding |
| mp4 lacks font styling | Use mkv; mp4 converts ASS to mov_text and drops the font size |
| Large flac files | Expected: FLAC stores PCM losslessly; use m4a for smaller files |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

