增加了代理
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user