Add proxy configuration support to downloader and GUI

Introduces proxy and geo-verification proxy options to the downloader and GUI dialogs, allowing users to specify network proxies for downloads and geo-restricted content. Updates the DownloadThread and main app logic to pass and apply these proxy settings, and adds validation and status indicators in the custom options dialog.
This commit is contained in:
Your Name
2025-09-22 14:49:58 +03:00
parent e9de913b47
commit d6fb926644
3 changed files with 240 additions and 0 deletions
+18
View File
@@ -59,6 +59,8 @@ class DownloadThread(QThread):
rate_limit=None,
download_section=None,
force_keyframes=False,
proxy_url=None,
geo_proxy_url=None,
) -> None:
super().__init__()
self.url = url
@@ -78,6 +80,8 @@ class DownloadThread(QThread):
self.rate_limit = rate_limit
self.download_section = download_section
self.force_keyframes = force_keyframes
self.proxy_url = proxy_url
self.geo_proxy_url = geo_proxy_url
self.paused = False
self.cancelled = False
self.process = None
@@ -156,6 +160,13 @@ class DownloadThread(QThread):
self.browser_cookies.split(":")[1] if ":" in self.browser_cookies else None,
)
# Add proxy settings if specified
if self.proxy_url:
ydl_opts_check["proxy"] = self.proxy_url
if self.geo_proxy_url:
ydl_opts_check["geo_verification_proxy"] = self.geo_proxy_url
if YT_DLP_AVAILABLE:
with yt_dlp.YoutubeDL(ydl_opts_check) as ydl:
info = ydl.extract_info(self.url, download=False)
@@ -324,6 +335,13 @@ class DownloadThread(QThread):
elif self.browser_cookies:
cmd.extend(["--cookies-from-browser", self.browser_cookies])
# Add proxy settings if specified
if self.proxy_url:
cmd.extend(["--proxy", self.proxy_url])
if self.geo_proxy_url:
cmd.extend(["--geo-verification-proxy", self.geo_proxy_url])
# Add rate limit if specified
if self.rate_limit:
cmd.extend(["-r", self.rate_limit])