Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not print error on the console - Youtube dl embedded #13640

Closed
Coco1905 opened this issue Jul 13, 2017 · 1 comment
Closed

Not print error on the console - Youtube dl embedded #13640

Coco1905 opened this issue Jul 13, 2017 · 1 comment
Labels

Comments

@Coco1905
Copy link

@Coco1905 Coco1905 commented Jul 13, 2017

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like that [x])
  • Use Preview tab to see how your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2017.07.09. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.

  • [x ] I've verified and I assure that I'm running youtube-dl 2017.07.09

Before submitting an issue make sure you have:

  • [x ] At least skimmed through README and most notably FAQ and BUGS sections
  • [x ] Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • [x ] Question
  • Other

Hello,

I am using Youtube-dl Embedded in a Python program.

I am trying to avoid to have the errors printed on the console but it doesn't work. Here is what I do, with the option 'quiet':

ydl_opts = {
'format': format,
'quiet': True,
'postprocessors' : [{
'key': 'FFmpegExtractAudio',
'preferredcodec': extension
}]
}

And then (the ID is one parameter of my function) :

with youtube_dl.YoutubeDL(ydl_opts ) as ydl:
info=ydl.extract_info('http://www.youtube.com/watch?v='+ID, download=False)
url=info.get('url', None)

But, when I do that, I still have this kind of error written on the console:
"ERROR: AEyKx1XvCKo: YouTube said: "Beautiful Chinese Music?2?T..."
The YouTube account associated with this video has been terminated due to multip
le third-party notifications of copyright infringement." or "ERROR: AERXBUOVaK0: YouTube said: This video is no longer available because the YouTube account associated with this video has been terminated."

So, I tried another way, with subprocess:
link='http://www.youtube.com/watch?v='+ID
x=subprocess.Popen(['youtube_dl' ,'-g', link], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
url=x.stdout.read().decode()

But it doesn't work as well, I have the error "[WinError 2] The system cannot find the file specified".

I think that the best solution is the first, if it works, because youtube-dl Embedded has been created to avoid the subprocess I think!

Can you please explain me why the 'quiet' doesn't work? Or, if it is impossible to not print the errors with this option, why my subprocess doesn't work?

Thank you in advance!

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jul 13, 2017

Provide custom logger.

@dstftw dstftw closed this Jul 13, 2017
@dstftw dstftw added the question label Jul 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.