18 lines
504 B
Python
18 lines
504 B
Python
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
|