-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Add download speed to the last line of the youtube-dl output #31122
Comments
You could do the division yourself? Or --- old/youtube_dl/downloader/common.py
+++ new/youtube_dl/downloader/common.py
@@ -257,6 +257,13 @@ class FileDownloader(object):
if s.get('elapsed') is not None:
s['_elapsed_str'] = self.format_seconds(s['elapsed'])
msg_template += ' in %(_elapsed_str)s'
+ if s.get('speed') is None:
+ if s.get('total_bytes') is not None and s.get('elapsed'):
+ s['speed'] = self.calc_speed(0, s['elapsed'], s['total_bytes'])
+ if s.get('speed') is not None:
+ s['_speed_str'] = self.format_speed(s['speed'])
+ msg_template += ' at %(_speed_str)s'
+
self._report_progress_status(
msg_template % s, is_last_line=True) |
You mean manually? I could but it's a useful bit of information for me so I'd prefer to have it done in the script itself. Lots of other programs show download speed when downloading stuff so youtube-dl might as well. Does your code snippet mean that the issue has been fixed and the fix will be available in the next release or do you just show how it could be done in theory? Thanks |
The code works for me. As it's a small change I don't mind merging it unless other users come along with a big thumbs-down. yt-dl shows the rate while downloading but not in the final summary: so I've just adapted the code from the former case to the latter. Meanwhile you might like to test it, if you have Python (say, Python 3.7 or later, unless there's a reason to have an older version) installed. If you also have git installed, you could clone a local copy of this repo, make the new Otherwise, you could follow the instructions here (also) to get a yt-dl version with quite a few fixes (including downloads from YT), in a form that would make it easy to test the patch. To modify this installed version: run |
I hope there are no objections. It's a small change, useful for some but those who don't need it can easily ignore it. Thanks for your help. |
Checklist
Description
Please calculate and add the download speed to the last line of the youtube-dl output. Currently it shows something like the following:
[download] 100% of x.xxMiB in yy:yy
I'd like it to be replaced with something like:
[download] 100% of x.xxMiB in yy:yy at zzzKiB/s
Thanks
This is the version I currently get and use:
$ wget https://yt-dl.org/downloads/latest/youtube-dl
...
$ ./youtube-dl --version
2021.12.17
The text was updated successfully, but these errors were encountered: