diff --git a/ytdl_pof.py b/ytdl_pof.py new file mode 100644 index 0000000..9f78f1a --- /dev/null +++ b/ytdl_pof.py @@ -0,0 +1,17 @@ +from yt_dlp import YoutubeDL + +def longer_than_a_minute(info, *, incomplete): + """Download only videos longer than a minute (or with unknown duration)""" + duration = info.get('duration') + if duration and duration < 60: + return 'The video is too short' + + +def main(): + ydl_opts = { + 'match_filter': longer_than_a_minute, + } + yt_list = "https://www.youtube.com/playlist?list=XXXXXXXXXXXXXXXXXXX" + with YoutubeDL(ydl_opts) as ydl: + ydl.download(yt_list) + return 0