支持虎牙活动WSS自定义连接来源

This commit is contained in:
yml2213
2026-09-01 12:21:09 +08:00
parent aab84e0fb5
commit 17e72d40a5
+6 -2
View File
@@ -214,7 +214,11 @@ class HuyaWssClient:
}
async def connect(
self, host: str = SHOP_WS_HOST, timeout: float = 15.0, cookie: str = ""
self,
host: str = SHOP_WS_HOST,
timeout: float = 15.0,
cookie: str = "",
origin: str = "https://m-shop.yaoguo.com",
):
from urllib.parse import quote
@@ -233,7 +237,7 @@ class HuyaWssClient:
self.ws = await asyncio.wait_for(
websockets.connect(
url,
origin=cast(Any, "https://m-shop.yaoguo.com"),
origin=cast(Any, origin),
user_agent_header=BROWSER_UA,
additional_headers=headers,
open_timeout=timeout,