video-downloader

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Video Downloader - Download Videos with yt-dlp

视频下载工具 - 使用yt-dlp下载视频

Download videos, audio, or subtitles from YouTube, Bilibili, Twitter, and 1000+ other sites using yt-dlp.
使用yt-dlp从YouTube、Bilibili、Twitter及其他1000+平台下载视频、音频或字幕。

When to Use

适用场景

  • User asks to download a video
  • User asks to download or extract audio
  • User asks to download subtitles
  • User provides a video URL (YouTube, Bilibili, Twitter, etc.)
  • User wants to specify video quality (720p, 1080p, etc.)
  • 用户要求下载视频
  • 用户要求下载或提取音频
  • 用户要求下载字幕
  • 用户提供视频URL(YouTube、Bilibili、Twitter等)
  • 用户想要指定视频画质(720p、1080p等)

Prerequisites - Auto Install

前置条件 - 自动安装

IMPORTANT: Before any download, check and install dependencies automatically.
重要提示: 在进行任何下载操作前,请自动检查并安装依赖项。

Step 0: Check and Install Dependencies

步骤0:检查并安装依赖项

bash
undefined
bash
undefined

Check if yt-dlp is installed, install if missing

Check if yt-dlp is installed, install if missing

if ! command -v yt-dlp &>/dev/null; then echo "Installing yt-dlp..." brew install yt-dlp fi
if ! command -v yt-dlp &>/dev/null; then echo "Installing yt-dlp..." brew install yt-dlp fi

Check if ffmpeg is installed, install if missing

Check if ffmpeg is installed, install if missing

if ! command -v ffmpeg &>/dev/null; then echo "Installing ffmpeg..." brew install ffmpeg fi
if ! command -v ffmpeg &>/dev/null; then echo "Installing ffmpeg..." brew install ffmpeg fi

Verify installation

Verify installation

yt-dlp --version && echo "yt-dlp: ready" ffmpeg -version 2>&1 | head -1 && echo "ffmpeg: ready"

Run this check **every time** before downloading. Install automatically without asking user.
yt-dlp --version && echo "yt-dlp: ready" ffmpeg -version 2>&1 | head -1 && echo "ffmpeg: ready"

每次下载前都要运行此检查,无需询问用户,自动完成安装。

Instructions for Agent

Agent操作指南

Step 1: Ensure Dependencies Installed

步骤1:确保依赖项已安装

Run the prerequisite check above. If yt-dlp or ffmpeg is missing, install via
brew install yt-dlp ffmpeg
.
运行上述前置条件检查。如果缺少yt-dlp或ffmpeg,通过
brew install yt-dlp ffmpeg
进行安装。

Step 2: Parse User Intent

步骤2:解析用户意图

Identify what the user wants:
User IntentKeywords
Video (default)"download", "video"
Audio only"audio", "mp3", "music", "extract audio"
Video + Subtitles"with subtitles", "embed subtitles"
Subtitles only"only subtitles", "subtitles only", "just subtitles"
Specific quality"720p", "1080p", "4k", "best", "worst"
识别用户需求:
用户意图关键词
视频下载(默认)"download"、"video"
仅音频"audio"、"mp3"、"music"、"extract audio"
视频+字幕"with subtitles"、"embed subtitles"
仅字幕"only subtitles"、"subtitles only"、"just subtitles"
指定画质"720p"、"1080p"、"4k"、"best"、"worst"

Step 3: Build Command

步骤3:构建命令

Base command structure:
bash
yt-dlp [OPTIONS] "URL"
Common options by intent:
  1. Basic video download (best quality):
bash
yt-dlp -o "%(title)s.%(ext)s" "URL"
  1. Audio only (MP3):
bash
yt-dlp -x --audio-format mp3 -o "%(title)s.%(ext)s" "URL"
  1. Specific quality (e.g., 720p):
bash
yt-dlp -f "bestvideo[height<=720]+bestaudio/best[height<=720]" -o "%(title)s.%(ext)s" "URL"
  1. Video with embedded subtitles:
bash
yt-dlp --write-subs --sub-lang en,zh-Hans,zh-Hant --embed-subs -o "%(title)s.%(ext)s" "URL"
  1. Subtitles only (no video):
bash
yt-dlp --write-subs --write-auto-subs --sub-lang en,zh-Hans,zh-Hant --skip-download -o "%(title)s" "URL"
基础命令结构:
bash
yt-dlp [OPTIONS] "URL"
按意图分类的常用选项:
  1. 基础视频下载(最佳画质):
bash
yt-dlp -o "%(title)s.%(ext)s" "URL"
  1. 仅音频(MP3格式)
bash
yt-dlp -x --audio-format mp3 -o "%(title)s.%(ext)s" "URL"
  1. 指定画质(例如720p):
bash
yt-dlp -f "bestvideo[height<=720]+bestaudio/best[height<=720]" -o "%(title)s.%(ext)s" "URL"
  1. 带内嵌字幕的视频
bash
yt-dlp --write-subs --sub-lang en,zh-Hans,zh-Hant --embed-subs -o "%(title)s.%(ext)s" "URL"
  1. 仅字幕(无视频):
bash
yt-dlp --write-subs --write-auto-subs --sub-lang en,zh-Hans,zh-Hant --skip-download -o "%(title)s" "URL"

Step 4: Execute and Report

步骤4:执行并反馈

Run the command and report:
  • File name and location
  • File size (if available)
  • Any warnings or errors
运行命令后反馈以下信息:
  • 文件名及存储位置
  • 文件大小(若可获取)
  • 任何警告或错误信息

Command Reference

命令参考

TaskCommand
Best quality video
yt-dlp "URL"
Audio (MP3)
yt-dlp -x --audio-format mp3 "URL"
Audio (M4A)
yt-dlp -x --audio-format m4a "URL"
720p video
yt-dlp -f "bv[height<=720]+ba/b[height<=720]" "URL"
1080p video
yt-dlp -f "bv[height<=1080]+ba/b[height<=1080]" "URL"
4K video
yt-dlp -f "bv[height<=2160]+ba/b[height<=2160]" "URL"
With subtitles
yt-dlp --write-subs --embed-subs "URL"
Subtitles only
yt-dlp --write-subs --write-auto-subs --skip-download "URL"
List formats
yt-dlp -F "URL"
Playlist
yt-dlp -o "%(playlist_index)s-%(title)s.%(ext)s" "PLAYLIST_URL"
任务命令
最佳画质视频
yt-dlp "URL"
音频(MP3格式)
yt-dlp -x --audio-format mp3 "URL"
音频(M4A格式)
yt-dlp -x --audio-format m4a "URL"
720p视频
yt-dlp -f "bv[height<=720]+ba/b[height<=720]" "URL"
1080p视频
yt-dlp -f "bv[height<=1080]+ba/b[height<=1080]" "URL"
4K视频
yt-dlp -f "bv[height<=2160]+ba/b[height<=2160]" "URL"
带字幕的视频
yt-dlp --write-subs --embed-subs "URL"
仅字幕
yt-dlp --write-subs --write-auto-subs --skip-download "URL"
列出可用格式
yt-dlp -F "URL"
播放列表下载
yt-dlp -o "%(playlist_index)s-%(title)s.%(ext)s" "PLAYLIST_URL"

Response Guidelines

回复准则

  • Always confirm what will be downloaded before starting
  • Show download progress or final result
  • Report the output file name and location
  • If download fails, explain the error and suggest solutions
  • 开始下载前务必确认将要下载的内容
  • 展示下载进度或最终结果
  • 告知输出文件名及存储位置
  • 若下载失败,说明错误原因并给出解决方案

Error Handling

错误处理

ErrorSolution
yt-dlp: command not found
Auto-install:
brew install yt-dlp
ffmpeg not found
Auto-install:
brew install ffmpeg
Video unavailable
Check if URL is correct or video is region-locked
Private video
Cannot download private videos without authentication
Format not available
Use
yt-dlp -F URL
to list available formats
No subtitles found
Try
--write-auto-subs
for auto-generated subtitles
brew: command not found
Install Homebrew first:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
错误解决方案
yt-dlp: command not found
自动安装:
brew install yt-dlp
ffmpeg not found
自动安装:
brew install ffmpeg
Video unavailable
检查URL是否正确或视频是否受区域限制
Private video
无认证情况下无法下载私有视频
Format not available
使用
yt-dlp -F URL
查看可用格式
No subtitles found
尝试添加
--write-auto-subs
参数获取自动生成的字幕
brew: command not found
先安装Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"