Skip to content
Advertisement

Using Pytube to download videos of a playlist of specific length

I am trying to download the videos of a YouTube playlist using the PyTube – library. Since the playlists I need have a few thousand videos I want to add the condition that just videos of the length 10s to 1 hour should be downloaded. So far I can download all videos of a playlist with the following code:

JavaScript

Can someone help?

Advertisement

Answer

You can get the length of a video from pytube.YouTube.length

https://pytube.io/en/latest/api.html#pytube.YouTube.length

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