Documentation ¶
Index ¶
- Constants
- Variables
- func Btoi16(b []byte, offset int) int16
- func Btoi32(b []byte, offset int) int32
- func EncodeMessage(msg string, Operation int) []byte
- func GetDanmuInfoURL(roomID int) string
- func GetInfoByRoomURL(shortID int) string
- func HelloGen(roomid int, key string) []byte
- func Init()
- func Itob16(num int16) []byte
- func Itob32(num int32) []byte
- type DanmuSpider
- type Message
- type WsServer
Constants ¶
View Source
const ( WS_OP_HEARTBEAT = 2 //心跳 WS_OP_HEARTBEAT_REPLY = 3 //心跳回应 WS_OP_MESSAGE = 5 //弹幕消息等 WS_OP_USER_AUTHENTICATION = 7 //用户进入房间 WS_OP_CONNECT_SUCCESS = 8 //进房回应 WS_PACKAGE_HEADER_TOTAL_LENGTH = 16 //头部字节大小 WS_PACKAGE_OFFSET = 0 WS_HEADER_OFFSET = 4 WS_VERSION_OFFSET = 6 WS_OPERATION_OFFSET = 8 WS_SEQUENCE_OFFSET = 12 WS_BODY_PROTOCOL_VERSION_NORMAL = 0 //普通消息 WS_BODY_PROTOCOL_VERSION_HEARTBEAT_REPLY = 1 WS_BODY_PROTOCOL_VERSION_DEFLATE = 2 WS_BODY_PROTOCOL_VERSION_BROTLI = 3 //brotli压缩信息 WS_HEADER_DEFAULT_VERSION = 1 WS_HEADER_DEFAULT_OPERATION = 1 WS_HEADER_DEFAULT_SEQUENCE = 1 WS_AUTH_OK = 0 WS_AUTH_TOKEN_ERROR = -101 )
from https://github.com/lovelyyoshino/Bilibili-Live-API/blob/master/API.WebSocket.md
View Source
const ( Protover = 2 Platform = "web" Type = 2 )
from player-loader-2.0.11.min.js
customAuthParam
Variables ¶
View Source
var ( Info logger.InternalLoggerChannel Debug logger.InternalLoggerChannel )
Functions ¶
func EncodeMessage ¶
func GetDanmuInfoURL ¶
func GetInfoByRoomURL ¶
Types ¶
type DanmuSpider ¶
type DanmuSpider struct { ShortID int Live []string //直播流链接 Live_qn int //当前直播流质量 Live_want_qn int //期望直播流质量 RoomID int //房间id Title string //直播标题 Uname string //主播名 UpUid int //主播uid Rev float64 //营收 Renqi int //人气 GuardNum int //舰长数 ParentAreaID int //父分区 AreaID int //子分区 Locked bool //直播间封禁 Note string //分区排行 Live_Start_Time time.Time //直播开始时间 Liveing bool //是否在直播 Wearing_FansMedal int //当前佩戴的粉丝牌 Token string //弹幕钥 WSURL []string //弹幕链接 LIVE_BUVID bool //cookies含LIVE_BUVID Dial *websocket.Conn }
func NewDanmuSpider ¶
func NewDanmuSpider(shortId int) *DanmuSpider
func (*DanmuSpider) DecodeMessage ¶
func (d *DanmuSpider) DecodeMessage(msg []byte)
func (*DanmuSpider) HeartBeat ¶
func (d *DanmuSpider) HeartBeat()
func (*DanmuSpider) Init ¶
func (d *DanmuSpider) Init()
func (*DanmuSpider) MessageHandler ¶
func (d *DanmuSpider) MessageHandler(msg *Message)
func (*DanmuSpider) Send ¶
func (d *DanmuSpider) Send(msg []byte)
type WsServer ¶
type WsServer struct {
// contains filtered or unexported fields
}
func NewWsServer ¶
func NewWsServer() *WsServer
Click to show internal directories.
Click to hide internal directories.