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

youtube_dl Python class variables #23775

Closed
ntqr opened this issue Jan 18, 2020 · 1 comment
Closed

youtube_dl Python class variables #23775

ntqr opened this issue Jan 18, 2020 · 1 comment
Labels

Comments

@ntqr
Copy link

@ntqr ntqr commented Jan 18, 2020

Checklist

  • I'm asking a question
  • I've looked through the README and FAQ for similar questions
  • I've searched the bugtracker for similar questions including closed ones

Question

class ytdl_count(object):
    def debug(self, msg):
        count += 1

ydl_opts = {
    'logger': ytdl_count(),
}
    
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download([url])

I'm trying to count the number of lines of error youtube_dl is outputting in a Python script. But because of the limitations of local variables and the way the logging method is hardcoded, no information can escape or enter the logger class.

Is there anyway I can work around this?

@ntqr ntqr added the question label Jan 18, 2020
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jan 18, 2020

Obviously by not using local variables.

@dstftw dstftw closed this Jan 18, 2020
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.