garroshub/MixCut-Skill / skills
youtube-clipper
VerifiedYouTube 视频智能剪辑工具。下载视频和字幕,AI 分析生成精细章节(几分钟级别), 用户选择片段后自动剪辑、翻译字幕为中英双语、烧录字幕到视频,并生成总结文案。 使用场景:当用户需要剪辑 YouTube 视频、生成短视频片段、制作双语字幕版本时。 关键词:视频剪辑、YouTube、字幕翻译、双语字幕、视频下载、clip video
| File | Kind | Size |
|---|---|---|
| .env.example | other | 2.8 KB |
| .github/REPOSITORY_SETTINGS.md | markdown | 1.4 KB |
| .gitignore | other | 372 B |
| FIXES_AND_IMPROVEMENTS.md | markdown | 8.0 KB |
| LICENSE | other | 1.0 KB |
| README.md | markdown | 8.4 KB |
| README.zh-CN.md | markdown | 7.8 KB |
| SKILL.md | skill md | 10.6 KB |
| TECHNICAL_NOTES.md | markdown | 11.3 KB |
| install_as_skill.sh | script | 6.8 KB |
| references/ffmpeg-guide.md | markdown | 3.4 KB |
| references/subtitle-formatting.md | markdown | 7.7 KB |
| references/yt-dlp-guide.md | markdown | 6.3 KB |
| scripts/__init__.py | script | 128 B |
| scripts/analyze_subtitles.py | script | 8.2 KB |
| scripts/burn_subtitles.py | script | 8.5 KB |
| scripts/clip_video.py | script | 7.4 KB |
| scripts/download_video.py | script | 6.6 KB |
| scripts/extract_subtitle_clip.py | script | 3.6 KB |
| scripts/generate_summary.py | script | 6.1 KB |
| scripts/merge_bilingual_subtitles.py | script | 2.2 KB |
| scripts/translate_subtitles.py | script | 6.9 KB |
| scripts/utils.py | script | 8.0 KB |
install_as_skill.sh
View on GitHub#!/bin/bash
##############################################################################
# YouTube Clipper - Claude Code Skill 安装脚本
#
# 功能:
# 1. 自动创建 Skill 目录
# 2. 复制所有必要文件
# 3. 安装 Python 依赖
# 4. 检测系统依赖(yt-dlp、FFmpeg)
#
# 使用方法:
# bash install_as_skill.sh
##############################################################################
set -e # 遇到错误立即退出
# 颜色输出
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# 打印函数
print_info() {
echo -e "${BLUE}ℹ️ $1${NC}"
}
print_success() {
echo -e "${GREEN}✅ $1${NC}"
}
print_warning() {
echo -e "${YELLOW}⚠️ $1${NC}"
}
print_error() {
echo -e "${RED}❌ $1${NC}"
}
print_header() {
echo ""
echo "========================================"
echo "$1"
echo "========================================"
echo ""
}
# 检查命令是否存在
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# 主函数
main() {
print_header "YouTube Clipper - Claude Code Skill 安装"
# 1. 确定 Skill 目录
SKILL_DIR="$HOME/.claude/skills/youtube-clipper"
print_info "目标目录: $SKILL_DIR"
# 2. 检查是否已存在
if [ -d "$SKILL_DIR" ]; then
print_warning "Skill 目录已存在: $SKILL_DIR"
read -p "是否覆盖安装?(y/N) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
print_info "安装已取消"
exit 0
fi
print_info "删除旧版本..."
rm -rf "$SKILL_DIR"
fi
# 3. 创建目录
print_info "创建 Skill 目录..."
mkdir -p "$SKILL_DIR"
print_success "目录已创建"
# 4. 复制文件
print_info "复制项目文件..."
# 获取当前脚本所在目录(即项目根目录)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# 复制所有必要文件
cp -r "$SCRIPT_DIR"/* "$SKILL_DIR/"
# 排除不需要的文件
if [ -d "$SKILL_DIR/.git" ]; then
rm -rf "$SKILL_DIR/.git"
fi
if [ -d "$SKILL_DIR/venv" ]; then
rm -rf "$SKILL_DIR/venv"
fi
if [ -d "$SKILL_DIR/__pycache__" ]; then
rm -rf "$SKILL_DIR/__pycache__"
fi
if [ -d "$SKILL_DIR/youtube-clips" ]; then
rm -rf "$SKILL_DIR/youtube-clips"
fi
if [ -f "$SKILL_DIR/.env" ]; then
rm "$SKILL_DIR/.env"
fi
print_success "文件复制完成"
# 5. 检查 Python
print_info "检查 Python 环境..."
if ! command_exists python3; then
print_error "未找到 Python 3,请先安装 Python 3.8+"
exit 1
fi
PYTHON_VERSION=$(python3 --version)
print_success "Python 已安装: $PYTHON_VERSION"
# 6. 检查 pip
if ! command_exists pip3 && ! command_exists pip; then
print_error "未找到 pip,请先安装 pip"
exit 1
fi
print_success "pip 已安装"
# 7. 安装 Python 依赖
print_info "安装 Python 依赖..."
cd "$SKILL_DIR"
# 尝试使用 pip3,如果不存在则使用 pip
if command_exists pip3; then
pip3 install -q yt-dlp pysrt python-dotenv
else
pip install -q yt-dlp pysrt python-dotenv
fi
print_success "Python 依赖安装完成(yt-dlp、pysrt、python-dotenv)"
# 8. 检查 yt-dlp
print_info "检查 yt-dlp..."
if command_exists yt-dlp; then
YT_DLP_VERSION=$(yt-dlp --version)
print_success "yt-dlp 已安装: $YT_DLP_VERSION"
else
print_warning "yt-dlp 命令行工具未安装"
print_info "安装方法:"
print_info " macOS: brew install yt-dlp"
print_info " Ubuntu: sudo apt-get install yt-dlp"
print_info " 或: pip3 install -U yt-dlp"
fi
# 9. 检查 FFmpeg(关键:需要 libass 支持)
print_header "检查 FFmpeg(字幕烧录需要)"
FFMPEG_FOUND=false
LIBASS_SUPPORTED=false
# 检查 ffmpeg-full(macOS 推荐)
if [ -f "/opt/homebrew/opt/ffmpeg-full/bin/ffmpeg" ]; then
print_success "ffmpeg-full 已安装(Apple Silicon)"
FFMPEG_FOUND=true
LIBASS_SUPPORTED=true
elif [ -f "/usr/local/opt/ffmpeg-full/bin/ffmpeg" ]; then
print_success "ffmpeg-full 已安装(Intel Mac)"
FFMPEG_FOUND=true
LIBASS_SUPPORTED=true
elif command_exists ffmpeg; then
FFMPEG_VERSION=$(ffmpeg -version | head -n 1)
print_success "FFmpeg 已安装: $FFMPEG_VERSION"
FFMPEG_FOUND=true
# 检查 libass 支持
if ffmpeg -filters 2>&1 | grep -q "subtitles"; then
print_success "FFmpeg 支持 libass(字幕烧录可用)"
LIBASS_SUPPORTED=true
else
print_warning "FFmpeg 不支持 libass(字幕烧录不可用)"
fi
fi
if [ "$FFMPEG_FOUND" = false ]; then
print_error "FFmpeg 未安装"
print_info "安装方法:"
print_info " macOS: brew install ffmpeg-full # 推荐,包含 libass"
print_info " Ubuntu: sudo apt-get install ffmpeg libass-dev"
elif [ "$LIBASS_SUPPORTED" = false ]; then
print_warning "FFmpeg 缺少 libass 支持,字幕烧录功能将不可用"
print_info "解决方法(macOS):"
print_info " brew uninstall ffmpeg"
print_info " brew install ffmpeg-full"
fi
# 10. 创建 .env 文件
print_header "配置环境变量"
if [ -f "$SKILL_DIR/.env.example" ]; then
print_info "创建 .env 文件..."
cp "$SKILL_DIR/.env.example" "$SKILL_DIR/.env"
print_success ".env 文件已创建"
echo ""
print_info "配置文件位置: $SKILL_DIR/.env"
print_info "如需自定义配置,可编辑:"
print_info " nano $SKILL_DIR/.env"
print_info " 或"
print_info " code $SKILL_DIR/.env"
else
print_warning "未找到 .env.example 文件"
fi
# 11. 完成
print_header "安装完成!"
print_success "YouTube Clipper 已成功安装为 Claude Code Skill"
echo ""
print_info "安装位置: $SKILL_DIR"
echo ""
# 检查依赖状态
if [ "$FFMPEG_FOUND" = false ] || [ "$LIBASS_SUPPORTED" = false ]; then
print_warning "系统依赖不完整,部分功能可能不可用"
echo ""
fi
print_info "使用方法:"
print_info " 在 Claude Code 中输入:"
print_info " \"剪辑这个 YouTube 视频:https://youtube.com/watch?v=VIDEO_ID\""
echo ""
print_info "详细文档:"
print_info " - Skill 使用指南: $SKILL_DIR/SKILL.md"
print_info " - 项目文档: $SKILL_DIR/README.md"
print_info " - 技术说明: $SKILL_DIR/TECHNICAL_NOTES.md"
echo ""
print_success "祝使用愉快! 🎉"
echo ""
}
# 错误处理
trap 'print_error "安装过程中发生错误"; exit 1' ERR
# 运行主函数
main
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |