0

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?

2 Answers2

2

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()
Hossein Heydari
  • 1,439
  • 9
  • 28
-1

Please check this link -> Using Pytube to download playlist from YouTube.

from pytube import Playlist

playlist = Playlist(Playlist link goes here)
playlist.download_all()

or

from pytube import Playlist

playlist = Playlist(Playlist link goes here)
for video in playlist.videos:
    video.streams.first().download()
mzebin
  • 39
  • 1
  • 8