
youtube-dlが対応している動画共有サイト
bilibili | CNN | Dailymotion |
Dropbox | Google ドライブ | |
LiveLeak | Vimeo | Youku |
YouTube | ニコニコ動画 | パンドラTV |
その他1000以上ものサイトに対応している。
参照:フリー百科事典『ウィキペディア(Wikipedia)』
youtube-dlコマンドの書式
書式 |
---|
youtube-dl [オプション] URL [URL…] |
Youtube-dlコマンドの主なオプション
オプション | 説明 |
---|---|
-F | 利用可能なフォーマットを確認する。 |
-a | URLを記述したファイルからまとめてダウンロードする。 |
-U | アップデートする。 |
-f (format-code | extension) | (format-code | extension)を指定してダウンロードする。 |
-h | –help | ヘルプを表示する。 |
Youtube-dlをインストールする
Ubuntu,DebianのDebian系Linux
$ sudo apt install youtube-dl
[sudo] user のパスワード:
Fedra,CentOSのRedHat系Linux
$ sudo yum install youtube-dl
[sudo] user のパスワード:
Youtube-dlコマンドの使用例
YouTube動画をダウンロードする
フォーマットを指定しないときは自動で対応するフォーマットを選んでダウンロードする。
$ youtube-dl YouTube-URL
[youtube] YouTube-ID: Downloading webpage
[youtube] ouTube-ID: Downloading video info webpage
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
YouTube動画の利用可能なフォーマットを確認する
$ youtube-dl YouTube-URL
[youtube] YouTube-ID: Downloading webpage
[youtube] YouTube-ID: Downloading video info webpage
[info] Available formats for YouTube-ID:
format code extension resolution note
249 webm audio only tiny …
250 webm audio only tiny …
140 m4a audio only tiny …
251 webm audio only tiny …
278 webm 256×144 144p …
160 mp4 256×144 144p …
242 webm 426×240 240p …
133 mp4 426×240 240p …
243 webm 640×360 360p …
134 mp4 640×360 360p …
244 webm 854×480 480p …
135 mp4 854×480 480p …
247 webm 1280×720 720p …
136 mp4 1280×720 720p …
248 webm 1920×1080 1080p …
137 mp4 1920×1080 1080p …
43 webm 640×360 360p …
18 mp4 640×360 360p …
22 mp4 1280×720 720p …
YouTube動画の(format-code)を指定してダウンロードする
「format-code」の「160」を指定して画像解像度が144pでmp4のファイルをダウンロードする。
$ youtube-dl -f 160 YouTube-URL
YouTube動画の(extension)を指定してファイルをダウンロードする
「extension」の「mp4」を指定してmp4ファイルをダウンロードする。
$ youtube-dl -f mp4 YouTube-URL
URLを記述したファイルからすべてダウンロードする
「format-code」を指定しないときは自動で対応する「format-code」を選んでダウンロードする。
$ youtube-dl -a youtube-file
[youtube] YouTube-ID: Downloading webpage
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[youtube] YouTube-ID: Downloading video info webpage
[download] Destination: YouTube-Title
[download] 100% of 33.56MiB in 00:04
[youtube] ouTube-ID: Downloading webpage
[youtube] ouTube-ID: Downloading video info webpage
[download] Destination: ouTube-Title
[download] 100% of 33.06MiB in 00:12
[youtube] ouTube-ID: Downloading webpage
[youtube] ouTube-ID: Downloading video info webpage
[download] Destination: ouTube-Title
[download] 100% of 6.05MiB in 00:02
フォーマットを指定してURLを記述したファイルからすべてダウンロードする
「format-code」の「160」を指定して画像解像度が144pでmp4のファイルをダウンロードする。
$ youtube-dl -f 160 -a youtube-file
[youtube] YouTube-ID: Downloading webpage
[youtube] YouTube-ID: Downloading video info webpage
[download] Destination: YouTube-Title
[download] 100% of 33.56MiB in 00:04
[youtube] ouTube-ID: Downloading webpage
[youtube] ouTube-ID: Downloading video info webpage
[download] Destination: ouTube-Title
[download] 100% of 33.06MiB in 00:12
[youtube] ouTube-ID: Downloading webpage
[youtube] ouTube-ID: Downloading video info webpage
[download] Destination: ouTube-Title
[download] 100% of 6.05MiB in 00:02
参照元情報