xfgryujk / blivedm

获取bilibili直播弹幕,使用WebSocket协议,支持web端和B站直播开放平台两种接口
MIT License
1.05k stars 225 forks source link

从弹幕消息的 dm_v2 字段读取用户头像 url #30

Closed TomatoPuddin closed 1 year ago

TomatoPuddin commented 1 year ago

弹幕消息的 dm_v2 字段为 base64 编码的 protobuf 数据,去转义后丢进解码器可以看到有头像 url 。 从此处读取头像 url 能直接省去调用B站接口的开销。

{
  "cmd": "DANMU_MSG",
  "info": [......],
  "dm_v2": "CiIxMmM2ZDg4MGQ5Yjc3Njc3NTI1NTA1NjFjYjY0YTJmYjU5EAEYGSDP2v8HKghkODU4ZWQ3MzIG5ZGc5ZGcOMHUk+WRMUjl2cv+AWIAaAFydwoG5ZGc5ZGcEm0KE3Jvb21fMTA0MTMwNTFfMzY5NDkSSmh0dHBzOi8vaTAuaGRzbGIuY29tL2Jmcy9nYXJiLzMxYjI4ZjRlZjQ0NmYxNmYzZDEyZGU3ZTYzMmFlNjBhMmE0NDAyZWIucG5nGAEgASgBMKIBOKIBigEAmgEQCghFRTQ5MzU1OBCd9oulBqIBpQEIwofiBBIP5biD5LiB55Wq6IyE6IyEIkpodHRwczovL2kwLmhkc2xiLmNvbS9iZnMvZmFjZS9mY2NjY2MxOTQ3N2M0YzYzMGE0MjMwMjliYmViYjk1N2NkZGFkOWMyLmpwZziQTkABWiMIERIJ54ix6I2U5LidIKS6ngYwpLqeBjikup4GQKS6ngZQAWIPCBUQ3q3iAhoGPjUwMDAwagByAHoCCB+qARoIt+vxwQQSDeiNlOaenVl1cmliaXUY+8f7BA=="
}

T5}K N62)`LAQL3}7~XYZGU

simon300000 commented 1 year ago

🤣

xfgryujk commented 1 year ago

等我验证一下。差不多该开个protobuf的分支了

xfgryujk commented 1 year ago

还真是,看来protobuf里面的信息比JSON的多 目前前端的代码已经没有protobuf解析部分了,还好我之前存了一份 看错文件了,是在app.js里 proto