跳至內容
yt-dlp

在 Linux 上安裝 yt-dlp

透過套件管理器、pipx 或官方執行檔在 Linux 安裝 yt-dlp 與 ffmpeg。

這篇文章還沒翻譯,所以以英文顯示。介面部分仍是你的語言。

1. Install yt-dlp

Distribution packages are convenient but often lag by months, and yt-dlp is a tool where being three months behind means extractors that no longer work. pipx or the official binary keep you current.

pipx install yt-dlp

Or the standalone binary, which bundles everything and self-updates:

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

2. Install ffmpeg

sudo apt install ffmpeg      # Debian, Ubuntu
sudo dnf install ffmpeg      # Fedora
sudo pacman -S ffmpeg        # Arch

On Fedora, ffmpeg lives in RPM Fusion; enable that repository first if the package is not found.

3. Check it worked

yt-dlp --version
ffmpeg -version

Cookies on a headless machine

--cookies-from-browser needs a browser profile on the same machine, so on a server it is not an option. Export a Netscape-format cookies.txt on your desktop, copy it across and point at it with --cookies. Treat that file as a credential — it is a live session.

Updating

yt-dlp -U               # standalone binary
pipx upgrade yt-dlp     # pipx

Installed from your distribution's repository, update it with the package manager; -U will refuse to touch a file it does not own.

常見問題

我該用發行版內建的 yt-dlp 套件嗎?
可以用,但發行版的套件常常落後好幾個月,而過舊的 yt-dlp 意味著有些 extractor 已經失效。pipx 或官方執行檔能讓你保持在新版本。
我的軟體庫裡沒有 ffmpeg。
在 Fedora 上它在 RPM Fusion 裡,需要先啟用那個軟體庫。其他大多數發行版的主要軟體庫裡就有。
怎麼更新 yt-dlp?
獨立的執行檔用 yt-dlp -U 自我更新。如果是透過套件管理器安裝的,就用那個管理器更新;自我更新會拒絕動不屬於它的檔案。更新能解決的問題比任何 flag 都多。