360 Secure SkillHub
360 安全技能中心

Download Video

该 Skill 指导通过 yt-dlp 从 YouTube 或 Bilibili 按 URL 或标题搜索下载视频,保存到本地 Videos 文件夹,并附常用参数(音频、分辨率、字幕、限速)与常见错误处理建议。需要本机安装 yt-dlp,ffmpeg 用于合并音视频流。

zzlupus
zzlupus
热度 27.48
最近更新 2026-05-14 09:41:49
分类:自动化依赖:代码执行 / 读写文件 / 第三方 API应用场景:自动化脚本 / 工作流 / 文件转换

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add download-video
Metadata
name
download-video
description
Use when the user wants to download a YouTube or Bilibili video by URL or title, saving to local Videos folder

Download Video (YouTube / Bilibili)

Overview

Use yt-dlp to download videos from YouTube or Bilibili. Downloads go to the user's Videos folder (~/Videos).

Prerequisites

yt-dlp must be installed:

yt-dlp --version

# Install if missing
pip install yt-dlp        # cross-platform
winget install yt-dlp      # Windows
brew install yt-dlp        # macOS
sudo apt install yt-dlp    # Debian/Ubuntu

ffmpeg is recommended for merging video+audio streams.

Download by URL

yt-dlp -o "<videos-dir>/%(title)s.%(ext)s" "<url>"

Replace <videos-dir> with the user's Videos folder path, and <url> with the video URL.

Supported URLs:

  • YouTube: https://www.youtube.com/watch?v=... or https://youtu.be/...
  • Bilibili: https://www.bilibili.com/video/BV...

Download by Title (search)

# YouTube
yt-dlp -o "<videos-dir>/%(title)s.%(ext)s" "ytsearch1:<title>"

# Bilibili
yt-dlp -o "<videos-dir>/%(title)s.%(ext)s" "bilisearch1:<title>"

Quick Reference

Goal Flag
Best quality (default) -f bestvideo+bestaudio/best
Audio only (mp3) -x --audio-format mp3
Specific resolution -f "bestvideo[height<=720]+bestaudio"
Subtitles --write-subs --sub-langs zh-Hans,en
Playlist (all videos) just pass the playlist URL
Limit speed --rate-limit 2M

Common Mistakes

  • "ffmpeg not found" — merge of best video+audio fails. Install ffmpeg or use -f best (single stream).
  • Bilibili login-required content — add cookies with --cookies-from-browser chrome.
  • Videos folder missing — create it first.

Workflow

  1. URL given → download directly
  2. Title given → use ytsearch1: or bilisearch1: prefix
  3. yt-dlp missing → install, then retry
  4. Error → read error message, check Common Mistakes above