#URL of the YouTube playlist playlist_url = "https://www.youtube.com/playlist?list=PL4aKVVlGQ0j6aUsXt4e4t1r9Dmbrfimns" # Create a Playlist object playlist = Playlist(playlist_url)
# Set the resolution to 1080p resolution = "1080p" i=1 # Loop through each video in the playlist and download it for video in playlist.videos: # Filter the streams to get only those with the desired resolution video_streams = video.streams.filter(res=resolution)
if video_streams: print(f'Download : {video.title}') # Choose the first stream (highest quality) video_stream = video_streams[0]
# Download the video print(f"Downloading: {video.title}") # x=(f'{video.title}' + str(i)+'.mp4') #for your own custom name # video_stream.download(output_path=r"G:\Pandas") #video_stream = video.streams.filter(res='1080p', file_extension='mp4').first() video_stream = video.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first() video_stream.download(output_path='G:\Test' , filename = f'{video.title}'+'mp4')
i=i+1 else: print(f"Video {video.title} in {resolution} resolution not found!") # break print("Download completed!")
Comments
Post a Comment