1from pytube import YouTube
2import os
3from pathlib import Path
4
5link = input("Enter link here: ")
6
7url = YouTube(link)
8
9print("downloading....")
10
11video = url.streams.get_highest_resolution()
12
13path_to_download_folder = str(os.path.join(Path.home(), "Downloads"))
14
15video.download(path_to_download_folder)
16print("Downloaded! :)")
1 from pytube import Playlist
2 pl = Playlist("https://www.youtube.com/watch?v=Edpy1szoG80&list=PL153hDY-y1E00uQtCVCVC8xJ25TYX8yPU")
3 for video in pl.videos:
4 video.streams.first().download()
5
1 from pytube import Playlist
2 ps = Playlist("https://www.youtube.com/watch?v=R6wQmWMDiB4&list=PLYmlEoSHldN4nV-Js4x7domjygiBkeatC")
3 for video in ps.videos:
4 video.streams.first().download()