0%

Youtube-dl日常用法

youtube-dl 被 github 下架了

关于

  • -ciw 默认带上
  • 网络状况不好情况下, aria2 效果较好
  • 使用基于网卡 tun/tap 的代理软件(比如 netchx)避免很多麻烦

常见参数和例子

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# demo
youtube-dl --external-downloader aria2c --external-downloader ar
ia2c --external-downloader-args "-x 16 -k 1M" -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio' --proxy 'http://127.0.0.1:10809'

# 代理
youtube-dl --proxy 'http://127.0.0.1:1080'

# 下载引擎
--external-downloader aria2c

# 格式
youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio' --merge-output-format mp4

# cookies
youtube-dl -cookies cookies.tx

# 忽略错误警告
youtube-dl -ciw

# 下载视频列表
youtube-dl --playlist-items

# 可用格式
youtube-dl --list-formats

# 用户名密码
youtube -u username -p password

# 下载参数(不常用)
--external-downloader-args "-x 16 -k 1M"

# 栗子 1(下载 4k 转为 mp4)
youtube-dl -ciw -f 'bestvideo[ext=webm]+bestaudio[ext=m4a]/bestvideo+bestaudio' --merge-output-format mp4

# 栗子 2(下载 1080p 转为 mkv)
youtube-dl -ciw -f 'bestvideo[ext=mp4]+bestaudio[ext=mp4]/bestvideo+bestaudio' --merge-output-format mkv

# 栗子 3(自动寻找分辨率大于等于 1080p 的可用格式进行下载)
youtube-dl -ciw -f best[height>=1080]