Add ytdl PoF

This commit is contained in:
Maks Snegov 2024-02-02 10:11:50 -08:00
parent b2aa7c7615
commit 185f051ae3

17
ytdl_pof.py Normal file
View File

@ -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