优化代理相关, 移除旧的死代码
This commit is contained in:
+3
-20
@@ -76,14 +76,8 @@ class DouyuLogin:
|
||||
max_proxy_retries: int = 0,
|
||||
max_login_retries: int = 0,
|
||||
max_total_time: float = 0,
|
||||
whitelist_uid: str = "",
|
||||
whitelist_ukey: str = "",
|
||||
whitelist_platform: str = "xiequ",
|
||||
whitelist_credentials: dict = None,
|
||||
proxy_fetcher: Optional[ProxyFetcher] = None,
|
||||
stop_event: Optional[threading.Event] = None,
|
||||
# 向后兼容:旧代码传 proxy_manager 时自动转为 proxy_fetcher
|
||||
proxy_manager=None,
|
||||
):
|
||||
self.account = account
|
||||
self.proxy = proxy
|
||||
@@ -94,20 +88,9 @@ class DouyuLogin:
|
||||
self.stop_event = stop_event
|
||||
self.session = requests.Session()
|
||||
|
||||
# 初始化代理获取器
|
||||
if proxy_fetcher:
|
||||
self.proxy_fetcher = proxy_fetcher
|
||||
elif proxy_api_url:
|
||||
self.proxy_fetcher = ProxyFetcher(
|
||||
api_url=proxy_api_url,
|
||||
whitelist_platform=whitelist_platform,
|
||||
whitelist_credentials=whitelist_credentials or (
|
||||
{"uid": whitelist_uid, "ukey": whitelist_ukey}
|
||||
if whitelist_uid and whitelist_ukey else None
|
||||
),
|
||||
)
|
||||
else:
|
||||
self.proxy_fetcher = None
|
||||
self.proxy_fetcher = proxy_fetcher or (
|
||||
ProxyFetcher(api_url=proxy_api_url) if proxy_api_url else None
|
||||
)
|
||||
|
||||
self._current_proxy_url: Optional[str] = None
|
||||
self._cookie_enrich_error = ""
|
||||
|
||||
Reference in New Issue
Block a user