-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Bandwidth throttling mitigation #11476
Conversation
Some verbose logs of downloads. Youtube.com (no throttle):
Vk.com:
pornhub.com:
|
Breaks downloading completely:
|
Right, all that time thinking about how to deal with slow internet and got rekt by a too fast one. |
|
Sorry, really inconvenient for me to test on various python versions right now. (Though, for changes in such a core file I probably should have). |
Hey @Serkora any chance you could get this working? I'm trying to download over 125 tracks from Mixcloud and it would be REALLY useful... |
@rodcul |
Any update on this issue? |
Hi @dstftw , |
I'm eager to see this working, especially now that YouTube is throttling download speed. It's really important. |
@zannix commented on 2018. jan. 18. 09:59 CET:
I noticed downloads being really slow 1-2 days ago. But coincidentally I upgraded yt-dl not much before it. |
Yes, see the references a few posts above. This functionality would really be priceless right now. |
@yan12125 bit weird that you refer people to here for a "possible solution" while the creator of the PR had asked a collaborator for feedback but got ignored |
Note to commenters: all comments that don't add anything useful to the discussion will be removed, if you have nothing valuable to add then just don't post. |
This looks like a recursive approach. I'm not sure if it will cause stack overflow on very long videos. This pull request needs rebase anyway. |
Before submitting a pull request make sure you have:
In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:
What is the purpose of your pull request?
Description of your pull request and other information
#6923
Pretty much self explanatory.
Some websites only let you download a little bit at maximum speed and then slow it down to some value (may be media bitrate, may be just an arbitrary limit they decided upon)
If this website also supports Range header, a new request can be made to get full speed again. Repeat until ready.
In a nutshell, that's all this code does: monitors the overall (to get the peak) and separate block transfer rates and makes a new request when the block rate falls below a certain threshold.
And a new option is added, of course.
A few unnecessary reconnections here and there, but mostly stable chunks are downloaded before each new request is made, so I'm rather pleased with it.
Important notes:
Boring explanations of the strategies, can be easily seen in code but just so that it is documented:
First of all, no way to tell if throttling started or your network became bad (or downloading lots of porn in parallel, for instance), so if you start a second network-intesive task, well, things will break.
The main thing with throttling is the block size. Too small — slow overall download and/or unreliable instantaneous rate measurements. Too large — you'll become old before throttling is detected. 512KiB seemed like a reasonable enough compromise to set as a starting point.
data
variable.Voila, grab some pizza and enjoy the thing you've just downloaded!