-
前言 有时候我们想要视频保存到本地以便离线回看。yt-dlp是一款功能强大的命令行工具,专注于下载视频与音频内容,支持数千个平台,是开源下载工具爱好者的常用选择。
-
历史沿革:从 youtube-dl 到 yt-dlp
+
前言 yt-dlp是一款功能强大的命令行工具,专注于下载视频与音频内容,支持数千个平台,是开源下载工具爱好者的常用选择。
+
+
有时候我们想要下载网络上的某些视频,比如Bilibili,YouTube等等,但它们没有提供下载按钮,这时候就可以用开源的yt-dlp来进行下载。和Aria2一样,很多下载软件的核心就是yt-dlp.
+
历史
-
起源与演进
@@ -128,21 +130,21 @@
-
停滞,youtube-dlc → yt-dlp 的诞生
-随着开发进度放缓,社区于 2020 年衍生出 youtube-dlc 分支,随即在 2021 年演变为更活跃的 yt-dlp 项目,它继承了 youtube-dl 的核心功能,并引入更多改进,包括更好的格式选择、多线程下载等,迅速在 Linux 发行版中取代 youtube-dl (如 Ubuntu 22.04 之后).
+随着开发进度放缓,社区于 2020 年衍生出 youtube-dlc 分支,在2021 年演变为更活跃的 yt-dlp 项目,它继承了 youtube-dl 的核心功能,并引入更多改进,包括更好的格式选择、多线程下载等,成为了GitHub上star最多的项目之一.
-
重构与功能拓展
yt-dlp 从 youtube-dlc 完全重构,新增许多 extractor(解析器)、改进配置与默认行为,还扩展了插件系统和兼容性支持.
-
各平台安装指南
-
-- 通用(Linux/macOS/Windows)
-
-
下载官方最新可执行文件:
-
sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp
-sudo chmod a+rx /usr/local/bin/yt-dlp
-
+
安装
+
Windows
+
从yt-dlp官方GitHub上下载exe二进制文件:
+
yt-dlp
+
将其放到一个目录下,比如C:\Users\<你的用户名>\yt-dlp\yt-dlp.exe,随后添加环境变量。
+
+添加环境变量:Win键搜索“环境变量”,打开“编辑系统环境变量”,点击最下方的“环境变量”,选择“系统变量”中的path,点击“编辑”,新建一个变量,将上面的目录 C:\Users<你的用户名>\yt-dlp\ 写入,注意去掉前后引号,随后确定-确定-确定退出。
+
更新版本:
yt-dlp -U
@@ -151,29 +153,103 @@
python3 -m pip install -U yt-dlp
+
Linux 发行版
-
各发行版可能提供略滞后的 yt-dlp:
-
--
-
Debian / Ubuntu:sudo apt install yt-dlp
-
--
-
Arch / Manjaro:sudo pacman -S yt-dlp
-
--
-
Fedora:sudo dnf install yt-dlp 等。
-
--
-
Android(Termux)
-
+- Debian / Ubuntu:
sudo apt install yt-dlp
+- Arch / Manjaro:
sudo pacman -S yt-dlp
+- Fedora:
sudo dnf install yt-dlp
+- Nixos:
+
{pkgs, ...}: {
+ home.packages = with pkgs; [
+ peazip
+ ];
+}
+
+
Android(Termux)
pkg update && pkg upgrade
pkg install python libexpat openssl ffmpeg
python3 -m pip install -U yt-dlp
-
常用命令
+
下载实战
+
+
yt-dlp "https://www.bilibili.com/video/BVxxxxx" --write-subs --embed-subs --sub-langs all,-live_chat
+
+--write-subs: 将字幕文件下载为单独文件 (如 .vtt 或 .ass)
+
+--embed-subs: 将下载的字幕嵌入到视频文件中(如果格式支持)
+
+--sub-langs all,-live_chat: 下载所有字幕语言,但排除像“弹幕/实时聊天”之类的非标准字幕流
+
+
+
先使用这个命令查看可用格式:
+
yt-dlp -F https://www.youtube.com/watch?v=xxxxxxxxxxxx
+
+
然后它会列举出所有可用的格式,如下:
+
[youtube] MgtOAVOXBWo: Downloading webpage
+[youtube] MgtOAVOXBWo: Downloading tv client config
+[youtube] MgtOAVOXBWo: Downloading tv player API JSON
+[youtube] MgtOAVOXBWo: Downloading ios player API JSON
+[youtube] MgtOAVOXBWo: Downloading m3u8 information
+[info] Available formats for MgtOAVOXBWo:
+ID EXT RESOLUTION FPS │ FILESIZE TBR PROTO │ VCODEC VBR ACODEC MORE INFO
+──────────────────────────────────────────────────────────────────────────────────────────────────────────
+sb2 mhtml 48x27 0 │ mhtml │ images storyboard
+sb1 mhtml 80x45 0 │ mhtml │ images storyboard
+sb0 mhtml 160x90 0 │ mhtml │ images storyboard
+233 mp4 audio only │ m3u8 │ audio only unknown Untested, Default, low
+234 mp4 audio only │ m3u8 │ audio only unknown Untested, Default, high
+602 mp4 256x144 15 │ ~ 9.23MiB 81k m3u8 │ vp09.00.10.08 81k video only Untested
+269 mp4 256x144 30 │ ~ 14.94MiB 130k m3u8 │ avc1.4D400C 130k video only Untested
+603 mp4 256x144 30 │ ~ 15.90MiB 139k m3u8 │ vp09.00.11.08 139k video only Untested
+229 mp4 426x240 30 │ ~ 33.33MiB 291k m3u8 │ avc1.4D4015 291k video only Untested
+604 mp4 426x240 30 │ ~ 25.82MiB 225k m3u8 │ vp09.00.20.08 225k video only Untested
+230 mp4 640x360 30 │ ~ 73.50MiB 642k m3u8 │ avc1.4D401E 642k video only Untested
+605 mp4 640x360 30 │ ~ 55.73MiB 487k m3u8 │ vp09.00.21.08 487k video only Untested
+231 mp4 854x480 30 │ ~104.35MiB 911k m3u8 │ avc1.4D401F 911k video only Untested
+606 mp4 854x480 30 │ ~ 94.79MiB 827k m3u8 │ vp09.00.30.08 827k video only Untested
+311 mp4 1280x720 60 │ ~330.73MiB 2887k m3u8 │ avc1.4D4020 2887k video only Untested
+612 mp4 1280x720 60 │ ~197.04MiB 1720k m3u8 │ vp09.00.40.08 1720k video only Untested
+312 mp4 1920x1080 60 │ ~486.64MiB 4248k m3u8 │ avc1.64002A 4248k video only Untested
+617 mp4 1920x1080 60 │ ~369.06MiB 3222k m3u8 │ vp09.00.41.08 3222k video only Untested
+623 mp4 2560x1440 60 │ ~ 1.00GiB 8945k m3u8 │ vp09.00.50.08 8945k video only Untested
+
+
我们下载312和233,即视频和音频,使用以下命令:
+
yt-dlp -f "312+233" -o "<新视频的名字,要短一点>.%(ext)s" https://www.youtube.com/watch?v=xxxxxxxxxxxx
+
+
这行命令会自动将下载的312的1080p/H.264的视频和233的音频合并为一个mp4视频,注意新的名称不能太长,否则会下载失败。
+
如果要下载带字幕的视频,则使用
+
yt-dlp -f "312+233" --write-subs --write-auto-subs --embed-subs --sub-langs "zh.*,en.*" -o "<新视频的名字,要短一点>.%(ext)s" https://www.youtube.com/watch?v=xxxxxxxxxxx
+
+
这个命令会:
+
+-
+
下载1080p视频
+
+-
+
下载中文和英文字幕(包括自动生成的)
+
+-
+
将字幕嵌入到视频文件中
+
+-
+
同时保存单独的字幕文件
+
+-
+
参数说明
+
+
+
--write-subs: 下载手动字幕
+--write-auto-subs: 下载自动生成的字幕
+--embed-subs: 将字幕嵌入到视频中
+--sub-langs "zh.*": 指定下载中文字幕(所有中文变体)
+--sub-format srt: 指定字幕格式(可选)
+
+
常用参数
-
yt-dlp "https://www.bilibili.com/video/BVxxxxx" --write-subs --embed-subs --sub-langs all,-live_chat
-
---write-subs: 将字幕文件下载为单独文件 (如 .vtt 或 .ass)
-
---embed-subs: 将下载的字幕嵌入到视频文件中(如果格式支持)
-
---sub-langs all,-live_chat: 下载所有字幕语言,但排除像“弹幕/实时聊天”之类的非标准字幕流
-
-
-
进阶技巧
-
--
-
FFmpeg 合并支持:若视频与音频分离,需安装 FFmpeg 才能完成合并。
-
--
-
处理地理限制:结合 --proxy 或 --geo-bypass 等选项使用 VPN/代理绕过区域限制。
-
--
-
应对下载失败(如 403):
-yt-dlp --rm-cache-dir
-
-
--
-
设置 UA、Referer、打印请求头调试:
---add-headers "User-Agent: ..." --print http_headers
-
-
--
-
Stability & 更新问题:建议避免使用发行版中的旧版本,推荐使用官方可执行或 pip 方法。
-
Done.
@@ -299,14 +341,14 @@
←
- 网络艺术:下载技术的历史
+ 下载系列(1):下载技术的历史
- 网络艺术:Aria2使用指南
+ 下载系列(3):Aria2使用指南
→
diff --git a/public/page/2/index.html b/public/page/2/index.html
index 08aa68b..3a78e02 100644
--- a/public/page/2/index.html
+++ b/public/page/2/index.html
@@ -104,7 +104,7 @@
-
+
@@ -116,13 +116,13 @@
:: tags:
- #网络艺术
+ #Network
-
前言 有时候我们想要视频保存到本地以便离线回看。yt-dlp是一款功能强大的命令行工具,专注于下载视频与音频内容,支持数千个平台,是开源下载工具爱好者的常用选择。
+
前言 yt-dlp是一款功能强大的命令行工具,专注于下载视频与音频内容,支持数千个平台,是开源下载工具爱好者的常用选择。
@@ -137,7 +137,7 @@
-
+
diff --git a/public/pagefind/fragment/en_109a394.pf_fragment b/public/pagefind/fragment/en_109a394.pf_fragment
deleted file mode 100644
index cdc1330..0000000
Binary files a/public/pagefind/fragment/en_109a394.pf_fragment and /dev/null differ
diff --git a/public/pagefind/fragment/en_1ad23f2.pf_fragment b/public/pagefind/fragment/en_1ad23f2.pf_fragment
deleted file mode 100644
index b6db98c..0000000
Binary files a/public/pagefind/fragment/en_1ad23f2.pf_fragment and /dev/null differ
diff --git a/public/pagefind/fragment/en_1af34b3.pf_fragment b/public/pagefind/fragment/en_1af34b3.pf_fragment
new file mode 100644
index 0000000..dfd2256
Binary files /dev/null and b/public/pagefind/fragment/en_1af34b3.pf_fragment differ
diff --git a/public/pagefind/fragment/en_1ebaf27.pf_fragment b/public/pagefind/fragment/en_1ebaf27.pf_fragment
new file mode 100644
index 0000000..839dc2b
Binary files /dev/null and b/public/pagefind/fragment/en_1ebaf27.pf_fragment differ
diff --git a/public/pagefind/fragment/en_24a0ddb.pf_fragment b/public/pagefind/fragment/en_24a0ddb.pf_fragment
deleted file mode 100644
index b6aa148..0000000
Binary files a/public/pagefind/fragment/en_24a0ddb.pf_fragment and /dev/null differ
diff --git a/public/pagefind/fragment/en_36c2d4b.pf_fragment b/public/pagefind/fragment/en_36c2d4b.pf_fragment
new file mode 100644
index 0000000..b3a3021
Binary files /dev/null and b/public/pagefind/fragment/en_36c2d4b.pf_fragment differ
diff --git a/public/pagefind/fragment/en_389d07c.pf_fragment b/public/pagefind/fragment/en_389d07c.pf_fragment
new file mode 100644
index 0000000..4e53c6e
Binary files /dev/null and b/public/pagefind/fragment/en_389d07c.pf_fragment differ
diff --git a/public/pagefind/fragment/en_428c942.pf_fragment b/public/pagefind/fragment/en_428c942.pf_fragment
deleted file mode 100644
index f0ec868..0000000
Binary files a/public/pagefind/fragment/en_428c942.pf_fragment and /dev/null differ
diff --git a/public/pagefind/fragment/en_458a5d6.pf_fragment b/public/pagefind/fragment/en_458a5d6.pf_fragment
new file mode 100644
index 0000000..23fc8fe
Binary files /dev/null and b/public/pagefind/fragment/en_458a5d6.pf_fragment differ
diff --git a/public/pagefind/fragment/en_45c9c22.pf_fragment b/public/pagefind/fragment/en_45c9c22.pf_fragment
new file mode 100644
index 0000000..06c2b70
Binary files /dev/null and b/public/pagefind/fragment/en_45c9c22.pf_fragment differ
diff --git a/public/pagefind/fragment/en_6e29666.pf_fragment b/public/pagefind/fragment/en_6e29666.pf_fragment
deleted file mode 100644
index 4f4ca7b..0000000
Binary files a/public/pagefind/fragment/en_6e29666.pf_fragment and /dev/null differ
diff --git a/public/pagefind/fragment/en_7048507.pf_fragment b/public/pagefind/fragment/en_7048507.pf_fragment
deleted file mode 100644
index ec58bf0..0000000
Binary files a/public/pagefind/fragment/en_7048507.pf_fragment and /dev/null differ
diff --git a/public/pagefind/fragment/en_8d31f65.pf_fragment b/public/pagefind/fragment/en_8d31f65.pf_fragment
deleted file mode 100644
index 78b4600..0000000
Binary files a/public/pagefind/fragment/en_8d31f65.pf_fragment and /dev/null differ
diff --git a/public/pagefind/fragment/en_8d6eeb5.pf_fragment b/public/pagefind/fragment/en_8d6eeb5.pf_fragment
deleted file mode 100644
index fa76bf2..0000000
Binary files a/public/pagefind/fragment/en_8d6eeb5.pf_fragment and /dev/null differ
diff --git a/public/pagefind/fragment/en_9686d6e.pf_fragment b/public/pagefind/fragment/en_9686d6e.pf_fragment
new file mode 100644
index 0000000..16f6395
Binary files /dev/null and b/public/pagefind/fragment/en_9686d6e.pf_fragment differ
diff --git a/public/pagefind/fragment/en_97c8a96.pf_fragment b/public/pagefind/fragment/en_97c8a96.pf_fragment
new file mode 100644
index 0000000..3b50c56
Binary files /dev/null and b/public/pagefind/fragment/en_97c8a96.pf_fragment differ
diff --git a/public/pagefind/fragment/en_ec5640e.pf_fragment b/public/pagefind/fragment/en_99d309c.pf_fragment
similarity index 89%
rename from public/pagefind/fragment/en_ec5640e.pf_fragment
rename to public/pagefind/fragment/en_99d309c.pf_fragment
index e1d7216..d29a127 100644
Binary files a/public/pagefind/fragment/en_ec5640e.pf_fragment and b/public/pagefind/fragment/en_99d309c.pf_fragment differ
diff --git a/public/pagefind/fragment/en_9dba92a.pf_fragment b/public/pagefind/fragment/en_9dba92a.pf_fragment
new file mode 100644
index 0000000..3117ded
Binary files /dev/null and b/public/pagefind/fragment/en_9dba92a.pf_fragment differ
diff --git a/public/pagefind/fragment/en_c461c0b.pf_fragment b/public/pagefind/fragment/en_c461c0b.pf_fragment
deleted file mode 100644
index 1518894..0000000
Binary files a/public/pagefind/fragment/en_c461c0b.pf_fragment and /dev/null differ
diff --git a/public/pagefind/fragment/en_d710c68.pf_fragment b/public/pagefind/fragment/en_d710c68.pf_fragment
deleted file mode 100644
index b4fbd79..0000000
Binary files a/public/pagefind/fragment/en_d710c68.pf_fragment and /dev/null differ
diff --git a/public/pagefind/index/en_1a222ef.pf_index b/public/pagefind/index/en_1a222ef.pf_index
deleted file mode 100644
index 9534d77..0000000
Binary files a/public/pagefind/index/en_1a222ef.pf_index and /dev/null differ
diff --git a/public/pagefind/index/en_3473584.pf_index b/public/pagefind/index/en_3473584.pf_index
new file mode 100644
index 0000000..75ba47d
Binary files /dev/null and b/public/pagefind/index/en_3473584.pf_index differ
diff --git a/public/pagefind/index/en_47b379d.pf_index b/public/pagefind/index/en_47b379d.pf_index
new file mode 100644
index 0000000..8996485
Binary files /dev/null and b/public/pagefind/index/en_47b379d.pf_index differ
diff --git a/public/pagefind/index/en_4fc9c25.pf_index b/public/pagefind/index/en_4fc9c25.pf_index
deleted file mode 100644
index 1c2247b..0000000
Binary files a/public/pagefind/index/en_4fc9c25.pf_index and /dev/null differ
diff --git a/public/pagefind/index/en_5b10636.pf_index b/public/pagefind/index/en_5b10636.pf_index
deleted file mode 100644
index b6dce6d..0000000
Binary files a/public/pagefind/index/en_5b10636.pf_index and /dev/null differ
diff --git a/public/pagefind/index/en_64127c8.pf_index b/public/pagefind/index/en_64127c8.pf_index
new file mode 100644
index 0000000..0bbec44
Binary files /dev/null and b/public/pagefind/index/en_64127c8.pf_index differ
diff --git a/public/pagefind/index/en_75561b2.pf_index b/public/pagefind/index/en_75561b2.pf_index
new file mode 100644
index 0000000..2c32447
Binary files /dev/null and b/public/pagefind/index/en_75561b2.pf_index differ
diff --git a/public/pagefind/index/en_78d4526.pf_index b/public/pagefind/index/en_78d4526.pf_index
deleted file mode 100644
index fc195de..0000000
Binary files a/public/pagefind/index/en_78d4526.pf_index and /dev/null differ
diff --git a/public/pagefind/index/en_e2ee7e8.pf_index b/public/pagefind/index/en_e2ee7e8.pf_index
deleted file mode 100644
index f9d7bb0..0000000
Binary files a/public/pagefind/index/en_e2ee7e8.pf_index and /dev/null differ
diff --git a/public/pagefind/index/en_ed18f58.pf_index b/public/pagefind/index/en_ed18f58.pf_index
new file mode 100644
index 0000000..b85399f
Binary files /dev/null and b/public/pagefind/index/en_ed18f58.pf_index differ
diff --git a/public/pagefind/pagefind-entry.json b/public/pagefind/pagefind-entry.json
index a4816cb..3504e42 100644
--- a/public/pagefind/pagefind-entry.json
+++ b/public/pagefind/pagefind-entry.json
@@ -1 +1 @@
-{"version":"1.3.0","languages":{"en":{"hash":"en_a5a6d11e14","wasm":"en","page_count":93}}}
\ No newline at end of file
+{"version":"1.3.0","languages":{"en":{"hash":"en_1bd37ccdd4","wasm":"en","page_count":92}}}
\ No newline at end of file
diff --git a/public/pagefind/pagefind.en_1bd37ccdd4.pf_meta b/public/pagefind/pagefind.en_1bd37ccdd4.pf_meta
new file mode 100644
index 0000000..fd5881c
Binary files /dev/null and b/public/pagefind/pagefind.en_1bd37ccdd4.pf_meta differ
diff --git a/public/pagefind/pagefind.en_a5a6d11e14.pf_meta b/public/pagefind/pagefind.en_a5a6d11e14.pf_meta
deleted file mode 100644
index b727b24..0000000
Binary files a/public/pagefind/pagefind.en_a5a6d11e14.pf_meta and /dev/null differ
diff --git a/public/sitemap.xml b/public/sitemap.xml
index 4978e51..9062ebb 100644
--- a/public/sitemap.xml
+++ b/public/sitemap.xml
@@ -224,9 +224,6 @@
https://blog.dich.bid/tags/network/
-
- https://blog.dich.bid/tags/wang-luo-yi-shu/
-
https://blog.dich.bid/tags/windows/
diff --git a/public/tags/index.html b/public/tags/index.html
index ac2c164..391970f 100644
--- a/public/tags/index.html
+++ b/public/tags/index.html
@@ -116,13 +116,7 @@
- Network (10 posts)
-
-
-
-
-
- 网络艺术 (2 posts)
+ Network (12 posts)
diff --git a/public/tags/network/index.html b/public/tags/network/index.html
index 4e25cfc..3191ccb 100644
--- a/public/tags/network/index.html
+++ b/public/tags/network/index.html
@@ -107,7 +107,7 @@ Dich'blog
tag: #Network
- (10 posts)
+ (12 posts)
@@ -116,9 +116,29 @@ Dich'blog
::
diff --git a/public/tags/wang-luo-yi-shu/index.html b/public/tags/wang-luo-yi-shu/index.html
deleted file mode 100644
index 1099b22..0000000
--- a/public/tags/wang-luo-yi-shu/index.html
+++ /dev/null
@@ -1,162 +0,0 @@
-
-
-
-
-
-Dich'blog
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- tag: #网络艺术
- (2 posts)
-
-
-
- Show all tags
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-