pythonffmpegconsoleoutputytdl

How to hide the output of yt-dl in CMD? python


I'm coding program that download mp3 audio from youtube videos but I have an issue that yt-dl show some output in console

my code:

with open('Links.txt') as f:
    content = f.readlines()
    for links in content:

        ydl_opts = {
            'format': 'bestaudio/best',
            'postprocessors': [{
                'key': 'FFmpegExtractAudio',
                'preferredcodec': 'mp3',
                'preferredquality': '192',
            }],
        }
        with youtube_dl.YoutubeDL(ydl_opts) as ydl:
            ydl.download([links])

photo of output: enter image description here

and i need the option or some way to hide the output.


Solution

  • Try adding "quiet": true, to your ydl_opts

    If that doesn't work maybe add

    "external_downloader_args": ['-loglevel', 'panic']