0

I'm trying to download videos from youtube that are less than 10 minutes long. In order to exclude live streams I also passed the "!is_live" parameter but script completely ignores it.

the script is as follows:

ydl_opts = {
        'format': 'mp4',
        'quiet': True,
        'postprocessors': [{'key': 'FFmpegFixupM3u8'}],
        'noplaylist':'True',
        'match_filter': youtube_dl.utils.match_filter_func("!is_live"),
        'match_filter': youtube_dl.utils.match_filter_func("!live"),
        'match_filter': youtube_dl.utils.match_filter_func("filesize"),
        'match_filter': youtube_dl.utils.match_filter_func("duration < 600"),
        'outtmpl': "video"+ "/" + "adidas" + "/%(title)s.%(ext)s"
    }
with YoutubeDL(ydl_opts) as ydl:
    video = ydl.extract_info(f"ytsearch5}:adidas", download=True)['entries'][0]

But each time I run the code it starts to download livestream, currently this one

THe !live and filesize are options found on reddit thread as a possible workaround but IRL that doesnt help at all.

Youtubedl version: 2021.6.6 Python version: 3.9.4

ison
  • 11
  • 4
  • 2
    Does this answer your question? [Make a dictionary with duplicate keys in Python](https://stackoverflow.com/questions/10664856/make-a-dictionary-with-duplicate-keys-in-python) – user3840170 Aug 17 '21 at 13:34
  • 1
    Your multiple `'match_filter'`s are overriding each other. You'll need to figure out how to combine the filter specifications you have into one `'match_filter'`. – AKX Aug 17 '21 at 13:35
  • @AKX aha, didnt know that. Thanks! – ison Aug 17 '21 at 13:36
  • @user3840170 now your question re answer makes sense :) thanks for help! – ison Aug 17 '21 at 13:37

0 Answers0