Config: use None if no proxy specified

This commit is contained in:
DarkCat09 2024-05-28 09:09:59 +04:00
parent 21dbc8659d
commit 1e1fe6dd16
Signed by: DarkCat09
GPG key ID: 0A26CD5B3345D6E3
2 changed files with 4 additions and 2 deletions

View file

@ -21,7 +21,7 @@ class Config:
)
# Proxy URL for yt_proxied downloader (can be used for geo-restricted content)
self.yt_proxy = os.getenv('YT_PROXY') or 'http://127.0.0.1:1080'
self.yt_proxy = os.getenv('YT_PROXY') or None
self.save_lyrics = _parse_bool(os.getenv('SAVE_LYRICS'), True)
self.save_cover = _parse_bool(os.getenv('SAVE_COVER'), True)

View file

@ -22,7 +22,9 @@ class _CreateYDL:
@staticmethod
def yt_proxied() -> YoutubeDL:
ydl = _CreateYDL.youtube()
ydl.params['proxy'] = config.get().yt_proxy
proxy = config.get().yt_proxy
if proxy is not None:
ydl.params['proxy'] = proxy
return ydl
@staticmethod