Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
when youtube-dl sends too many dns request to find video quality, dns server blocks the host running youtube-dl temporarily #13734
Comments
|
Which URL are you trying to download? Please paste a verbose log. |
|
its not the URL i'm trying to download that is blocking me, it is my DNS server that blocks me when there are too many DNS requests happening when youtube-dl is running and trying to guess a quality for the video its downloading. |
|
Fix your DNS server obviously. youtube-dl is not any different from any other software in making DNS requests. |
|
is it possible to make youtube-dl retain the answers for the DNS queries it makes for a short period of time 4 to 10 seconds? |
That's a system-level work, where upper applications like youtube-dl or even Python can't do much. By the way, you may want to check out my proof-of-concept patch yan12125/youtube-dl@0cdc798 that adds an option |
|
a better solution would be to add support for HTTP persistent connection(HTTP keep-alive), it would help to improve performance in general and mostly for http/https fragment downloading. |
|
Persistent HTTP sounds better, but seems it's not going to be implemented in CPython in near future (http://bugs.python.org/issue9740) |
|
|
That's a great suggestion. However, the culture in youtube-dl is reducing external dependencies unless there's a BIG problem. I vote for changing it if there's going to be a discussion. |
it doesn't have to be a hard dependency, it can be used as an optional dependecy by creating a wrapper that will use urllib3 if it's available and fallback to urllib/urllib2(like what's been done with pycrypto). |
|
I'm afraid that co-existing of two backends would make codes extremely complicated and unreadable. If it turns out that switching between urllib/urllib2 and urllib3 is easy (ex: without numerous function wrappers), that would be a good choice. |
|
there is actually an old approche compatible with urllib/urllib2 by using a diffrent handler, but as the code is old, so it might require to be updated, it was used by urlgrabber before switching to pycurl(https://stackoverflow.com/questions/1037406/python-urllib2-with-keep-alive). |
|
IMO it's better to use mature libraries like requests/urllib3 instead of importing rarely tested codes from random places. Also, using only urllib3 is better than supporting two backends. I hope the culture here can change one day. About the license issue:
|
The issue at hand is that when youtube-dl is trying more than one quality paramter on its own, it keeps making DNS-requests, because those requests became too many in a short span of time, the host running youtube-dl gets any DNS requests from it blocked.
please look into it.
Please follow the guide below
xinto all the boxes [ ] relevant to your issue (like that [x])Make sure you are using the latest version: run
youtube-dl --versionand ensure your version is 2017.07.23. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.Before submitting an issue make sure you have:
What is the purpose of your issue?
The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue
If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:
Add
-vflag to your command line you run youtube-dl with, copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):If the purpose of this issue is a site support request please provide all kinds of example URLs support for which should be included (replace following example URLs by yours):
Note that youtube-dl does not support sites dedicated to copyright infringement. In order for site support request to be accepted all provided example URLs should not violate any copyrights.
Description of your issue, suggested solution and other information
Explanation of your issue in arbitrary form goes here. Please make sure the description is worded well enough to be understood. Provide as much context and examples as possible.
If work on your issue requires account credentials please provide them or explain how one can obtain them.