From 185f051ae3498d09e9e85d50a36d0e92a2d37adb Mon Sep 17 00:00:00 2001 From: Maks Snegov Date: Fri, 2 Feb 2024 10:11:50 -0800 Subject: [PATCH] Add ytdl PoF --- ytdl_pof.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 ytdl_pof.py 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