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

Print JSON and show progress #26596

Closed
abvbv opened this issue Sep 15, 2020 · 4 comments
Closed

Print JSON and show progress #26596

abvbv opened this issue Sep 15, 2020 · 4 comments
Labels

Comments

@abvbv
Copy link

@abvbv abvbv commented Sep 15, 2020

Checklist

  • I'm reporting a feature request
  • I've verified that I'm running youtube-dl version 2020.09.14
  • I've searched the bugtracker for similar feature requests including closed ones

Description

I would like to download a video and get the JSON with full info about it and see the progress within one youtube-dl session.

There're these lines in __init__.py that prevent printing of progress:

any_printing = opts.print_json
...
    'quiet': (opts.quiet or any_getting or any_printing),

Probably a new option would help. There's --no-progress option, so maybe an enforcing option might help, something like youtube-dl --print-json --progess $url .

@abvbv abvbv added the request label Sep 15, 2020
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Sep 15, 2020

This will introduce ambiguity since both JSON and progress are written to stdout and it would be impossible to safely classify whether new line is JSON or progress data.
What you can do is to use --console-title to show progress in title bar.

@dstftw dstftw closed this Sep 15, 2020
@abvbv
Copy link
Author

@abvbv abvbv commented Sep 15, 2020

What you can do is to use --console-title to show progress in title bar.

Do you think there are any other approaches? I need this to automate some workflow, so there are no title bars in my case.

What if we add a [json] prefix before JSON output, similar to [download] and others?

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Sep 15, 2020

You can just embed it in python code and receive progress via a hook.
No prefixes can be added since this will break existing clients.

@abvbv
Copy link
Author

@abvbv abvbv commented Sep 15, 2020

Thanks for your quick replies!

I'm using youtube-dl from a different programming language, and it will make things a bit harder I think. But anyway, thanks for the suggestion. I'll add a new comment if I come up with a good solution. Until then I'll just call youtube-dl twice: 1) to get a JSON and 2) to download a video.

@ytdl-org ytdl-org deleted a comment from 0xpr03 Oct 22, 2020
@ytdl-org ytdl-org locked and limited conversation to collaborators Oct 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.