增加了代理

This commit is contained in:
yml2213
2026-06-21 22:30:30 +08:00
parent 1ce867f3a8
commit 828f9889ed
10 changed files with 317 additions and 49 deletions
+22 -6
View File
@@ -41,13 +41,29 @@ def login_single(config: Config, account_index: int = 0) -> str:
# 创建登录器
proxy = config.get_proxy()
proxy_url = None
if proxy.enabled:
proxy_url = {
'http': proxy.http or proxy.https,
'https': proxy.https or proxy.http,
}
proxy_api_url = None
loginer = DouyuLogin(account, proxy=proxy_url)
if proxy.enabled:
if proxy.api_url:
# 使用代理API
proxy_api_url = proxy.api_url
elif proxy.http or proxy.https:
# 使用静态代理
proxy_url = {
'http': proxy.http or proxy.https,
'https': proxy.https or proxy.http,
}
# 获取极验配置
geetest_config = config.get_geetest_config()
max_retries = geetest_config.get('max_retries', 5)
loginer = DouyuLogin(
account,
proxy=proxy_url,
proxy_api_url=proxy_api_url,
max_geetest_retries=max_retries,
)
# 执行登录
result = loginer.login()