2026-07-06 18:30:34 +08:00
2026-07-06 18:30:34 +08:00
2026-07-06 18:08:23 +08:00
2026-07-06 18:30:34 +08:00
2026-07-06 18:30:34 +08:00
2026-07-06 18:08:23 +08:00
2026-07-06 18:08:23 +08:00
2026-07-06 18:08:23 +08:00
2026-07-06 18:08:23 +08:00
2026-07-06 18:30:34 +08:00
2026-07-06 18:08:23 +08:00
2026-07-06 18:30:34 +08:00

huya-go

虎牙活动积分兑换/抢购的 Go 复刻版。当前支持两种传输层:

  • http:走 https://cdnws.api.huya.com/,兼容原有命令。
  • wss:实验实现。浏览器手动抓包确认兑换链路会走 WSS,但当前 Go WSS 外层协议仍需按 TAF WebSocketCommand 重做。

构建

CLI:

go test ./...
go build -o huya-go ./cmd/huya-go

GUI:

cd frontend
npm install
npm run typecheck
cd ..
wails build -debug -nopackage

GUI 二进制输出到 build/bin/huya-gui。开发时可以使用 wails dev 启动 Wails + React + Ant Design 界面。

推荐把账号 Cookie 放到本地文件,一行一个账号:

yyuid=...; udb_uid=...; guid=...; ...

不要把 Cookie、token、JWT 提交到仓库或写进文档。

常用命令

GUI 界面提供账号预览、奖品列表、积分查询、兑换记录、直接兑换、监控抢购、实时日志。

CLI 示例:

查询奖品列表:

./huya-go -cmd list -sid 2203 -cookie-file cookie.txt

查询积分:

./huya-go -cmd score -sid 2203 -cookie-file cookie.txt

直接兑换指定 PID:

./huya-go -cmd exchange -sid 2203 -pid 12889 -cookie-file cookie.txt -transport http

按奖品名轮询并抢购:

./huya-go -cmd monitor -sid 2203 -name 小黄鸭 -cookie-file cookie.txt -transport http -loops 20 -delay 120 -concurrency 5

定时开始:

./huya-go -cmd monitor -sid 2203 -pid 12889 -cookie-file cookie.txt -transport http -at "2026-07-06 20:00:00"

参数说明

  • -cmd:list、score、records、exchange、monitor。
  • -sid:活动 SID,必填。
  • -pid:奖品 PID。exchange 必填,monitor 可用 -pid 或 -name。
  • -cookie:单账号 Cookie。
  • -cookie-file:多账号 Cookie 文件。
  • -transport:http 或 wss,默认 http;当前实际使用建议保持 http。
  • -wss-host:WebSocket host。默认值来自 2026-07-06 手动抓包,失效时应从浏览器抓包或 launch.queryHttpDns 结果更新。
  • -timeout:单次调用超时秒数。
  • -loops、-delay、-concurrency:轮询次数、轮询间隔、并发账号数。
  • -stop-after-success:monitor 中任一账号成功后是否停止。
  • -v:输出调试日志。

已确认的小黄鸭参数

2026-07-06 浏览器手动抢购抓包确认:

  • sid=2203
  • pid=12889
  • 奖品名:套装-潮萌小黄鸭
  • 消耗积分:988

远端配置里的子奖品代码不能直接当兑换 PID,实际兑换以 scoreExchangePrize 请求里的 pid 为准。

S
Description
No description provided
Readme
20 MiB
Languages
Go 72.2%
TypeScript 23.4%
CSS 2.3%
JavaScript 1.8%
Shell 0.2%