xiao.qiang 15167c4165 coinw 添加数据实例 11 місяців тому
..
01.pbjs.sh c7961c369a coinw 添加数据实例 11 місяців тому
market.v2.trade.js 9e1bc5af7e coinw 添加数据实例 11 місяців тому
market.v2.trade.json 9e1bc5af7e coinw 添加数据实例 11 місяців тому
market.v2.trade.proto c7961c369a coinw 添加数据实例 11 місяців тому
readme.md c7961c369a coinw 添加数据实例 11 місяців тому
type.googleapis.com.CandlesPbMsg.js 15167c4165 coinw 添加数据实例 11 місяців тому
type.googleapis.com.CandlesPbMsg.json 15167c4165 coinw 添加数据实例 11 місяців тому
type.googleapis.com.CandlesPbMsg.proto 15167c4165 coinw 添加数据实例 11 місяців тому
type.googleapis.com.CommonPbMsg.js 15167c4165 coinw 添加数据实例 11 місяців тому
type.googleapis.com.CommonPbMsg.json 15167c4165 coinw 添加数据实例 11 місяців тому
type.googleapis.com.CommonPbMsg.proto 15167c4165 coinw 添加数据实例 11 місяців тому
type.googleapis.com.DepthPbMsg.js 15167c4165 coinw 添加数据实例 11 місяців тому
type.googleapis.com.DepthPbMsg.json 15167c4165 coinw 添加数据实例 11 місяців тому
type.googleapis.com.DepthPbMsg.proto 15167c4165 coinw 添加数据实例 11 місяців тому
type.googleapis.com.FillsPbMsg.js 15167c4165 coinw 添加数据实例 11 місяців тому
type.googleapis.com.FillsPbMsg.json 15167c4165 coinw 添加数据实例 11 місяців тому
type.googleapis.com.FillsPbMsg.proto 15167c4165 coinw 添加数据实例 11 місяців тому
type.googleapis.com.FundRatesPbMsg.js 15167c4165 coinw 添加数据实例 11 місяців тому
type.googleapis.com.FundRatesPbMsg.json 15167c4165 coinw 添加数据实例 11 місяців тому
type.googleapis.com.FundRatesPbMsg.proto 15167c4165 coinw 添加数据实例 11 місяців тому
type.googleapis.com.TickersPbMsg.js 15167c4165 coinw 添加数据实例 11 місяців тому
type.googleapis.com.TickersPbMsg.json 15167c4165 coinw 添加数据实例 11 місяців тому
type.googleapis.com.TickersPbMsg.proto 15167c4165 coinw 添加数据实例 11 місяців тому

readme.md

解决JSON.stringify 丢undefined 的问题

JSON.stringify(obj, (key, value) => {
    if (value === undefined) {
        return null
    }
    return value
})

proto 逆向过程

hotconi 采用 wss和rpc方式通信,经过采样发现,使用protobufjs可以解开

wss通信后,使用proto对象镜像接收数据。

proto对象已经被编译混淆,无法还原,但是可以通过返回值猜测结构和排序。

market.v2.trade.area.tickers 为例

在网页上抓包接 返回值结构

{
  "code": 200,
  "msg": "SUCCESS",
  "status": "ok",
  "ts": 1732365915001,
  "ch": "market.v2.trade.area.tickers",
  "klinelist": null,
  "tradedepthvo": null,
  "tradedetaillist": null,
  "tradeareapair": {
    "listList": [
      {
        "tradeid": 1900573,
        "cny": "0.000499",
        "buy": "0.00006590000000000000",
        "lever": "0",
        "sell": "0.00006899000000000000",
        "last": "0.00006899000000000000",
        "volume": "4612936154.8542",
        "change": "0.96",
        "high": "0.00007299000000000000",
        "low": "0.00006451000000000000",
        "isopen": "1",
        "open": "0",
        "amount": "307750.69",
        "isfiatconvert": true
      }

    ]
  },
  "mainpair": null,
  "recommendpair": null,
  "uppair": null,
  "amtpair": null,
  "starpair": null,
  "tradetickervo": null,
  "entrustvo": null,
  "userassetbalance": null,
  "markettickerlist": null,
  "marketmonit": null,
  "margincrossassetvo": null,
  "marginisolatedassetvo": null,
  "newlistingpair": null,
  "chgdistributions": null,
  "marketzones": null,
  "klineorders": null,
  "notificationpush": null,
  "tradehotlisting": null,
  "ctcgoingordernum": null,
  "multichange": null,
  "heatmap": null,
  "downpair": null,
  "heatvol": null,
  "currencyrate": null
}

按照 proto格式 逆向编写文件

syntax = "proto3";

package market.v2.trade; // 替换为你的包名

// 定义最外层的消息类型
message Response {
  int32 code = 1;  //数字代表 字段的编号顺序。
  string msg = 2;
  string status = 3;
  int64 ts = 4;
  string ch = 5;
  TradeAreaPair tradeareapair = 25;
}

// 定义tradeareapair中的消息类型
message TradeAreaPair {
  repeated TradeArea listList = 1; // 由于JSON中的listList实际上是一个列表,我们使用repeated关键字
}

// 定义tradeid_list中的消息类型
message TradeArea {
  int32 tradeid = 1;
  string cny = 2;
  string buy = 3;
  int32 lever = 4; 
  string sell = 5;
  string last = 6;
  string volume = 7;
  string change = 8;
  string high = 9;
  string low = 10;
  string isopen = 11;
  int32 open = 12;
  string amount = 13;
  bool isfiatconvert = 14;
}

【重点】 如果网页抓包的某项有值,但是接收到的没有值,需要调整每一个字段的编号。 上面是一个包的方式,其他所有接口都类似抓取,然后 规范的添加到 market.v2.trade.proto