0
0
Fork 0

[http] Use the `YoutubeDL.urlopen` method

main
Jaime Marquínez Ferrándiz 2014-03-07 16:41:42 +01:00
parent 136db7881b
commit 22ff5d2105
1 changed files with 2 additions and 2 deletions

View File

@ -49,7 +49,7 @@ class HttpFD(FileDownloader):
while count <= retries: while count <= retries:
# Establish connection # Establish connection
try: try:
data = compat_urllib_request.urlopen(request) data = self.ydl.urlopen(request)
break break
except (compat_urllib_error.HTTPError, ) as err: except (compat_urllib_error.HTTPError, ) as err:
if (err.code < 500 or err.code >= 600) and err.code != 416: if (err.code < 500 or err.code >= 600) and err.code != 416:
@ -59,7 +59,7 @@ class HttpFD(FileDownloader):
# Unable to resume (requested range not satisfiable) # Unable to resume (requested range not satisfiable)
try: try:
# Open the connection again without the range header # Open the connection again without the range header
data = compat_urllib_request.urlopen(basic_request) data = self.ydl.urlopen(basic_request)
content_length = data.info()['Content-Length'] content_length = data.info()['Content-Length']
except (compat_urllib_error.HTTPError, ) as err: except (compat_urllib_error.HTTPError, ) as err:
if err.code < 500 or err.code >= 600: if err.code < 500 or err.code >= 600: