各直播平台弹幕协议和开放平台 API
http://github.com/songtianyi/barrage
package main
import (
"fmt"
"github.com/songtianyi/barrage/douyu"
"github.com/songtianyi/rrframework/logs"
)
func chatmsg(msg *douyu.Message) {
level := msg.GetStringField("level")
nn := msg.GetStringField("nn")
txt := msg.GetStringField("txt")
logs.Info(fmt.Sprintf("level(%s) - %s >>> %s", level, nn, txt))
}
func main() {
client, err := douyu.Connect("openbarrage.douyutv.com:8601", nil)
if err != nil {
logs.Error(err)
return
}
client.HandlerRegister.Add("chatmsg", douyu.Handler(chatmsg), "chatmsg")
if err := client.JoinRoom(288016); err != nil {
logs.Error(fmt.Sprintf("Join room fail, %s", err.Error()))
return
}
client.Serve()
}
package main
import (
"github.com/songtianyi/barrage/bilibili"
"github.com/songtianyi/rrframework/logs"
)
func danmu(msg *bilibili.Message) {
logs.Debug(">>> ", string(msg.Bytes()))
}
func main() {
// uri, userid, handlerRegister
client, err := bilibili.Connect("https://live.bilibili.com/43783", -1, nil)
if err != nil {
logs.Error(err)
return
}
client.HandlerRegister.Add(bilibili.DANMU_MSG, bilibili.Handler(danmu), "danmu")
client.Serve()
}
1
zhouquanbest 2017-07-16 11:42:24 +08:00 via Android
LGTM
|
2
spice630 OP @zhouquanbest 哈?
|
3
spice630 OP @管理员
能帮我 move 下节点嘛?怎么是在问与答节点。。。 |
4
Genteure 2017-07-16 14:25:10 +08:00
uhm......
- B 站直播弹幕已经在逐渐弃用 788 端口了 - 心跳包和进入直播间的消息不是相同的 参考: https://github.com/copyliu/bililive_dm/blob/master/BiliDMLib/DanmakuLoader.cs#L75 https://github.com/copyliu/bililive_dm/blob/master/BiliDMLib/DanmakuLoader.cs#L317 |
8
102400 2017-07-17 02:28:42 +08:00
就没有人做一下发送弹幕的吗?
|