修复 wss 部分错误

This commit is contained in:
yml2213
2026-07-06 18:30:34 +08:00
parent 4235cce4f5
commit 1d15fadfd9
7 changed files with 381 additions and 338 deletions
+5 -5
View File
@@ -3,7 +3,7 @@
虎牙活动积分兑换/抢购的 Go 复刻版。当前支持两种传输层:
- `http`:走 `https://cdnws.api.huya.com/`,兼容原有命令。
- `wss`:走浏览器同源 WebSocket 协议,更贴近手动抢购抓包里的链路。
- `wss`:实验实现。浏览器手动抓包确认兑换链路会走 WSS,但当前 Go WSS 外层协议仍需按 TAF `WebSocketCommand` 重做。
## 构建
@@ -57,19 +57,19 @@ CLI 示例:
直接兑换指定 PID:
```bash
./huya-go -cmd exchange -sid 2203 -pid 12889 -cookie-file cookie.txt -transport wss
./huya-go -cmd exchange -sid 2203 -pid 12889 -cookie-file cookie.txt -transport http
```
按奖品名轮询并抢购:
```bash
./huya-go -cmd monitor -sid 2203 -name 小黄鸭 -cookie-file cookie.txt -transport wss -loops 20 -delay 120 -concurrency 5
./huya-go -cmd monitor -sid 2203 -name 小黄鸭 -cookie-file cookie.txt -transport http -loops 20 -delay 120 -concurrency 5
```
定时开始:
```bash
./huya-go -cmd monitor -sid 2203 -pid 12889 -cookie-file cookie.txt -transport wss -at "2026-07-06 20:00:00"
./huya-go -cmd monitor -sid 2203 -pid 12889 -cookie-file cookie.txt -transport http -at "2026-07-06 20:00:00"
```
## 参数说明
@@ -79,7 +79,7 @@ CLI 示例:
- `-pid`:奖品 PID。`exchange` 必填,`monitor` 可用 `-pid` 或 `-name`。
- `-cookie`:单账号 Cookie。
- `-cookie-file`:多账号 Cookie 文件。
- `-transport`:`http` 或 `wss`,默认 `http`;抢购建议使用 `wss`。
- `-transport`:`http` 或 `wss`,默认 `http`;当前实际使用建议保持 `http`。
- `-wss-host`:WebSocket host。默认值来自 2026-07-06 手动抓包,失效时应从浏览器抓包或 `launch.queryHttpDns` 结果更新。
- `-timeout`:单次调用超时秒数。
- `-loops`、`-delay`、`-concurrency`:轮询次数、轮询间隔、并发账号数。