projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e8c5d40
)
[downloader/http] Retry download when urlopen times out (#26603) (refs #10935)
author
Ori Avtalion
<ori@avtalion.name>
Thu, 17 Sep 2020 20:15:44 +0000
(23:15 +0300)
committer
GitHub
<noreply@github.com>
Thu, 17 Sep 2020 20:15:44 +0000
(
03:15
+0700)
youtube_dl/downloader/http.py
patch
|
blob
|
history
diff --git
a/youtube_dl/downloader/http.py
b/youtube_dl/downloader/http.py
index 5046878dfcd874013e737e85d32764a95737406e..e14ddce58d54db143770aba5147d7da2e6ef4733 100644
(file)
--- a/
youtube_dl/downloader/http.py
+++ b/
youtube_dl/downloader/http.py
@@
-106,7
+106,12
@@
class HttpFD(FileDownloader):
set_range(request, range_start, range_end)
# Establish connection
try:
set_range(request, range_start, range_end)
# Establish connection
try:
- ctx.data = self.ydl.urlopen(request)
+ try:
+ ctx.data = self.ydl.urlopen(request)
+ except (compat_urllib_error.URLError, ) as err:
+ if isinstance(err.reason, socket.timeout):
+ raise RetryDownload(err)
+ raise err
# When trying to resume, Content-Range HTTP header of response has to be checked
# to match the value of requested Range HTTP header. This is due to a webservers
# that don't support resuming and serve a whole file with no Content-Range
# When trying to resume, Content-Range HTTP header of response has to be checked
# to match the value of requested Range HTTP header. This is due to a webservers
# that don't support resuming and serve a whole file with no Content-Range