Skip to content
Advertisement

Using Pytube to download playlist from YouTube

I am looking to download a YouTube playlist using the PyTube library. Currently, I am able to download a single video at a time. I cannot download more than one video at once.

Currently, my implimentation is

JavaScript

This results in the following output

JavaScript

And the YouTube file is downloaded. When I try this with a playlist link (An example) only the first video is downloaded. There is no error outputted.

I would like to be able to download an entire playlist without re-prompting the user.

Advertisement

Answer

You can import Playlist to achieve this. There is no reference to Playlist in the redoc, though there is a section in the GitHub repo found here. The source of the script is in the repo here.

JavaScript

NOTE: I’ve found the supporting method Playlist.video_urls does not work. The videos are still downloaded however, as evidenced here

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement