I have been successful at downloading individual videos with a different code but when I try to download an entire playlist from youtube with this other code I get an error.
Here is the code I used:
from pytube import Playlist
playlist = Playlist('https://www.youtube.com/playlist?list=UUd6MoB9NC6uYN2grvUNT-Zg')
print('Number of videos in playlist: %s' % len(playlist.video_urls))
playlist.download_all()
Here is the error that I get:
Traceback (most recent call last):
File "/Users/thelostprogrammer/PycharmProjects/youtube/tests.py", line 5, in <module>
playlist.download_all("/Users/thelostprogrammer/downloads")
AttributeError: 'Playlist' object has no attribute 'download_all'
Number of videos in playlist: 12216
Can someone help me please?
download_all
method is deprecated, do this:
from pytube import Playlist
play_list = Playlist('PAYLIST LINK')
for video in play_list.videos:
video.streams.first().download()