FishZe / go-bili-chat

Bilibili直播间弹幕处理库 支持事件绑定 高性能 低占用
GNU Affero General Public License v3.0
40 stars 10 forks source link

websocket连接错误 #40

Closed bighuangbee closed 3 months ago

bighuangbee commented 3 months ago

[bili-live][05-10 17:32:01][DEBUG]: connect to blive websocket success [bili-live][05-10 17:32:01][DEBUG]: send auth msg to blive success [bili-live][05-10 17:32:01][INFO]: connected to blive success: 32245521 [bili-live][05-10 17:32:01][WARNING]: recv error msg:
[bili-live][05-10 17:32:01][WARNING]: read blive websocket msg error: websocket: close 1006 (abnormal closure): unexpected EOF

FishZe commented 3 months ago

请设置cookiesbuvid,参考 https://github.com/FishZe/go-bili-chat/blob/3fb288675f144c37654f535a8c7633c8427a6636/example/main.go#L56https://github.com/FishZe/go-bili-chat/blob/3fb288675f144c37654f535a8c7633c8427a6636/main.go#L60

bighuangbee commented 3 months ago
现在没有了SetHeaderCookie函数,试了下还是不行

bili.SetUID(443345583) //bili.SetHeader(map[string][]string{ // "DedeUserID__ckMd5": []string{"a08xxx"}, // "SESSDATA": []string{"6f867xxx"}, // "bili_jct": []string{"ab4af4xxx"}, // "DedeUserID": []string{"34xxxx"}, //}) bili.SetHeader(map[string][]string{ "cookie": []string{"DedeUserID__ckMd5=a08xxx; SESSDATA=6f867xxx; bili_jct=ab4af4xxx; DedeUserID=34xxxx"}, })

FishZe commented 3 months ago

尝试拉取最新提交

go get github.com/FishZe/go-bili-chat@3fb2886

另外,Cookie请使用个人真实内容

bighuangbee commented 3 months ago

请问这些值是从哪里获取的

FishZe commented 3 months ago

可以通过抓包软件在主站的http请求中获取,也可以在浏览器控制台中的network中查看请求,选择对应请求查看请求头获得,也可以在Application中查找到对应内容,buvidbuvid3HeaderCookie中必须包含SESSDATE

bighuangbee commented 3 months ago

非常感谢