Updated to ptb 21.0.1 and added socks5 proxy support

This commit is contained in:
Joan
2024-03-24 19:08:37 +01:00
parent 583cca776f
commit 23e5cfd878
6 changed files with 33 additions and 14 deletions

View File

@@ -8,6 +8,14 @@ HEADERS = ({'User-Agent':
'Accept-Language': 'en-US, en;q=0.5'})
DB = '/app/data/amazon.db'
telegram_proxy = os.environ.get("TELEGRAM_PROXY") == '1'
if telegram_proxy:
telegram_socks_user = os.environ.get("TELEGRAM_SOCKS_USER")
telegram_socks_password = os.environ.get("TELEGRAM_SOCKS_PASSWORD")
telegram_socks_server = os.environ.get("TELEGRAM_SOCKS_SERVER")
telegram_socks_port = os.environ.get("TELEGRAM_SOCKS_PORT")
proxy_url = f"socks5://{telegram_socks_user}:{telegram_socks_password}@{telegram_socks_server}:{telegram_socks_port}"
if baseURL.startswith("https://www."):
searchURL = baseURL[12:]
elif baseURL.startswith("http://www."):