2021年8月5日
youtube-dl 批量下载YouTube视频
安装
curl -L https://yt-dl.org/latest/youtube-dl -o /usr/bin/youtube-dl
chmod 755 /usr/bin/youtube-dl
列出视频信息
youtube-dl -F https://www.youtube.com/watch?v=j_JgXJ-apXs
输出可用的视频信息
[info] Available formats for j_JgXJ-apXs:
format code extension resolution note
139 m4a audio only DASH audio 56k , m4a_dash container, mp4a.40.5@ 48k (22050Hz), 756.44KiB
249 webm audio only DASH audio 56k , opus @ 50k, 724.28KiB
250 webm audio only DASH audio 69k , opus @ 70k, 902.75KiB
171 webm audio only DASH audio 110k , vorbis@128k, 1.32MiB
251 webm audio only DASH audio 122k , opus @160k, 1.57MiB
140 m4a audio only DASH audio 146k , m4a_dash container, mp4a.40.2@128k (44100Hz), 1.97MiB
278 webm 256x144 144p 97k , webm container, vp9, 24fps, video only, 1.33MiB
160 mp4 256x144 DASH video 102k , avc1.4d400c, 24fps, video only, 731.53KiB
133 mp4 426x240 DASH video 174k , avc1.4d4015, 24fps, video only, 1.36MiB
242 webm 426x240 240p 221k , vp9, 24fps, video only, 1.74MiB
134 mp4 640x360 DASH video 369k , avc1.4d401e, 24fps, video only, 2.90MiB
243 webm 640x360 360p 500k , vp9, 24fps, video only, 4.15MiB
135 mp4 854x480 DASH video 746k , avc1.4d401e, 24fps, video only, 6.11MiB
244 webm 854x480 480p 844k , vp9, 24fps, video only, 7.27MiB
247 webm 1280x720 720p 1155k , vp9, 24fps, video only, 9.21MiB
136 mp4 1280x720 DASH video 1300k , avc1.4d401f, 24fps, video only, 9.66MiB
248 webm 1920x1080 1080p 1732k , vp9, 24fps, video only, 14.24MiB
137 mp4 1920x1080 DASH video 2217k , avc1.640028, 24fps, video only, 15.28MiB
17 3gp 176x144 small , mp4v.20.3, mp4a.40.2@ 24k
36 3gp 320x180 small , mp4v.20.3, mp4a.40.2
43 webm 640x360 medium , vp8.0, vorbis@128k
18 mp4 640x360 medium , avc1.42001E, mp4a.40.2@ 96k
22 mp4 1280x720 hd720 , avc1.64001F, mp4a.40.2@192k (best)
根据上面列出的视频信息下载对应的视频格式
youtube-dl -f 18 https://www.youtube.com/watch?v=j_JgXJ-apXs
-c 断点续传(如果由于意外原因下载中断了,再次启动下载命令时,可以实现断点续传)
-i 忽略报错(如果出现某些链接无法打开或者下载的问题,会自动绕过,继续下载其他视频)
youtube-dl -c -i -f 18 https://www.youtube.com/watch?v=j_JgXJ-apXs
–proxy 设置代理
youtube-dl -c -i -f 18 --proxy http://127.0.0.1:8888 https://www.youtube.com/watch?v=j_JgXJ-apXs
-a 指定下载列表, list.txt是存放链接的文件
youtube-dl -a list.txt