pip install youtube_dl
# or for faster download and more improvements:
#pip install yt-dlp
并使用:
from youtube_dl import YoutubeDL
# or for yt_dlp:
# from yt_dlp import YoutubeDL
with YoutubeDL() as ydl:
ydl.download(["https://www.youtube.com/watch?v=R4em3LKQCAQ"])
原始答案:
I have created a library that makes it.
To install:
bash $ pip install mhyt
And use it like:
from mhyt import yt_download
yt_download("https://www.youtube.com/watch?v=R4em3LKQCAQ","download.mp4")