youtube-downloader について
youtube-downloaderは、yt-dlpを使ってYouTubeなどの対応サイトから動画や音声をダウンロードするスキルです。形式選択、字幕やメタデータの保存、バッチ処理、ファイル整理を案内します。
主な機能
- 01動画と音声のダウンロード
- 02形式と画質の選択
- 03プレイリストとチャンネルの取得
- 04字幕とメタデータの保存
- 05ファイル整理と一括処理
活用シーン
- 01形式を指定してプレイリストを保存
- 02動画から音声を抽出
- 03講座動画の字幕を取得
- 04既存分を除いてチャンネル動画を保存
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ jackspace/ claudeskillz --skill youtube-downloaderインストール後、Claude Code で/youtube-downloaderを入力して読み込まれたか確認します。
同梱ファイルSKILL.json
詳細
YouTube と動画のダウンロードスキル
最も高機能で活発に保守されている YouTube ダウンローダー、yt-dlp を使用して、YouTube やその他 1000 以上のウェブサイトから動画や音声をダウンロードします。
このスキルを使用する場面
次のような場合に使用します。
- YouTube 動画をあらゆる画質(144p から 8K、HDR、60fps)でダウンロードする
- 動画から音声を抽出する(MP3、M4A、FLAC、WAV、Opus)
- 再生リストやチャンネル全体をダウンロードする
- 複数の言語の動画字幕を取得する
- ライブ配信やプレミア公開をダウンロードする
- 削除される前にコンテンツをアーカイブする
- 1000 以上のウェブサイトからダウンロードする(YouTube 以外も対象)
- 複数の動画を一括ダウンロードする
- ファイル名や整理方法を指定してダウンロードする
- 動画のメタデータやサムネイルを抽出する
対応ウェブサイト(1000 以上)
動画プラットフォーム
- YouTube(動画、再生リスト、チャンネル、ショート、ライブ配信)
- Vimeo、Dailymotion、Twitter/X、Facebook
- TikTok、Instagram(動画、リール、ストーリーズ)
- Twitch(VOD、クリップ、ライブ配信)
- Reddit(v.redd.it 動画)
- Pornhub(動画)
- Youporn(動画)
教育
- Coursera、Udemy、Khan Academy
- edX、Pluralsight、LinkedIn Learning
ニュース・メディア
- CNN、BBC、NBC、CBS
- ESPN、Sky Sports
その他 1000 以上のサイトに対応しています…
インストール
yt-dlp の使用には Python 3.7 以降と、形式変換用の ffmpeg が必要です。
# Install yt-dlp (if not already installed)
pip install -U yt-dlp
# Install ffmpeg (required for format conversion)
# Ubuntu/Debian:
sudo apt install ffmpeg
# macOS:
brew install ffmpeg
# Verify installation
yt-dlp --version
ffmpeg -version
基本的な使い方
最高画質の動画をダウンロードする
yt-dlp "https://www.youtube.com/watch?v=VIDEO_ID"
最高音質の音声をダウンロードする(M4A 形式)
yt-dlp -f "bestaudio" "https://www.youtube.com/watch?v=VIDEO_ID"
ダウンロードして MP3 に変換する
yt-dlp -x --audio-format mp3 --audio-quality 0 "https://www.youtube.com/watch?v=VIDEO_ID"
指定した画質でダウンロードする
# 1080p video with best audio
yt-dlp -f "bestvideo[height<=1080]+bestaudio/best[height<=1080]" "URL"
# 4K video
yt-dlp -f "bestvideo[height<=2160]+bestaudio/best" "URL"
# 720p video
yt-dlp -f "bestvideo[height<=720]+bestaudio/best[height<=720]" "URL"
高度な機能
再生リスト全体をダウンロードする
yt-dlp "https://www.youtube.com/playlist?list=PLAYLIST_ID"
再生リストの指定範囲をダウンロードする
# Videos 1-10
yt-dlp --playlist-start 1 --playlist-end 10 "PLAYLIST_URL"
# Videos from #5 onwards
yt-dlp --playlist-start 5 "PLAYLIST_URL"
チャンネルの動画をすべてダウンロードする
yt-dlp "https://www.youtube.com/@ChannelName/videos"
字幕付きでダウンロードする
# Download all available subtitles
yt-dlp --write-subs --write-auto-subs --sub-langs "en,es,fr" "URL"
# Download and embed subtitles
yt-dlp --write-subs --embed-subs --sub-langs "en.*" "URL"
# Download only subtitles (no video)
yt-dlp --skip-download --write-subs --write-auto-subs "URL"
ファイル名と整理方法を指定する
# Custom filename template
yt-dlp -o "%(uploader)s/%(playlist)s/%(title)s.%(ext)s" "PLAYLIST_URL"
# By date uploaded
yt-dlp -o "%(upload_date)s - %(title)s.%(ext)s" "URL"
# With video ID
yt-dlp -o "%(title)s [%(id)s].%(ext)s" "URL"
サムネイルをダウンロードする
# Download and embed thumbnail
yt-dlp --write-thumbnail --embed-thumbnail "URL"
# Download thumbnail only
yt-dlp --write-thumbnail --skip-download "URL"
メタデータをダウンロードする
# Write metadata to JSON file
yt-dlp --write-info-json "URL"
# Write metadata to description file
yt-dlp --write-description "URL"
画質の選び方
動画の画質形式
# Best overall quality (may be WebM)
yt-dlp -f "bestvideo+bestaudio/best" "URL"
# Best MP4 format (most compatible)
yt-dlp -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]" "URL"
# 4K (2160p) maximum
yt-dlp -f "bestvideo[height<=2160]+bestaudio" "URL"
# 1080p maximum
yt-dlp -f "bestvideo[height<=1080]+bestaudio" "URL"
# 720p maximum
yt-dlp -f "bestvideo[height<=720]+bestaudio" "URL"
# 60fps preferred
yt-dlp -f "bestvideo[fps>30]+bestaudio/best" "URL"
音声の画質形式
# Best audio quality (extract as M4A)
yt-dlp -f "bestaudio" "URL"
# Extract as MP3 (best quality)
yt-dlp -x --audio-format mp3 --audio-quality 0 "URL"
# Extract as FLAC (lossless)
yt-dlp -x --audio-format flac "URL"
# Extract as Opus (efficient)
yt-dlp -x --audio-format opus "URL"
# Extract as WAV (uncompressed)
yt-dlp -x --audio-format wav "URL"
利用可能な形式の一覧表示
ダウンロードする前に、利用可能な形式を確認します。
yt-dlp -F "URL"
利用可能な動画・音声ストリームについて、次の情報が表示されます。
- フォーマット ID
- 拡張子
- 解像度
- FPS
- コーデック
- ファイルサイズ
- ビットレート
次に、指定した形式をダウンロードします。
yt-dlp -f FORMAT_ID "URL"
一括ダウンロード
ファイルから
URL を 1 行につき 1 つ記載したテキストファイルを作成します。
https://www.youtube.com/watch?v=VIDEO1
https://www.youtube.com/watch?v=VIDEO2
https://www.youtube.com/watch?v=VIDEO3
すべてダウンロードします。
yt-dlp -a urls.txt
アーカイブを使用する
ダウンロード済みの動画を記録し、再ダウンロードを防ぎます。
yt-dlp --download-archive archive.txt "PLAYLIST_URL"
ダウンロード済みの動画 ID を記録した archive.txt が作成されます。次回以降の実行では、yt-dlp はダウンロード済みの動画をスキップします。
フィルタリングと選択
日付フィルター
# Videos from 2024
yt-dlp --dateafter 20240101 "CHANNEL_URL"
# Videos before 2023
yt-dlp --datebefore 20230101 "CHANNEL_URL"
# Videos between dates
yt-dlp --dateafter 20230101 --datebefore 20231231 "CHANNEL_URL"
再生回数フィルター
# Videos with 1M+ views
yt-dlp --match-filter "view_count > 1000000" "CHANNEL_URL"
# Videos with less than 10K views
yt-dlp --match-filter "view_count < 10000" "CHANNEL_URL"
再生時間フィルター
# Videos longer than 10 minutes
yt-dlp --match-filter "duration > 600" "PLAYLIST_URL"
# Videos shorter than 5 minutes
yt-dlp --match-filter "duration < 300" "PLAYLIST_URL"
ライブ配信
ライブ配信をダウンロードする
# Wait for stream to start and download
yt-dlp --wait-for-video 60 "LIVE_STREAM_URL"
# Download stream as it's happening (may be incomplete if interrupted)
yt-dlp "LIVE_STREAM_URL"
速度制限とネットワーク設定
# Limit download speed (e.g., 1MB/s)
yt-dlp --limit-rate 1M "URL"
# Set number of retries
yt-dlp --retries 10 "URL"
# Wait between downloads (in seconds)
yt-dlp --sleep-interval 5 "PLAYLIST_URL"
# Use specific proxy
yt-dlp --proxy "http://proxy.server:port" "URL"
# Use cookies from browser (bypass age restrictions)
yt-dlp --cookies-from-browser chrome "URL"
地域制限の回避
# Use proxy
yt-dlp --proxy "socks5://proxy.server:1080" "URL"
# Use specific geo-bypass country
yt-dlp --geo-bypass-country US "URL"
後処理
動画の後処理
# Merge video and audio to MP4
yt-dlp --merge-output-format mp4 "URL"
# Re-encode to H.264
yt-dlp --recode-video mp4 "URL"
# Add metadata
yt-dlp --add-metadata "URL"
# Embed thumbnail
yt-dlp --embed-thumbnail "URL"
音声の後処理
# Extract audio and convert to MP3
yt-dlp -x --audio-format mp3 --audio-quality 0 "URL"
# Add metadata to audio file
yt-dlp -x --audio-format mp3 --add-metadata "URL"
よくある使用例
1. YouTube から音楽をダウンロードする
yt-dlp -x --audio-format mp3 --audio-quality 0 \
-o "%(artist)s - %(title)s.%(ext)s" \
--add-metadata \
--embed-thumbnail \
"MUSIC_VIDEO_URL"
2. 教育コースをダウンロードする
yt-dlp -o "%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s" \
--write-subs --embed-subs \
--write-info-json \
"COURSE_PLAYLIST_URL"
3. チャンネルをアーカイブする(新しい動画のみ)
yt-dlp --download-archive downloaded.txt \
-o "%(uploader)s/%(upload_date)s - %(title)s.%(ext)s" \
-f "bestvideo[height<=1080]+bestaudio/best" \
"https://www.youtube.com/@ChannelName/videos"
4. ポッドキャストを音声としてダウンロードする
yt-dlp -x --audio-format mp3 --audio-quality 0 \
-o "%(playlist)s/%(playlist_index)s. %(title)s.%(ext)s" \
--add-metadata \
"PODCAST_PLAYLIST_URL"
5. カンファレンスの講演をダウンロードする
yt-dlp -f "bestvideo[height<=720]+bestaudio" \
-o "Conference/%(title)s.%(ext)s" \
--write-subs --embed-subs --sub-langs en \
"CONFERENCE_PLAYLIST_URL"
6. 複数のサイトから一括ダウンロードする
# Create urls.txt with mixed URLs (YouTube, Vimeo, etc.)
yt-dlp -a urls.txt \
-f "bestvideo+bestaudio/best" \
-o "%(extractor)s/%(uploader)s/%(title)s.%(ext)s"
設定ファイル
デフォルトのオプションを設定するために、~/.config/yt-dlp/config を作成します。
# Default format
-f bestvideo[height<=1080]+bestaudio/best
# Output template
-o ~/Downloads/%(uploader)s/%(title)s.%(ext)s
# Embed metadata
--add-metadata
--embed-thumbnail
# Write subtitles
--write-subs
--sub-langs en
# Continue on errors
--ignore-errors
# Rate limit
--limit-rate 5M
トラブルシューティング
動画を利用できない
# Try with cookies from browser
yt-dlp --cookies-from-browser chrome "URL"
# Update yt-dlp
pip install -U yt-dlp
年齢制限のあるコンテンツ
# Use browser cookies
yt-dlp --cookies-from-browser firefox "URL"
# Or login with credentials
yt-dlp --username YOUR_USERNAME --password YOUR_PASSWORD "URL"
形式を利用できない
# List all formats first
yt-dlp -F "URL"
# Then select specific format
yt-dlp -f FORMAT_ID "URL"
ダウンロードが遅い
# Use multiple connections
yt-dlp --concurrent-fragments 4 "URL"
# Or use external downloader
yt-dlp --external-downloader aria2c "URL"
他のツールとの連携
FFmpeg との連携
インストールされている場合、yt-dlp は次の処理に ffmpeg を自動的に使用します。
- 動画と音声のストリームの結合
- 形式の変換
- サムネイルとメタデータの埋め込み
- 後処理
Aria2c を使った高速ダウンロード
yt-dlp --external-downloader aria2c \
--external-downloader-args "-x 16 -s 16 -k 1M" \
"URL"
法的・倫理的な留意事項
⚠️ 重要:
- ダウンロードするのは、権利を有するコンテンツのみにしてください
- 著作権と利用規約を尊重してください
- 著作権で保護されたコンテンツを配布しないでください
- YouTube の利用規約では、ほとんどのコンテンツのダウンロードが禁止されています
- 個人的なアーカイブや教育目的で使用してください
- 多くのクリエイターが公式のダウンロード手段を提供しています
- 公式チャンネルを通じてクリエイターを支援することをご検討ください
パフォーマンスのヒント
- アーカイブファイルを使用する:再ダウンロードを避けるため、ダウンロードを記録します
- 速度を制限する:
--limit-rateを使用してネットワークの混雑を防ぎます - フラグメントを並列処理する:
--concurrent-fragments 4で速度を向上させます - 形式を適切に選択する:品質を下げるとダウンロードが速くなります
- 外部ダウンローダーを使用する:aria2c は内蔵のダウンローダーより速い場合があります
- バッチを適切に処理する:一度にすべて処理せず、分割して処理します
更新
互換性を最大限に保つため、yt-dlp を最新の状態に保ってください:
# Update via pip
pip install -U yt-dlp
# Check version
yt-dlp --version
リソース
- yt-dlp GitHub:https://github.com/yt-dlp/yt-dlp
- 対応サイト:https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md
- 形式の選択:https://github.com/yt-dlp/yt-dlp#format-selection
バージョン:1.0.0 最終更新日:2025-11-07 メンテナンス担当:Claude Code Skills Collection