pip install youtube-dl
python
import youtube_dl
ydl = youtube_dl.YoutubeDL()
ydl.download([video_url])
python
import youtube_dl
ydl_opts = {
'format': 'bestvideo+bestaudio',
'outtmpl': '~/Downloads/%(title)s.%(ext)s',
'postprocessors': [{
'key': 'FFmpegVideoConvertor',
'preferedformat': 'mp4',
}],
}
ydl = youtube_dl.YoutubeDL(ydl_opts)
ydl.download([video_url])