Saturday, August 13, 2022

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

Issue

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


Answered By - Ron Serruya
Answer Checked By - Timothy Miller (PHPFixing Admin)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.