2

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.

2
  • Those lines are printed by yt-dl, not ffmpeg. Commented Nov 25, 2020 at 8:21
  • thx for correction Commented Nov 25, 2020 at 8:23

2 Answers 2

4

Try adding "quiet": True, to your ydl_opts

If that doesn't work maybe add

"external_downloader_args": ['-loglevel', 'panic']
Sign up to request clarification or add additional context in comments.

Comments

0

Want to know exactly what is doing it?

Edit

def report_download_webpage(self, video_id):
    """Report webpage download."""
    self.to_screen('%s: Downloading webpage' % video_id)

in Lib\site-packages\youtube_dl\extractor\Common.py by prepending a # to the self.to_screen

and elide the self.to_screen calls in whatever downloader you are calling with #'s

Alternately you could decorate these calls with the correct logic to honour the quiet command...

This is will elide the outputs

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.