如何在CMD中隐藏yt-dl的输出? python

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

我正在编写从 youtube 视频下载 mp3 音频的程序,但我遇到一个问题,即 yt-dl 在控制台中显示一些输出

我的代码:

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])

输出照片:

我需要隐藏输出的选项或某种方式。

尝试将 "quiet": true, 添加到您的 ydl_opts

如果这不起作用,也许添加

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