]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[http] Use the `YoutubeDL.urlopen` method
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Fri, 7 Mar 2014 15:41:42 +0000 (16:41 +0100)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Fri, 7 Mar 2014 15:41:42 +0000 (16:41 +0100)
youtube_dl/downloader/http.py

index 240ecb606e5ee4b76599f2e380b6ea30d767c5da..348097dab0886954655b85917def8743975d963a 100644 (file)
@@ -49,7 +49,7 @@ class HttpFD(FileDownloader):
         while count <= retries:
             # Establish connection
             try:
-                data = compat_urllib_request.urlopen(request)
+                data = self.ydl.urlopen(request)
                 break
             except (compat_urllib_error.HTTPError, ) as err:
                 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)
                     try:
                         # 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']
                     except (compat_urllib_error.HTTPError, ) as err:
                         if err.code < 500 or err.code >= 600: