Use when you have a written implementation plan to execute in a separate session with review checkpoints
npx skills add yizhiyanhua-ai/media-downloader
Or install specific skill: npx add-skill https://github.com/yizhiyanhua-ai/media-downloader
# Description
|
# SKILL.md
name: media-downloader
description: |
智能媒体下载器。根据用户描述自动搜索和下载图片、视频片段,支持视频自动剪辑。
Smart media downloader. Automatically search and download images/video clips based on user description, with auto-trimming support.
触发方式 Triggers: "下载图片", "找视频", "download media", "download images", "find video", "/media"
🎬 Media Downloader / 智能媒体下载器
只需告诉我你想要什么,我就会帮你找到并下载相关的图片和视频!
Just tell me what you want, and I'll find and download relevant images and videos for you!
🚀 我能帮你做什么?/ What Can I Do?
| 你说... / You say... | 我会... / I will... |
|---|---|
| "下载一些可爱的猫咪图片" | 搜索并下载 5 张猫咪图片 |
| "Download sunset photos" | Search and download sunset images |
| "找一段海浪的视频,15秒左右" | 下载一段 15 秒的海浪视频 |
| "Get me a 30-second cooking video" | Download a trimmed cooking clip |
| "下载这个 YouTube 视频的 1:30-2:00" | 下载并自动剪辑指定片段 |
✨ 功能特点 / Features
- 🖼️ 图片下载 - 从专业图库搜索高清图片
- 🎬 视频素材 - 获取免费商用视频片段
- 📺 YouTube 下载 - 支持下载和剪辑
- ✂️ 智能剪辑 - 自动裁剪到你需要的长度
- 🌍 中英双语 - 支持中文和英文指令
📋 Skill 执行逻辑 / Skill Execution Logic
🔑 API Key 按需配置 / On-Demand API Key Configuration
重要:不要在用户安装时就要求配置 API Key!按以下逻辑处理:
- 用户下载 YouTube 视频时:直接执行,不需要任何 API Key
- 用户首次下载图片时:
- 检查
PEXELS_API_KEY环境变量是否存在 -
如果不存在,引导用户配置:
```
检测到你还没有配置图库 API Key。下载图片需要一个免费的 API Key。请按以下步骤操作:
1. 打开 https://www.pexels.com,点击 Join 注册(支持 Google/Apple 一键注册)
2. 注册后访问 https://www.pexels.com/api/,点击 Your API Key
3. 复制显示的密钥,粘贴给我
- 用户提供 API Key 后,帮用户保存到系统环境变量:bash
echo 'export PEXELS_API_KEY="用户的密钥"' >> ~/.zshrc && source ~/.zshrc
```
- 然后继续完成图片下载任务
🎬 YouTube 下载优先 / YouTube First
当用户说「下载视频」但没有指定来源时,优先推荐 YouTube:
- YouTube 不需要 API Key
- 内容更丰富
- 支持时间段裁剪
💬 使用示例 / Examples
下载图片 / Download Images
"帮我下载 5 张星空的图片"
"Download 10 coffee shop photos"
"找一些适合做壁纸的风景图"
下载视频素材 / Download Video Clips
"下载一段城市夜景的视频,30秒以内"
"Find me a 15-second ocean wave video"
"找一些适合做背景的自然风光视频"
YouTube 下载与剪辑 / YouTube Download & Trim
"下载这个视频:https://youtube.com/watch?v=xxx"
"下载这个 YouTube 视频的第 2 分钟到第 3 分钟"
"只下载这个视频的音频"
📁 下载位置 / Download Location
所有文件默认保存在:
~/.claude/skills/media-downloader/downloads/
❓ 常见问题 / FAQ
Q: 为什么搜索图片没有结果?
A: 请确认已配置 API Key。运行 status 命令检查配置状态。
Q: YouTube 视频下载失败?
A: YouTube 下载不需要 API Key,但需要安装 yt-dlp。运行 pip install yt-dlp 安装。
Q: 视频剪辑功能不工作?
A: 需要安装 ffmpeg。macOS 用户运行 brew install ffmpeg。
Q: 这些图片/视频可以商用吗?
A: Pexels、Pixabay、Unsplash 的素材都可以免费商用,无需署名(但署名是一种礼貌)。
🛠️ CLI 命令参考 / CLI Reference
供高级用户直接使用命令行:
# 检查配置状态
media_cli.py status
# 下载图片
media_cli.py image "关键词" -n 数量 -o 输出目录
# 下载视频素材
media_cli.py video "关键词" -d 最大时长 -n 数量
# 下载 YouTube 视频
media_cli.py youtube "URL" --start 开始秒数 --end 结束秒数
# 搜索媒体(不下载)
media_cli.py search "关键词" --type image/video/all
# 剪辑本地视频
media_cli.py trim 输入文件 --start 开始 --end 结束
📦 支持的素材来源 / Supported Sources
| 来源 Source | 类型 Type | 特点 Features |
|---|---|---|
| Pexels | 图片 + 视频 | 高质量,更新快 |
| Pixabay | 图片 + 视频 | 数量多,种类全 |
| Unsplash | 图片 | 艺术感强,适合壁纸 |
| YouTube | 视频 | 内容丰富,支持剪辑 |
🎬 开始使用吧!直接告诉我你想要什么图片或视频!
🎬 Start using! Just tell me what images or videos you want!
# README.md
🎬 Media Downloader
Smart media downloader - Automatically search and download images/video clips based on your description, with auto-trimming support.
🚀 What Can I Do?
| You say... | I will... |
|---|---|
| "Download some cute cat pictures" | Search and download 5 cat images |
| "Find a 15-second ocean wave video" | Download a 15s ocean wave clip |
| "Get me a 30-second cooking video" | Download a trimmed cooking clip |
| "Download this YouTube video from 1:30 to 2:00" | Download and auto-trim the specified segment |
✨ Features
- 🖼️ Image Download - Search HD images from professional stock libraries
- 🎬 Video Clips - Get free commercial-use video footage
- 📺 YouTube Download - Download and trim support
- ✂️ Smart Trimming - Auto-crop to your desired length
- 🌍 Bilingual - Supports both Chinese and English commands
⚡ One-Line Install
In Claude Code, just say:
"Help me install https://github.com/yizhiyanhua-ai/media-downloader.git and all its dependencies, and configure yt-dlp to use browser cookies"
Claude will automatically:
- Download the skill to the correct location
- Install yt-dlp, ffmpeg and other dependencies
- Configure browser cookies (fixes YouTube "confirm you're not a bot" issue)
- Check installation status
Just click "Allow" when Claude asks for permission!
🔑 About API Keys
💡 On-Demand Configuration: No API Key needed during installation!
- YouTube Videos: No API Key required, works right after installation
- Image Downloads: Claude will guide you to configure Pexels API Key on first use
What Happens When You First Download Images?
When you first say "Download some cat pictures", Claude will:
- Detect that you haven't configured a stock photo API Key yet
- Guide you to register at https://www.pexels.com (Google/Apple quick signup supported)
- Help you get the API Key and automatically save it to system environment variables
- Then continue with the image download
The whole process takes just a few minutes, and you only need to do it once!
📋 More Image Sources (Optional)
Pexels covers most needs. If you want more image sources, just tell Claude:
"Help me configure Pixabay API Key" or "Help me configure Unsplash API Key"
Claude will guide you through registration and configuration.
💬 Usage Examples
⚠️ Important: Before using, tell Claude "Check the status of media-downloader" to make sure all dependencies are installed!
Download Images
"Download 5 starry sky images"
"Download 10 coffee shop photos"
"Find some landscape images suitable for wallpapers"
Download Videos
💡 Recommended: If you need to download videos, use YouTube first! YouTube has rich content, high quality, and doesn't require an extra API Key.
"Download this video: https://youtube.com/watch?v=xxx"
"Download minute 2 to minute 3 of this YouTube video"
"Only download the audio from this video"
If you need short video clips from stock libraries:
"Download a city night video, under 30 seconds"
"Find me a 15-second ocean wave video"
"Find some natural scenery videos suitable for backgrounds"
📁 Download Location
By default, all files are saved to:
~/.claude/skills/media-downloader/downloads/
Custom Download Directory
You can specify a custom download location using the -o or --output option:
# Download images to a specific folder
media_cli.py image "cats" -o ~/Pictures/cats
# Download videos to Desktop
media_cli.py video "sunset" -o ~/Desktop
# Download YouTube video to current directory
media_cli.py youtube "URL" -o .
Or simply tell me where you want the files:
"Download 5 cat images to my Desktop"
"Save the video to ~/Videos/project"
❓ FAQ
Q: YouTube says "Sign in to confirm you're not a bot"?
This is YouTube's anti-bot mechanism. The solution is to let yt-dlp use your browser's login session:
Method 1: Tell Claude (Recommended)
"Help me configure yt-dlp to use browser cookies"
Claude will set it up for you.
Method 2: Manual Configuration
- Make sure you're logged into YouTube in your browser (Chrome/Firefox/Edge)
- Add
--cookies-from-browser chromewhen downloading:
yt-dlp --cookies-from-browser chrome "YouTube_URL"
💡 Tip: Replace
chromewith your browser:firefox,edge,safari,brave, etc.
Q: Why are there no image search results?
A: Please confirm API Key is configured. Run status command to check configuration status.
Q: YouTube video download failed?
A: YouTube download doesn't need an API Key, but requires yt-dlp. Run pip install yt-dlp to install.
Q: Video trimming doesn't work?
A: ffmpeg is required. macOS users run brew install ffmpeg.
Q: Can these images/videos be used commercially?
A: Assets from Pexels, Pixabay, and Unsplash can all be used commercially for free, no attribution required (though attribution is appreciated).
🛠️ CLI Reference
For advanced users using command line directly:
# Check configuration status
media_cli.py status
# Download images
media_cli.py image "keywords" -n count -o output_dir
# Download stock videos
media_cli.py video "keywords" -d max_duration -n count
# Download YouTube video
media_cli.py youtube "URL" --start start_seconds --end end_seconds
# Search media (no download)
media_cli.py search "keywords" --type image/video/all
# Trim local video
media_cli.py trim input_file --start start --end end
📦 Supported Sources
| Source | Type | Features |
|---|---|---|
| Pexels | Images + Videos | High quality, frequently updated |
| Pixabay | Images + Videos | Large quantity, diverse categories |
| Unsplash | Images | Artistic, great for wallpapers |
| YouTube | Videos | Rich content, trimming support |
📄 License
MIT License
🎬 Start using! Just tell me what images or videos you want!
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.