yt-dlp的下載與使用
一、yt-dlp is a fork of youtube-dl
二、查看視頻信息(前提保證Windows上有Clash for Windows且Clash for Windows打開了TUN模式)
- 需要關(guān)閉firefox,firefox可以替換為chrome或者edge,確保在瀏覽器上登陸過youtube
- 顯示https://www.youtube.com/watch?v=NLC1u1EgyWc這個視頻所有的分辨率
yt-dlp --cookies-from-browser firefox -F https://www.youtube.com/watch?v=NLC1u1EgyWc
三、下載命令(-f bestvideo+bestaudio或者-f 625+251可以省略,yt-dlp會自動選擇最佳分辨率的音視頻)
yt-dlp --cookies-from-browser firefox -f 625+251 https://www.youtube.com/watch?v=NLC1u1EgyWc
或者
yt-dlp --cookies-from-browser firefox -f bestvideo+bestaudio https://www.youtube.com/watch?v=NLC1u1EgyWc
四、下載一個YouTube播放列表(確認播放列表是public的)
yt-dlp --cookies-from-browser firefox -f bestvideo+bestaudio --yes-playlist --embed-chapters https://www.youtube.com/playlist?list=PLZ45ewpxeckaowEaKJIasZwSQ8LS9X1d6
五、環(huán)境
- Powershell
- 使用Scoop下載的yt-dlp
六、在Windows上編輯yt-dlp的配置文件
- 首先在%APPDATA%/yt-dlp/目錄下創(chuàng)建一個名稱為config的文件(若yt-dlp目錄不存在,則需要自己創(chuàng)建)
- 在config中添加想要的選項和對應(yīng)的值,如:
--cookies-from-browser firefox
# set the directory of output videos and playlists
-P "C:/Users/Edward/Downloads/YT-DLP"
# set the output format for youtube playlist
# --output-na-placeholder "unknown"
# -o "%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s"
# set the output format for youtube single video
-o "%(title)s.%(ext)s"

浙公網(wǎng)安備 33010602011771號