Download simples de vídeos e playlists do YouTube usando a biblioteca PyTube
pipenv install
def download_video(video_url):
yt = YouTube(video_url)
video = yt.streams.get_highest_resolution()
video.download()
def download_playlist(playlist_url):
playlist = Playlist(playlist_url)
for url in playlist:
yt = YouTube(url)
video = yt.streams.get_highest_resolution()
video.download(output_path='playlist')
def download_audio(video_url):
yt = YouTube(video_url)
audio = yt.streams.filter(only_audio=True)[0]
audio.download()