From 8a23db95197282159efe970ca0ac69c97def60d3 Mon Sep 17 00:00:00 2001
From: coletdev <coletdjnz@protonmail.com>
Date: Wed, 23 Mar 2022 10:24:27 +1300
Subject: [PATCH] [wget] Fix proxy (#3152)

Upstream PR: https://github.com/ytdl-org/youtube-dl/pull/29343
Authored-by: kikuyan, coletdjnz
---
 yt_dlp/downloader/external.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/yt_dlp/downloader/external.py b/yt_dlp/downloader/external.py
index be6202eef..cfa646ebc 100644
--- a/yt_dlp/downloader/external.py
+++ b/yt_dlp/downloader/external.py
@@ -230,7 +230,10 @@ def _make_cmd(self, tmpfilename, info_dict):
                 retry[1] = '0'
             cmd += retry
         cmd += self._option('--bind-address', 'source_address')
-        cmd += self._option('--proxy', 'proxy')
+        proxy = self.params.get('proxy')
+        if proxy:
+            for var in ('http_proxy', 'https_proxy'):
+                cmd += ['--execute', '%s=%s' % (var, proxy)]
         cmd += self._valueless_option('--no-check-certificate', 'nocheckcertificate')
         cmd += self._configuration_args()
         cmd += ['--', info_dict['url']]