Youtube下载工具:yt-dlp

Youtube download tool:yt-dlp

Tool
R
Python
Author

Tony D

Published

March 11, 2025

A guide to using yt-dlp, a command-line tool for downloading audio and video from YouTube and other sites.

yt-dlp is a feature-rich command-line audio/video downloader with support for thousands of sites. The project is a fork of youtube-dl based on the now inactive youtube-dlc. This guide will walk you through the installation, update, and basic usage of yt-dlp for downloading YouTube videos.

https://github.com/yt-dlp/yt-dlp

Download yt-dlp

pip install -U "yt-dlp[default]"

update yt-dlp

pip install yt-dlp --upgrade

check version

yt-dlp --version

Start download youtube

download video with chrome cookies

yt-dlp --cookies-from-browser chrome 'https://www.youtube.com/watch?v=yBl8UdSav5Y'

download video with firefox cookies

You may also use a conforming browser extension for exporting cookies, such as Get cookies.txt LOCALLY for Chrome

yt-dlp --cookies-from-browser firefox 'https://www.youtube.com/watch?v=yBl8UdSav5Y'

download video with export cookies

You may also use a conforming browser extension for exporting cookies, such as Get cookies.txt LOCALLY for Chrome

get video titles

yt-dlp --cookies-from-browser firefox --get-title 'https://www.youtube.com/watch?v=yBl8UdSav5Y'

download video to mp3 format

yt-dlp --cookies-from-browser chrome -x --audio-format mp3 --audio-quality 0 'https://www.youtube.com/watch?v=FkOpwodhROI'

download video with timestamp

yt-dlp --cookies-from-browser chrome --download-sections '*00:02-03:00' 'https://www.youtube.com/watch?v=FkOpwodhROI'

download video to mp4 with timestamp

yt-dlp -f mp4 --cookies-from-browser chrome  --download-sections '*00:02-03:00'  'https://www.youtube.com/watch?v=FkOpwodhROI'

=