-
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
Cannot download long videos from Youtube because of DNS flood #15914
Comments
Also I have found an issue #4966 where there might be the same problem, with ffmpeg sending too many requests. |
I have tried to use |
Encountering a similar issue with TBS/Adult Swim, even with a cache on my router. Seems my router dislikes getting flooded. |
Workaround: add temporary hosts file entries for queried domains. |
Make sure you are using the latest version: run
youtube-dl --version
and ensure your version is 2018.03.14. 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:
Didn't check because this is irrelevant to the issue.
What is the purpose of 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 the
-v
flag to your command line you run youtube-dl with (youtube-dl -v <your command line>
), copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):Description of your issue, suggested solution and other information
Some videos are stored as collection of small segments at Youtube. When downloading a large video from Youtube that contains many segments, Youtube-dl sends new DNS request for every segment even if the host name is the same. Example video URL: https://www.youtube.com/watch?v=QL0nLqDdKdI . At the moment of writing this video contains 2880 segments, all located on the same host. On fast Internet channel youtube-dl is downloading 4 segments per second, making 4 DNS requests per second with the same host name. I am using DNS server 8.8.8.8 thats stops responding after sending approximately 1000 requests with the same name in short interval of time. After trying several more times, youtube-dl exits with error:
Please note that the error message is confusing, because it doesn't say anything about the real problem.
The DNS response TTL field value for
r4---sn-1uxaxjvh-axql.googlevideo.com
equals 12 minutes and 3 seconds.I have searched issues for "dns cache", "long videos", "getaddrinfo failed".
In an issue #13734 @dstftw wrote that this is an issue with a DNS server. I cannot agree with that. Sending thousands of similar queries looks more like flood or DoS attack, no wonder that DNS server stops responding. I think this is an issue with youtube-dl. I looked for an options to make pauses between downloading segments, but couldn't find any. I have also searched for "dns cache" in README but didn't find anything.
Please note that the issue is with sending too much DNS request. Using or not using persistent HTTP connections have no relation to it. So the issue #14523 is irrelevant.
I found a similar issue with downloading long video #15641 . DNS fllod might the the problem of errors there. Also, an issue #15746 - looks like the same problem.
Using
--hls-prefer-native
or--hls-prefer-ffmpeg
doesn't make any difference. ffmpeg does the same thing.My suggestion is to implement a simple DNS cache that caches the IP address of a host or DNS response for the lifetime of a process. It is highly unlikely that IP address would change during download so there is no need to handle expire time. It is much easier than make user configure local DNS cache and somehow point youtube-dl to it.
To repoduce:
./youtube-dl -v --hls-prefer-native --format 300 --ffmpeg-location <location> -o v1.avi --no-mtime 'https://www.youtube.com/watch?v=QL0nLqDdKdI'
The text was updated successfully, but these errors were encountered: