]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/networking/_urllib.py
[rh:curlcffi] Add support for `curl_cffi`
[yt-dlp.git] / yt_dlp / networking / _urllib.py
index 68bab2b087ae81eb37fab91c36422e3111d610e9..ff110dc29be9dfdd0c2a1b7157763f1deefb1a30 100644 (file)
@@ -167,7 +167,7 @@ def http_response(self, req, resp):
         if 300 <= resp.code < 400:
             location = resp.headers.get('Location')
             if location:
-                # As of RFC 2616 default charset is iso-8859-1 that is respected by python 3
+                # As of RFC 2616 default charset is iso-8859-1 that is respected by Python 3
                 location = location.encode('iso-8859-1').decode()
                 location_escaped = normalize_url(location)
                 if location != location_escaped:
@@ -389,11 +389,11 @@ def _send(self, request):
         )
 
         opener = self._get_instance(
-            proxies=request.proxies or self.proxies,
-            cookiejar=request.extensions.get('cookiejar') or self.cookiejar
+            proxies=self._get_proxies(request),
+            cookiejar=self._get_cookiejar(request)
         )
         try:
-            res = opener.open(urllib_req, timeout=float(request.extensions.get('timeout') or self.timeout))
+            res = opener.open(urllib_req, timeout=self._calculate_timeout(request))
         except urllib.error.HTTPError as e:
             if isinstance(e.fp, (http.client.HTTPResponse, urllib.response.addinfourl)):
                 # Prevent file object from being closed when urllib.error.HTTPError is destroyed.