live

package module
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2022 License: GPL-3.0 Imports: 13 Imported by: 1

README

logo

BiliGO-LIVE

BiliBili Live WebSocket Protocol SDK in Golang


Go Reference

简介

v0版本不保证对外函数、结构的不变性,请勿大规模用于生产环境

哔哩哔哩直播 WebSocket 协议的 Golang 封装

特性

  • 良好的设计,自定义程度高
  • 代码、结构体注释完善,开箱即用
  • 功能简单,封装程度高

说明

  • 该项目永远不会编写直接涉及滥用的接口
  • 该项目仅供学习,请勿用于商业用途。任何使用该项目造成的后果由开发者自行承担

参考

快速开始

安装

go get -u github.com/iyear/biligo-live
import "github.com/iyear/biligo-live"

使用

查看代码
package main

import (
	"context"
	"fmt"
	"github.com/gorilla/websocket"
	"github.com/iyear/biligo-live"
	"log"
	"time"
)

// 同 README.md 的快速开始

func main() {
	const room int64 = 48743

	// 获取一个Live实例
	// debug: debug模式,输出一些额外的信息
	// heartbeat: 心跳包发送间隔。不发送心跳包,70 秒之后会断开连接,通常每 30 秒发送 1 次
	// cache: Rev channel 的缓存
	// recover: panic recover后的操作函数
	l := live.NewLive(true, 30*time.Second, 0, func(err error) {
		log.Println("panic:", err)
		// do something...
	})

	// 连接ws服务器
	// dialer: ws dialer
	// host: bilibili live ws host
	if err := l.Conn(websocket.DefaultDialer, live.WsDefaultHost); err != nil {
		log.Fatal(err)
		return
	}

	ctx, stop := context.WithCancel(context.Background())

	go func() {
		// 进入房间
		// room: room id(真实ID,短号需自行转换)
		// key: 用户标识,可留空
		// uid: 用户UID,可随机生成
		if err := l.Enter(ctx, room, "", 12345678); err != nil {
			log.Fatal(err)
			return
		}
	}()

	go rev(ctx, l)

	// 15s的演示
	after := time.NewTimer(15 * time.Second)
	defer after.Stop()
	<-after.C
	fmt.Println("I want to stop")
	// 关闭ws连接与相关协程
	stop()
	// 为了使安全退出效果可见,进行阻塞,真实场景中可以移除
	select {}
}
func rev(ctx context.Context, l *live.Live) {
	for {
		select {
		case tp := <-l.Rev:
			if tp.Error != nil {
				// do something...
				log.Println(tp.Error)
				continue
			}
			handle(tp.Msg)
		case <-ctx.Done():
			log.Println("rev func stopped")
			return
		}
	}
}
func handle(msg live.Msg) {
	// 使用 msg.(type) 进行事件跳转和处理,常见事件基本都完成了解析(Parse)功能,不常见的功能有一些实在太难抓取
	// 更多注释和说明等待添加
	switch msg := msg.(type) {
	// 心跳回应直播间人气值
	case *live.MsgHeartbeatReply:
		log.Printf("hot: %d\n", msg.GetHot())
	// 弹幕消息  
	case *live.MsgDanmaku:
		dm, err := msg.Parse()
		if err != nil {
			log.Println(err)
			return
		}
		fmt.Printf("弹幕: %s (%d:%s) 【%s】| %d\n", dm.Content, dm.MID, dm.Uname, dm.MedalName, dm.Time)
	// 礼物消息 
	case *live.MsgSendGift:
		g, err := msg.Parse()
		if err != nil {
			log.Println(err)
			return
		}
		fmt.Printf("%s: %s %d个%s\n", g.Action, g.Uname, g.Num, g.GiftName)
	// 直播间粉丝数变化消息 
	case *live.MsgFansUpdate:
		f, err := msg.Parse()
		if err != nil {
			log.Println(err)
			return
		}
		fmt.Printf("room: %d,fans: %d,fansClub: %d\n", f.RoomID, f.Fans, f.FansClub)
	// case:......

	// General 表示live未实现的CMD命令,请自行处理raw数据。也可以提issue更新这个CMD
	case *live.MsgGeneral:
		fmt.Println("unknown msg type|raw:", string(msg.Raw()))
	}
}

LICENSE

GPLv3

Documentation

Index

Constants

View Source
const (
	WsDefaultHost = "wss://broadcastlv.chat.bilibili.com/sub"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnchorLotAward

type AnchorLotAward struct {
	LotStatus  int    `json:"lot_status"`
	Url        string `json:"url"`
	WebUrl     string `json:"web_url"`
	AwardImage string `json:"award_image"`
	AwardName  string `json:"award_name"`
	AwardNum   int    `json:"award_num"`
	AwardUsers []struct {
		Uname string `json:"uname"`
		Face  string `json:"face"`
		Level int    `json:"level"`
		Color int64  `json:"color"`
		UID   int64  `json:"uid"`
	} `json:"award_users"`
	ID int64 `json:"id"`
}
{
  "lot_status": 2,
  "url": "https://live.bilibili.com/p/html/live-lottery/anchor-join.html?is_live_half_webview=1&hybrid_biz=live-lottery-anchor&hybrid_half_ui=1,5,100p,100p,000000,0,30,0,0,1;2,5,100p,100p,000000,0,30,0,0,1;3,5,100p,100p,000000,0,30,0,0,1;4,5,100p,100p,000000,0,30,0,0,1;5,5,100p,100p,000000,0,30,0,0,1;6,5,100p,100p,000000,0,30,0,0,1;7,5,100p,100p,000000,0,30,0,0,1;8,5,100p,100p,000000,0,30,0,0,1",
  "web_url": "https://live.bilibili.com/p/html/live-lottery/anchor-join.html",
  "award_image": "",
  "award_name": "648元现金红包",
  "award_num": 1,
  "award_users": [
	{
	  "uname": "咲友",
	  "face": "http://i0.hdslb.com/bfs/face/09b505910990d61a0777984f8a142b8e70485987.jpg",
	  "level": 21,
	  "color": 5805790,
	  "uid": 29038770
	}
  ],
  "id": 1890708
}

type AnchorLotCheckStatus

type AnchorLotCheckStatus struct {
	ID           int64  `json:"id"`
	RejectReason string `json:"reject_reason"`
	Status       int    `json:"status"`
	Uid          int64  `json:"uid"`
}
{
  "id": 1890708,
  "reject_reason": "",
  "status": 4,
  "uid": 2920960
}

type AnchorLotStart

type AnchorLotStart struct {
	MaxTime        int    `json:"max_time"`
	Danmu          string `json:"danmu"`
	GiftNum        int    `json:"gift_num"`
	JoinType       int    `json:"join_type"`
	AwardImage     string `json:"award_image"`
	GiftPrice      int    `json:"gift_price"`
	GiftID         int64  `json:"gift_id"`
	GiftName       string `json:"gift_name"`
	GoodsID        int64  `json:"goods_id"`
	RoomID         int64  `json:"room_id"`
	Time           int64  `json:"time"`
	Url            string `json:"url"`
	CurGiftNum     int    `json:"cur_gift_num"`
	CurrentTime    int64  `json:"current_time"`
	LotStatus      int    `json:"lot_status"`
	RequireType    int    `json:"require_type"`
	WebUrl         string `json:"web_url"`
	GoawayTime     int    `json:"goaway_time"`
	IsBroadcast    int    `json:"is_broadcast"`
	RequireValue   int    `json:"require_value"`
	ShowPanel      int    `json:"show_panel"`
	Status         int    `json:"status"`
	ID             int64  `json:"id"`
	RequireText    string `json:"require_text"`
	AwardNum       int    `json:"award_num"`
	AssetIcon      string `json:"asset_icon"`
	AwardName      string `json:"award_name"`
	SendGiftEnsure int    `json:"send_gift_ensure"`
}
{
  "max_time": 600,
  "danmu": "好耶!",
  "gift_num": 1,
  "join_type": 0,
  "award_image": "",
  "gift_price": 0,
  "gift_id": 0,
  "gift_name": "",
  "goods_id": -99998,
  "room_id": 732602,
  "time": 599,
  "url": "https://live.bilibili.com/p/html/live-lottery/anchor-join.html?is_live_half_webview=1&hybrid_biz=live-lottery-anchor&hybrid_half_ui=1,5,100p,100p,000000,0,30,0,0,1;2,5,100p,100p,000000,0,30,0,0,1;3,5,100p,100p,000000,0,30,0,0,1;4,5,100p,100p,000000,0,30,0,0,1;5,5,100p,100p,000000,0,30,0,0,1;6,5,100p,100p,000000,0,30,0,0,1;7,5,100p,100p,000000,0,30,0,0,1;8,5,100p,100p,000000,0,30,0,0,1",
  "cur_gift_num": 0,
  "current_time": 1635849356,
  "lot_status": 0,
  "require_type": 2,
  "web_url": "https://live.bilibili.com/p/html/live-lottery/anchor-join.html",
  "goaway_time": 180,
  "is_broadcast": 1,
  "require_value": 1,
  "show_panel": 1,
  "status": 1,
  "id": 1890708,
  "require_text": "当前主播粉丝勋章至少1级",
  "award_num": 1,
  "asset_icon": "https://i0.hdslb.com/bfs/live/627ee2d9e71c682810e7dc4400d5ae2713442c02.png",
  "award_name": "648元现金红包",
  "send_gift_ensure": 0
}

type Danmaku

type Danmaku struct {
	SendMode     int    `json:"send_mode"`
	SendFontSize int    `json:"send_font_size"`
	DanmakuColor int64  `json:"danmaku_color"`
	Time         int64  `json:"time"`
	DMID         int64  `json:"dmid"`
	MsgType      int    `json:"msg_type"`
	Bubble       string `json:"bubble"`
	Content      string `json:"content"`
	MID          int64  `json:"mid"`
	Uname        string `json:"uname"`
	RoomAdmin    int    `json:"room_admin"`
	Vip          int    `json:"vip"`
	SVip         int    `json:"svip"`
	Rank         int    `json:"rank"`
	MobileVerify int    `json:"mobile_verify"`
	UnameColor   string `json:"uname_color"`
	MedalName    string `json:"medal_name"`
	UpName       string `json:"up_name"`
	MedalLevel   int    `json:"medal_level"`
	UserLevel    int    `json:"user_level"`
}

type FansUpdate

type FansUpdate struct {
	// {
	// 	"fans_club": 49182,
	// 	"roomid": 545068,
	// 	"fans": 1384297,
	// 	"red_notice": -1
	// }
	FansClub  int   `json:"fans_club"`
	RoomID    int64 `json:"roomid"`
	Fans      int   `json:"fans"`
	RedNotice int   `json:"red_notice"`
}

type GuardBuy

type GuardBuy struct {
	GuardLevel int    `json:"guard_level"`
	Price      int    `json:"price"`
	UID        int64  `json:"uid"`
	Num        int    `json:"num"`
	GiftID     int64  `json:"gift_id"`
	GiftName   string `json:"gift_name"`
	StartTime  int64  `json:"start_time"`
	EndTime    int64  `json:"end_time"`
	Username   string `json:"username"`
}
{
  "guard_level": 2,
  "price": 1998000,
  "uid": 1751924,
  "num": 1,
  "gift_id": 10002,
  "gift_name": "提督",
  "start_time": 1635766940,
  "end_time": 1635766940,
  "username": "ppmann"
}

type HotRankChanged

type HotRankChanged struct {
	Rank        int    `json:"rank"`
	Timestamp   int64  `json:"timestamp"`
	WebUrl      string `json:"web_url"`
	LiveUrl     string `json:"live_url"`
	LiveLinkUrl string `json:"live_link_url"`
	AreaName    string `json:"area_name"`
	Trend       int    `json:"trend"`
	Countdown   int    `json:"countdown"`
	BlinkUrl    string `json:"blink_url"`
	PCLinkUrl   string `json:"pc_link_url"`
	Icon        string `json:"icon"`
}

type HotRankSettlement

type HotRankSettlement struct {
	DmMsg     string `json:"dm_msg"`
	DmScore   int    `json:"dmscore"`
	Timestamp int64  `json:"timestamp"`
	Uname     string `json:"uname"`
	Url       string `json:"url"`
	AreaName  string `json:"area_name"`
	CacheKey  string `json:"cache_key"`
	Rank      int    `json:"rank"`
	Face      string `json:"face"`
	Icon      string `json:"icon"`
}
{
  "dm_msg": "恭喜主播 <% 老实憨厚的笑笑 %> 荣登限时热门榜网游榜top3! 即将获得热门流量推荐哦!",
  "dmscore": 144,
  "timestamp": 1635748200,
  "uname": "老实憨厚的笑笑",
  "url": "https://live.bilibili.com/p/html/live-app-hotrank/result.html?is_live_half_webview=1&hybrid_half_ui=1,5,250,200,f4eefa,0,30,0,0,0;2,5,250,200,f4eefa,0,30,0,0,0;3,5,250,200,f4eefa,0,30,0,0,0;4,5,250,200,f4eefa,0,30,0,0,0;5,5,250,200,f4eefa,0,30,0,0,0;6,5,250,200,f4eefa,0,30,0,0,0;7,5,250,200,f4eefa,0,30,0,0,0;8,5,250,200,f4eefa,0,30,0,0,0&areaId=2&cache_key=d04fe4e6d0f2bc24c1a5acc63f574b68",
  "area_name": "网游",
  "cache_key": "d04fe4e6d0f2bc24c1a5acc63f574b68",
  "rank": 3,
  "face": "http://i0.hdslb.com/bfs/face/d92282ac664afffd0ef38c275f3fca17a9567d5a.jpg",
  "icon": "https://i0.hdslb.com/bfs/live/65dbe013f7379c78fc50dfb2fd38d67f5e4895f9.png"
}

type InteractWord added in v0.1.1

type InteractWord struct {
	TailIcon     int    `json:"tail_icon"`
	UID          int64  `json:"uid"`
	Uname        string `json:"uname"`
	UnameColor   string `json:"uname_color"`
	Dmscore      int    `json:"dmscore"`
	Score        int64  `json:"score"`
	SpreadDesc   string `json:"spread_desc"`
	Timestamp    int64  `json:"timestamp"`
	Identities   []int  `json:"identities"`
	IsSpread     int    `json:"is_spread"`
	Roomid       int    `json:"roomid"`
	TriggerTime  int64  `json:"trigger_time"`
	Contribution struct {
		Grade int `json:"grade"`
	} `json:"contribution"`
	FansMedal struct {
		MedalColor       int64  `json:"medal_color"`
		MedalColorStart  int64  `json:"medal_color_start"`
		MedalLevel       int    `json:"medal_level"`
		Score            int    `json:"score"`
		TargetId         int    `json:"target_id"`
		GuardLevel       int    `json:"guard_level"`
		IconId           int    `json:"icon_id"`
		IsLighted        int    `json:"is_lighted"`
		MedalName        string `json:"medal_name"`
		Special          string `json:"special"`
		AnchorRoomID     int64  `json:"anchor_roomid"`
		MedalColorBorder int64  `json:"medal_color_border"`
		MedalColorEnd    int64  `json:"medal_color_end"`
	} `json:"fans_medal"`
	MsgType    int    `json:"msg_type"`
	SpreadInfo string `json:"spread_info"`
}
{
  "tail_icon": 0,
  "uid": 13729609,
  "uname": "阿羽AYu-",
  "uname_color": "",
  "dmscore": 12,
  "score": 1635849011802,
  "spread_desc": "",
  "timestamp": 1635849011,
  "identities": [
	1
  ],
  "is_spread": 0,
  "roomid": 732602,
  "trigger_time": 1635849010751414020,
  "contribution": {
	"grade": 0
  },
  "fans_medal": {
	"medal_color": 12632256,
	"medal_color_start": 12632256,
	"medal_level": 10,
	"score": 10103,
	"target_id": 67141,
	"guard_level": 0,
	"icon_id": 0,
	"is_lighted": 0,
	"medal_name": "C酱",
	"special": "",
	"anchor_roomid": 47867,
	"medal_color_border": 12632256,
	"medal_color_end": 12632256
  },
  "msg_type": 1,
  "spread_info": ""
}

type Live

type Live struct {
	Rev chan *Transport
	// contains filtered or unexported fields
}

func NewLive

func NewLive(debug bool, heartbeat time.Duration, cache int, recover func(error)) *Live

NewLive 创建一个新的直播连接

func (*Live) Conn

func (l *Live) Conn(dialer *websocket.Dialer, host string) error

Conn ws连接bilibili弹幕服务器

func (*Live) ConnWithHeader added in v0.1.5

func (l *Live) ConnWithHeader(dialer *websocket.Dialer, host string, header http.Header) error

ConnWithHeader ws连接bilibili弹幕服务器 (带header)

func (*Live) Enter

func (l *Live) Enter(ctx context.Context, room int64, key string, uid int64) error

Enter 进入房间。 Conn 后五秒内必须进入房间,否则服务器主动断开连接

type Msg

type Msg interface {
	Cmd() string
	Raw() []byte
}

type MsgActivityBannerUpdateV2

type MsgActivityBannerUpdateV2 struct {
	// contains filtered or unexported fields
}

func (*MsgActivityBannerUpdateV2) Cmd

func (*MsgActivityBannerUpdateV2) Raw

func (m *MsgActivityBannerUpdateV2) Raw() []byte

type MsgActivityRedPacket

type MsgActivityRedPacket struct {
	// contains filtered or unexported fields
}

func (*MsgActivityRedPacket) Cmd

func (m *MsgActivityRedPacket) Cmd() string

func (*MsgActivityRedPacket) Raw

func (m *MsgActivityRedPacket) Raw() []byte

type MsgAnchorLotAward

type MsgAnchorLotAward struct {
	// contains filtered or unexported fields
}

MsgAnchorLotAward 天选结果推送

func (*MsgAnchorLotAward) Cmd

func (m *MsgAnchorLotAward) Cmd() string

func (*MsgAnchorLotAward) Parse

func (m *MsgAnchorLotAward) Parse() (*AnchorLotAward, error)

func (*MsgAnchorLotAward) Raw

func (m *MsgAnchorLotAward) Raw() []byte

type MsgAnchorLotCheckStatus

type MsgAnchorLotCheckStatus struct {
	// contains filtered or unexported fields
}

MsgAnchorLotCheckStatus 天选时刻前的审核

func (*MsgAnchorLotCheckStatus) Cmd

func (*MsgAnchorLotCheckStatus) Parse

func (*MsgAnchorLotCheckStatus) Raw

func (m *MsgAnchorLotCheckStatus) Raw() []byte

type MsgAnchorLotEnd

type MsgAnchorLotEnd struct {
	// contains filtered or unexported fields
}

MsgAnchorLotEnd 天选之人获奖id

func (*MsgAnchorLotEnd) Cmd

func (m *MsgAnchorLotEnd) Cmd() string

func (*MsgAnchorLotEnd) GetID

func (m *MsgAnchorLotEnd) GetID() int64

func (*MsgAnchorLotEnd) Raw

func (m *MsgAnchorLotEnd) Raw() []byte

type MsgAnchorLotStart

type MsgAnchorLotStart struct {
	// contains filtered or unexported fields
}

MsgAnchorLotStart 天选之人开始完整信息

func (*MsgAnchorLotStart) Cmd

func (m *MsgAnchorLotStart) Cmd() string

func (*MsgAnchorLotStart) Parse

func (m *MsgAnchorLotStart) Parse() (*AnchorLotStart, error)

func (*MsgAnchorLotStart) Raw

func (m *MsgAnchorLotStart) Raw() []byte

type MsgAttention

type MsgAttention struct {
	// contains filtered or unexported fields
}

MsgAttention 用户关注

func (*MsgAttention) Cmd

func (m *MsgAttention) Cmd() string

func (*MsgAttention) Raw

func (m *MsgAttention) Raw() []byte

type MsgAttentionOnOpposite

type MsgAttentionOnOpposite struct {
	// contains filtered or unexported fields
}

MsgAttentionOnOpposite 对面观众关注了本直播间

func (*MsgAttentionOnOpposite) Cmd

func (m *MsgAttentionOnOpposite) Cmd() string

func (*MsgAttentionOnOpposite) Raw

func (m *MsgAttentionOnOpposite) Raw() []byte

type MsgAttentionOpposite

type MsgAttentionOpposite struct {
	// contains filtered or unexported fields
}

MsgAttentionOpposite 本直播间观众关注了对面主播

func (*MsgAttentionOpposite) Cmd

func (m *MsgAttentionOpposite) Cmd() string

func (*MsgAttentionOpposite) Raw

func (m *MsgAttentionOpposite) Raw() []byte

type MsgBlock

type MsgBlock struct {
	// contains filtered or unexported fields
}

func (*MsgBlock) Cmd

func (m *MsgBlock) Cmd() string

func (*MsgBlock) Raw

func (m *MsgBlock) Raw() []byte

type MsgCallOnOpposite

type MsgCallOnOpposite struct {
	// contains filtered or unexported fields
}

MsgCallOnOpposite 本直播间的观众跑去对面串门

func (*MsgCallOnOpposite) Cmd

func (m *MsgCallOnOpposite) Cmd() string

func (*MsgCallOnOpposite) Raw

func (m *MsgCallOnOpposite) Raw() []byte

type MsgComboSend

type MsgComboSend struct {
	// contains filtered or unexported fields
}

MsgComboSend 连击礼物

func (*MsgComboSend) Cmd

func (m *MsgComboSend) Cmd() string

func (*MsgComboSend) Raw

func (m *MsgComboSend) Raw() []byte

type MsgCutOff

type MsgCutOff struct {
	// contains filtered or unexported fields
}

MsgCutOff 被超管切断

func (*MsgCutOff) Cmd

func (m *MsgCutOff) Cmd() string

func (*MsgCutOff) Raw

func (m *MsgCutOff) Raw() []byte

type MsgDanmaku

type MsgDanmaku struct {
	// contains filtered or unexported fields
}

MsgDanmaku 弹幕消息

func (*MsgDanmaku) Cmd

func (m *MsgDanmaku) Cmd() string

func (*MsgDanmaku) Parse

func (m *MsgDanmaku) Parse() (*Danmaku, error)

func (*MsgDanmaku) Raw

func (m *MsgDanmaku) Raw() []byte

type MsgEntryEffect

type MsgEntryEffect struct {
	// contains filtered or unexported fields
}

MsgEntryEffect 舰长、高能榜、老爷进入

func (*MsgEntryEffect) Cmd

func (m *MsgEntryEffect) Cmd() string

func (*MsgEntryEffect) Raw

func (m *MsgEntryEffect) Raw() []byte

type MsgFansUpdate

type MsgFansUpdate struct {
	// contains filtered or unexported fields
}

MsgFansUpdate 粉丝数量改变

func (*MsgFansUpdate) Cmd

func (m *MsgFansUpdate) Cmd() string

func (*MsgFansUpdate) Parse

func (m *MsgFansUpdate) Parse() (*FansUpdate, error)

func (*MsgFansUpdate) Raw

func (m *MsgFansUpdate) Raw() []byte

type MsgGeneral

type MsgGeneral struct {
	// contains filtered or unexported fields
}

func (*MsgGeneral) Cmd

func (m *MsgGeneral) Cmd() string

func (*MsgGeneral) Raw

func (m *MsgGeneral) Raw() []byte

type MsgGuardBuy

type MsgGuardBuy struct {
	// contains filtered or unexported fields
}

MsgGuardBuy 用户上舰长

func (*MsgGuardBuy) Cmd

func (m *MsgGuardBuy) Cmd() string

func (*MsgGuardBuy) Parse

func (m *MsgGuardBuy) Parse() (*GuardBuy, error)

func (*MsgGuardBuy) Raw

func (m *MsgGuardBuy) Raw() []byte

type MsgGuardMsg

type MsgGuardMsg struct {
	// contains filtered or unexported fields
}

MsgGuardMsg 舰长消息

func (*MsgGuardMsg) Cmd

func (m *MsgGuardMsg) Cmd() string

func (*MsgGuardMsg) Raw

func (m *MsgGuardMsg) Raw() []byte

type MsgHeartbeatReply

type MsgHeartbeatReply struct {
	// contains filtered or unexported fields
}

func (*MsgHeartbeatReply) Cmd

func (m *MsgHeartbeatReply) Cmd() string

func (*MsgHeartbeatReply) GetHot

func (m *MsgHeartbeatReply) GetHot() int

func (*MsgHeartbeatReply) Raw

func (m *MsgHeartbeatReply) Raw() []byte

type MsgHotRank

type MsgHotRank struct {
	// contains filtered or unexported fields
}

MsgHotRank 热门榜xx榜topX

func (*MsgHotRank) Cmd

func (m *MsgHotRank) Cmd() string

func (*MsgHotRank) Raw

func (m *MsgHotRank) Raw() []byte

type MsgHotRankChanged

type MsgHotRankChanged struct {
	// contains filtered or unexported fields
}

MsgHotRankChanged 热门榜改变

func (*MsgHotRankChanged) Cmd

func (m *MsgHotRankChanged) Cmd() string

func (*MsgHotRankChanged) Parse

func (m *MsgHotRankChanged) Parse() (*HotRankChanged, error)

func (*MsgHotRankChanged) Raw

func (m *MsgHotRankChanged) Raw() []byte

type MsgHotRankSettlement

type MsgHotRankSettlement struct {
	// contains filtered or unexported fields
}

MsgHotRankSettlement 荣登热门榜topX

func (*MsgHotRankSettlement) Cmd

func (m *MsgHotRankSettlement) Cmd() string

func (*MsgHotRankSettlement) Parse

func (*MsgHotRankSettlement) Raw

func (m *MsgHotRankSettlement) Raw() []byte

type MsgHotRoomNotify

type MsgHotRoomNotify struct {
	// contains filtered or unexported fields
}

func (*MsgHotRoomNotify) Cmd

func (m *MsgHotRoomNotify) Cmd() string

func (*MsgHotRoomNotify) Raw

func (m *MsgHotRoomNotify) Raw() []byte

type MsgInteractWord

type MsgInteractWord struct {
	// contains filtered or unexported fields
}

MsgInteractWord 用户进入直播间

func (*MsgInteractWord) Cmd

func (m *MsgInteractWord) Cmd() string

func (*MsgInteractWord) Parse added in v0.1.1

func (m *MsgInteractWord) Parse() (*InteractWord, error)

func (*MsgInteractWord) Raw

func (m *MsgInteractWord) Raw() []byte

type MsgLive

type MsgLive struct {
	// contains filtered or unexported fields
}

MsgLive 开播

func (*MsgLive) Cmd

func (m *MsgLive) Cmd() string

func (*MsgLive) Raw

func (m *MsgLive) Raw() []byte

type MsgLiveInteractiveGame

type MsgLiveInteractiveGame struct {
	// contains filtered or unexported fields
}

func (*MsgLiveInteractiveGame) Cmd

func (m *MsgLiveInteractiveGame) Cmd() string

func (*MsgLiveInteractiveGame) Raw

func (m *MsgLiveInteractiveGame) Raw() []byte

type MsgNewGuardCount

type MsgNewGuardCount struct {
	// contains filtered or unexported fields
}

MsgNewGuardCount 船员数量改变事件

func (*MsgNewGuardCount) Cmd

func (m *MsgNewGuardCount) Cmd() string

func (*MsgNewGuardCount) Raw

func (m *MsgNewGuardCount) Raw() []byte

type MsgNoticeMsg

type MsgNoticeMsg struct {
	// contains filtered or unexported fields
}

MsgNoticeMsg 广播消息(别的直播间投递高价礼物对所有直播间发起的广播)

func (*MsgNoticeMsg) Cmd

func (m *MsgNoticeMsg) Cmd() string

func (*MsgNoticeMsg) Parse

func (m *MsgNoticeMsg) Parse() (*NoticeMsg, error)

func (*MsgNoticeMsg) Raw

func (m *MsgNoticeMsg) Raw() []byte

type MsgOnlineRankCount

type MsgOnlineRankCount struct {
	// contains filtered or unexported fields
}

MsgOnlineRankCount 高能榜数量更新

func (*MsgOnlineRankCount) Cmd

func (m *MsgOnlineRankCount) Cmd() string

func (*MsgOnlineRankCount) GetCount

func (m *MsgOnlineRankCount) GetCount() int

func (*MsgOnlineRankCount) Raw

func (m *MsgOnlineRankCount) Raw() []byte

type MsgOnlineRankTop3

type MsgOnlineRankTop3 struct {
	// contains filtered or unexported fields
}

MsgOnlineRankTop3 高能榜TOP3改变

func (*MsgOnlineRankTop3) Cmd

func (m *MsgOnlineRankTop3) Cmd() string

func (*MsgOnlineRankTop3) Parse

func (m *MsgOnlineRankTop3) Parse() (*OnlineRankTop3, error)

func (*MsgOnlineRankTop3) Raw

func (m *MsgOnlineRankTop3) Raw() []byte

type MsgOnlineRankV2

type MsgOnlineRankV2 struct {
	// contains filtered or unexported fields
}

MsgOnlineRankV2 高能榜数据

func (*MsgOnlineRankV2) Cmd

func (m *MsgOnlineRankV2) Cmd() string

func (*MsgOnlineRankV2) Parse

func (m *MsgOnlineRankV2) Parse() (*OnlineRankV2, error)

func (*MsgOnlineRankV2) Raw

func (m *MsgOnlineRankV2) Raw() []byte

type MsgPkAttention

type MsgPkAttention struct {
	// contains filtered or unexported fields
}

MsgPkAttention 对面新增关注

func (*MsgPkAttention) Cmd

func (m *MsgPkAttention) Cmd() string

func (*MsgPkAttention) Raw

func (m *MsgPkAttention) Raw() []byte

type MsgPkBattleEnd

type MsgPkBattleEnd struct {
	// contains filtered or unexported fields
}

MsgPkBattleEnd 大乱斗结束

func (*MsgPkBattleEnd) Cmd

func (m *MsgPkBattleEnd) Cmd() string

func (*MsgPkBattleEnd) Raw

func (m *MsgPkBattleEnd) Raw() []byte

type MsgPkBattlePre

type MsgPkBattlePre struct {
	// contains filtered or unexported fields
}

MsgPkBattlePre 大乱斗准备,10秒后开始

func (*MsgPkBattlePre) Cmd

func (m *MsgPkBattlePre) Cmd() string

func (*MsgPkBattlePre) Raw

func (m *MsgPkBattlePre) Raw() []byte

type MsgPkBattleProcess

type MsgPkBattleProcess struct {
	// contains filtered or unexported fields
}

MsgPkBattleProcess 大乱斗双方送礼

func (*MsgPkBattleProcess) Cmd

func (m *MsgPkBattleProcess) Cmd() string

func (*MsgPkBattleProcess) Raw

func (m *MsgPkBattleProcess) Raw() []byte

type MsgPkBattleSettle

type MsgPkBattleSettle struct {
	// contains filtered or unexported fields
}

func (*MsgPkBattleSettle) Cmd

func (m *MsgPkBattleSettle) Cmd() string

func (*MsgPkBattleSettle) Raw

func (m *MsgPkBattleSettle) Raw() []byte

type MsgPkBattleSettleUser

type MsgPkBattleSettleUser struct {
	// contains filtered or unexported fields
}

func (*MsgPkBattleSettleUser) Cmd

func (m *MsgPkBattleSettleUser) Cmd() string

func (*MsgPkBattleSettleUser) Raw

func (m *MsgPkBattleSettleUser) Raw() []byte

type MsgPkBattleSettleV2

type MsgPkBattleSettleV2 struct {
	// contains filtered or unexported fields
}

func (*MsgPkBattleSettleV2) Cmd

func (m *MsgPkBattleSettleV2) Cmd() string

func (*MsgPkBattleSettleV2) Raw

func (m *MsgPkBattleSettleV2) Raw() []byte

type MsgPkBattleStart

type MsgPkBattleStart struct {
	// contains filtered or unexported fields
}

MsgPkBattleStart 大乱斗开始

func (*MsgPkBattleStart) Cmd

func (m *MsgPkBattleStart) Cmd() string

func (*MsgPkBattleStart) Raw

func (m *MsgPkBattleStart) Raw() []byte

type MsgPkBestUname

type MsgPkBestUname struct {
	// contains filtered or unexported fields
}

MsgPkBestUname PK最佳助攻

func (*MsgPkBestUname) Cmd

func (m *MsgPkBestUname) Cmd() string

func (*MsgPkBestUname) Raw

func (m *MsgPkBestUname) Raw() []byte

type MsgPkDanmuMsg

type MsgPkDanmuMsg struct {
	// contains filtered or unexported fields
}

MsgPkDanmuMsg 对面的弹幕消息

func (*MsgPkDanmuMsg) Cmd

func (m *MsgPkDanmuMsg) Cmd() string

func (*MsgPkDanmuMsg) Raw

func (m *MsgPkDanmuMsg) Raw() []byte

type MsgPkEnd

type MsgPkEnd struct {
	// contains filtered or unexported fields
}

MsgPkEnd PK判断胜负

func (*MsgPkEnd) Cmd

func (m *MsgPkEnd) Cmd() string

func (*MsgPkEnd) Raw

func (m *MsgPkEnd) Raw() []byte

type MsgPkEnding

type MsgPkEnding struct {
	// contains filtered or unexported fields
}

MsgPkEnding 大乱斗尾声,最后几秒

func (*MsgPkEnding) Cmd

func (m *MsgPkEnding) Cmd() string

func (*MsgPkEnding) Raw

func (m *MsgPkEnding) Raw() []byte

type MsgPkInteractWord

type MsgPkInteractWord struct {
	// contains filtered or unexported fields
}

MsgPkInteractWord 对面的用户进入

func (*MsgPkInteractWord) Cmd

func (m *MsgPkInteractWord) Cmd() string

func (*MsgPkInteractWord) Raw

func (m *MsgPkInteractWord) Raw() []byte

type MsgPkLotteryStart

type MsgPkLotteryStart struct {
	// contains filtered or unexported fields
}

MsgPkLotteryStart 大乱斗胜利后的抽奖

func (*MsgPkLotteryStart) Cmd

func (m *MsgPkLotteryStart) Cmd() string

func (*MsgPkLotteryStart) Raw

func (m *MsgPkLotteryStart) Raw() []byte

type MsgPkMatchInfo

type MsgPkMatchInfo struct {
	// contains filtered or unexported fields
}

MsgPkMatchInfo 获取对面直播间信息

func (*MsgPkMatchInfo) Cmd

func (m *MsgPkMatchInfo) Cmd() string

func (*MsgPkMatchInfo) Raw

func (m *MsgPkMatchInfo) Raw() []byte

type MsgPkMatchOnlineGuard

type MsgPkMatchOnlineGuard struct {
	// contains filtered or unexported fields
}

MsgPkMatchOnlineGuard 获取对面直播间舰长在线人数

func (*MsgPkMatchOnlineGuard) Cmd

func (m *MsgPkMatchOnlineGuard) Cmd() string

func (*MsgPkMatchOnlineGuard) Raw

func (m *MsgPkMatchOnlineGuard) Raw() []byte

type MsgPkMicEnd

type MsgPkMicEnd struct {
	// contains filtered or unexported fields
}

func (*MsgPkMicEnd) Cmd

func (m *MsgPkMicEnd) Cmd() string

func (*MsgPkMicEnd) Raw

func (m *MsgPkMicEnd) Raw() []byte

type MsgPkPre

type MsgPkPre struct {
	// contains filtered or unexported fields
}

func (*MsgPkPre) Cmd

func (m *MsgPkPre) Cmd() string

func (*MsgPkPre) Raw

func (m *MsgPkPre) Raw() []byte

type MsgPkSendGift

type MsgPkSendGift struct {
	// contains filtered or unexported fields
}

MsgPkSendGift 对面的礼物消息

func (*MsgPkSendGift) Cmd

func (m *MsgPkSendGift) Cmd() string

func (*MsgPkSendGift) Raw

func (m *MsgPkSendGift) Raw() []byte

type MsgPkSettle

type MsgPkSettle struct {
	// contains filtered or unexported fields
}

func (*MsgPkSettle) Cmd

func (m *MsgPkSettle) Cmd() string

func (*MsgPkSettle) Raw

func (m *MsgPkSettle) Raw() []byte

type MsgPkShare

type MsgPkShare struct {
	// contains filtered or unexported fields
}

MsgPkShare 对面有人分享直播间

func (*MsgPkShare) Cmd

func (m *MsgPkShare) Cmd() string

func (*MsgPkShare) Raw

func (m *MsgPkShare) Raw() []byte

type MsgPkWinningStreak

type MsgPkWinningStreak struct {
	// contains filtered or unexported fields
}

MsgPkWinningStreak 大乱斗连胜事件

func (*MsgPkWinningStreak) Cmd

func (m *MsgPkWinningStreak) Cmd() string

func (*MsgPkWinningStreak) Raw

func (m *MsgPkWinningStreak) Raw() []byte

type MsgPlayProgressBar

type MsgPlayProgressBar struct {
	// contains filtered or unexported fields
}

func (*MsgPlayProgressBar) Cmd

func (m *MsgPlayProgressBar) Cmd() string

func (*MsgPlayProgressBar) Raw

func (m *MsgPlayProgressBar) Raw() []byte

type MsgPlayTag

type MsgPlayTag struct {
	// contains filtered or unexported fields
}

func (*MsgPlayTag) Cmd

func (m *MsgPlayTag) Cmd() string

func (*MsgPlayTag) Raw

func (m *MsgPlayTag) Raw() []byte

type MsgPreparing

type MsgPreparing struct {
	// contains filtered or unexported fields
}

MsgPreparing 下播

func (*MsgPreparing) Cmd

func (m *MsgPreparing) Cmd() string

func (*MsgPreparing) Raw

func (m *MsgPreparing) Raw() []byte

type MsgRefresh

type MsgRefresh struct {
	// contains filtered or unexported fields
}

func (*MsgRefresh) Cmd

func (m *MsgRefresh) Cmd() string

func (*MsgRefresh) Raw

func (m *MsgRefresh) Raw() []byte

type MsgRoomAdmins

type MsgRoomAdmins struct {
	// contains filtered or unexported fields
}

MsgRoomAdmins 房管数量改变

func (*MsgRoomAdmins) Cmd

func (m *MsgRoomAdmins) Cmd() string

func (*MsgRoomAdmins) Raw

func (m *MsgRoomAdmins) Raw() []byte

type MsgRoomBlockMsg

type MsgRoomBlockMsg struct {
	// contains filtered or unexported fields
}

MsgRoomBlockMsg 用户被禁言

func (*MsgRoomBlockMsg) Cmd

func (m *MsgRoomBlockMsg) Cmd() string

func (*MsgRoomBlockMsg) Parse

func (m *MsgRoomBlockMsg) Parse() (*RoomBlockMsg, error)

func (*MsgRoomBlockMsg) Raw

func (m *MsgRoomBlockMsg) Raw() []byte

type MsgRoomChange

type MsgRoomChange struct {
	// contains filtered or unexported fields
}

MsgRoomChange 房间信息改变

func (*MsgRoomChange) Cmd

func (m *MsgRoomChange) Cmd() string

func (*MsgRoomChange) Parse

func (m *MsgRoomChange) Parse() (*RoomChange, error)

func (*MsgRoomChange) Raw

func (m *MsgRoomChange) Raw() []byte

type MsgRoomLimit

type MsgRoomLimit struct {
	// contains filtered or unexported fields
}

func (*MsgRoomLimit) Cmd

func (m *MsgRoomLimit) Cmd() string

func (*MsgRoomLimit) Raw

func (m *MsgRoomLimit) Raw() []byte

type MsgRoomRank

type MsgRoomRank struct {
	// contains filtered or unexported fields
}

MsgRoomRank 排名改变

func (*MsgRoomRank) Cmd

func (m *MsgRoomRank) Cmd() string

func (*MsgRoomRank) Raw

func (m *MsgRoomRank) Raw() []byte

type MsgRound

type MsgRound struct {
	// contains filtered or unexported fields
}

func (*MsgRound) Cmd

func (m *MsgRound) Cmd() string

func (*MsgRound) Raw

func (m *MsgRound) Raw() []byte

type MsgSendGift

type MsgSendGift struct {
	// contains filtered or unexported fields
}

MsgSendGift 投喂礼物

func (*MsgSendGift) Cmd

func (m *MsgSendGift) Cmd() string

func (*MsgSendGift) Parse

func (m *MsgSendGift) Parse() (*SendGift, error)

func (*MsgSendGift) Raw

func (m *MsgSendGift) Raw() []byte

type MsgShare

type MsgShare struct {
	// contains filtered or unexported fields
}

MsgShare 用户分享直播间

func (*MsgShare) Cmd

func (m *MsgShare) Cmd() string

func (*MsgShare) Raw

func (m *MsgShare) Raw() []byte

type MsgShareOpposite

type MsgShareOpposite struct {
	// contains filtered or unexported fields
}

MsgShareOpposite 本直播间观众分享了对面直播间

func (*MsgShareOpposite) Cmd

func (m *MsgShareOpposite) Cmd() string

func (*MsgShareOpposite) Raw

func (m *MsgShareOpposite) Raw() []byte

type MsgSpecialAttention

type MsgSpecialAttention struct {
	// contains filtered or unexported fields
}

MsgSpecialAttention 特别关注直播间

func (*MsgSpecialAttention) Cmd

func (m *MsgSpecialAttention) Cmd() string

func (*MsgSpecialAttention) Raw

func (m *MsgSpecialAttention) Raw() []byte

type MsgSpecialGift

type MsgSpecialGift struct {
	// contains filtered or unexported fields
}

MsgSpecialGift 节奏风暴

func (*MsgSpecialGift) Cmd

func (m *MsgSpecialGift) Cmd() string

func (*MsgSpecialGift) Raw

func (m *MsgSpecialGift) Raw() []byte

type MsgStopLiveRoomList

type MsgStopLiveRoomList struct {
	// contains filtered or unexported fields
}

MsgStopLiveRoomList 刚刚停止了直播的直播间

func (*MsgStopLiveRoomList) Cmd

func (m *MsgStopLiveRoomList) Cmd() string

func (*MsgStopLiveRoomList) GetList

func (m *MsgStopLiveRoomList) GetList() ([]int64, error)

GetList 返回停播直播间号数组

func (*MsgStopLiveRoomList) Raw

func (m *MsgStopLiveRoomList) Raw() []byte

type MsgSuperChatMessage

type MsgSuperChatMessage struct {
	// contains filtered or unexported fields
}

MsgSuperChatMessage 醒目留言

func (*MsgSuperChatMessage) Cmd

func (m *MsgSuperChatMessage) Cmd() string

func (*MsgSuperChatMessage) Parse

func (*MsgSuperChatMessage) Raw

func (m *MsgSuperChatMessage) Raw() []byte

type MsgSuperChatMessageDelete

type MsgSuperChatMessageDelete struct {
	// contains filtered or unexported fields
}

MsgSuperChatMessageDelete 删除醒目留言 (似乎有时候并不会发,同时结束时间在 CmdSuperChatMessage 可以获取)

func (*MsgSuperChatMessageDelete) Cmd

func (*MsgSuperChatMessageDelete) GetList

func (m *MsgSuperChatMessageDelete) GetList() ([]int64, error)

GetList 返回id数组

func (*MsgSuperChatMessageDelete) Raw

func (m *MsgSuperChatMessageDelete) Raw() []byte

type MsgSuperChatMessageJPN

type MsgSuperChatMessageJPN struct {
	// contains filtered or unexported fields
}

MsgSuperChatMessageJPN 醒目留言日文翻译?

func (*MsgSuperChatMessageJPN) Cmd

func (m *MsgSuperChatMessageJPN) Cmd() string

func (*MsgSuperChatMessageJPN) Parse

func (*MsgSuperChatMessageJPN) Raw

func (m *MsgSuperChatMessageJPN) Raw() []byte

type MsgSysGift

type MsgSysGift struct {
	// contains filtered or unexported fields
}

func (*MsgSysGift) Cmd

func (m *MsgSysGift) Cmd() string

func (*MsgSysGift) Raw

func (m *MsgSysGift) Raw() []byte

type MsgSysMsg

type MsgSysMsg struct {
	// contains filtered or unexported fields
}

func (*MsgSysMsg) Cmd

func (m *MsgSysMsg) Cmd() string

func (*MsgSysMsg) Raw

func (m *MsgSysMsg) Raw() []byte

type MsgUserToastMsg

type MsgUserToastMsg struct {
	// contains filtered or unexported fields
}

MsgUserToastMsg 上船附带的通知

func (*MsgUserToastMsg) Cmd

func (m *MsgUserToastMsg) Cmd() string

func (*MsgUserToastMsg) Parse

func (m *MsgUserToastMsg) Parse() (*UserToastMsg, error)

func (*MsgUserToastMsg) Raw

func (m *MsgUserToastMsg) Raw() []byte

type MsgVoiceJoinList

type MsgVoiceJoinList struct {
	// contains filtered or unexported fields
}

MsgVoiceJoinList 连麦申请、取消连麦申请

func (*MsgVoiceJoinList) Cmd

func (m *MsgVoiceJoinList) Cmd() string

func (*MsgVoiceJoinList) Parse

func (m *MsgVoiceJoinList) Parse() (*VoiceJoinList, error)

func (*MsgVoiceJoinList) Raw

func (m *MsgVoiceJoinList) Raw() []byte

type MsgVoiceJoinRoomCountInfo

type MsgVoiceJoinRoomCountInfo struct {
	// contains filtered or unexported fields
}

MsgVoiceJoinRoomCountInfo 申请连麦队列变化

func (*MsgVoiceJoinRoomCountInfo) Cmd

func (*MsgVoiceJoinRoomCountInfo) Parse

func (*MsgVoiceJoinRoomCountInfo) Raw

func (m *MsgVoiceJoinRoomCountInfo) Raw() []byte

type MsgVoiceJoinStatus

type MsgVoiceJoinStatus struct {
	// contains filtered or unexported fields
}

MsgVoiceJoinStatus 开始连麦、结束连麦

func (*MsgVoiceJoinStatus) Cmd

func (m *MsgVoiceJoinStatus) Cmd() string

func (*MsgVoiceJoinStatus) Raw

func (m *MsgVoiceJoinStatus) Raw() []byte

type MsgWatChed added in v0.1.3

type MsgWatChed struct {
	// contains filtered or unexported fields
}

MsgWatChed 直播间看过人数变化

func (*MsgWatChed) Cmd added in v0.1.3

func (m *MsgWatChed) Cmd() string

func (*MsgWatChed) Parse added in v0.1.3

func (m *MsgWatChed) Parse() (*WatChed, error)

func (*MsgWatChed) Raw added in v0.1.3

func (m *MsgWatChed) Raw() []byte

type MsgWelcome

type MsgWelcome struct {
	// contains filtered or unexported fields
}

MsgWelcome 欢迎进入房间(似乎已废弃)

func (*MsgWelcome) Cmd

func (m *MsgWelcome) Cmd() string

func (*MsgWelcome) Raw

func (m *MsgWelcome) Raw() []byte

type MsgWelcomeGuard

type MsgWelcomeGuard struct {
	// contains filtered or unexported fields
}

func (*MsgWelcomeGuard) Cmd

func (m *MsgWelcomeGuard) Cmd() string

func (*MsgWelcomeGuard) Raw

func (m *MsgWelcomeGuard) Raw() []byte

type NoticeMsg

type NoticeMsg struct {
	BusinessID string `json:"business_id"`
	Full       struct {
		HeadIcon    string `json:"head_icon"`
		TailIcon    string `json:"tail_icon"`
		HeadIconFa  string `json:"head_icon_fa"`
		TailIconFa  string `json:"tail_icon_fa"`
		Background  string `json:"background"`
		Highlight   string `json:"highlight"`
		HeadIconFan int    `json:"head_icon_fan"`
		TailIconFan int    `json:"tail_icon_fan"`
		Color       string `json:"color"`
		Time        int64  `json:"time"`
	} `json:"full"`
	Half struct {
		Time       int64  `json:"time"`
		HeadIcon   string `json:"head_icon"`
		TailIcon   string `json:"tail_icon"`
		Background string `json:"background"`
		Color      string `json:"color"`
		Highlight  string `json:"highlight"`
	} `json:"half"`
	ID         int64  `json:"id"`
	LinkUrl    string `json:"link_url"`
	MsgCommon  string `json:"msg_common"`
	MsgSelf    string `json:"msg_self"`
	MsgType    int    `json:"msg_type"`
	Name       string `json:"name"`
	RealRoomID int64  `json:"real_roomid"`
	RoomID     int64  `json:"roomid"`
	Scatter    struct {
		Min int `json:"min"`
		Max int `json:"max"`
	} `json:"scatter"`
	ShieldUID int64 `json:"shield_uid"`
	Side      struct {
		HeadIcon   string `json:"head_icon"`
		Background string `json:"background"`
		Color      string `json:"color"`
		Highlight  string `json:"highlight"`
		Border     string `json:"border"`
	} `json:"side"`
}
{
	"cmd": "NOTICE_MSG",
	"business_id": "31087",
	"full": {
		"head_icon": "http://i0.hdslb.com/bfs/live/00f26756182b2e9d06c00af23001bc8e10da67d0.webp",
		"tail_icon": "http://i0.hdslb.com/bfs/live/822da481fdaba986d738db5d8fd469ffa95a8fa1.webp",
		"head_icon_fa": "http://i0.hdslb.com/bfs/live/77983005023dc3f31cd599b637c83a764c842f87.png",
		"tail_icon_fa": "http://i0.hdslb.com/bfs/live/38cb2a9f1209b16c0f15162b0b553e3b28d9f16f.png",
		"background": "#6098FFFF",
		"highlight": "#FDFF2FFF",
		"head_icon_fan": 36,
		"tail_icon_fan": 4,
		"color": "#FFFFFFFF",
		"time": 20
	},
	"half": {
		"time": 15,
		"head_icon": "http://i0.hdslb.com/bfs/live/358cc52e974b315e83eee429858de4fee97a1ef5.png",
		"tail_icon": "",
		"background": "#7BB6F2FF",
		"color": "#FFFFFFFF",
		"highlight": "#FDFF2FFF"
	},
	"id": 2,
	"link_url": "https://live.bilibili.com/5655865?accept_quality=%5B10000%2C150%5D&broadcast_type=0&current_qn=150&current_quality=150&is_room_feed=1&live_play_network=other&p2p_type=-2&playurl_h264=http%3A%2F%2Fd1--cn-gotcha03.bilivideo.com%2Flive-bvc%2F429443%2Flive_2257663_5953069_1500.flv%3Fexpires%3D1635753433%26len%3D0%26oi%3D0%26pt%3D%26qn%3D150%26trid%3D10004aaecf5169e74b51b5932933468e0364%26sigparams%3Dcdn%2Cexpires%2Clen%2Coi%2Cpt%2Cqn%2Ctrid%26cdn%3Dcn-gotcha03%26sign%3De0b8728896efe026833d99655b05c084%26p2p_type%3D4294967294%26src%3D5%26sl%3D1%26flowtype%3D1%26source%3Dbatch%26order%3D1%26machinezone%3Dylf%26sk%3D2935686d6cb9146c7a6a6a0b4e120e2594e074fa0760377f1a7a2b2fa0ee6443&playurl_h265=&quality_description=%5B%7B%22qn%22%3A10000%2C%22desc%22%3A%22%E5%8E%9F%E7%94%BB%22%7D%2C%7B%22qn%22%3A150%2C%22desc%22%3A%22%E9%AB%98%E6%B8%85%22%7D%5D&from=28003&extra_jump_from=28003&live_lottery_type=1",
	"msg_common": "<%JamesTuT%>投喂:<%木之本切%>1个次元之城,点击前往TA的房间吧!",
	"msg_self": "<%JamesTuT%>投喂:<%木之本切%>1个次元之城,快来围观吧!",
	"msg_type": 2,
	"name": "分区道具抽奖广播样式",
	"real_roomid": 5655865,
	"roomid": 5655865,
	"scatter": {
		"min": 0,
		"max": 0
	},
	"shield_uid": -1,
	"side": {
		"head_icon": "",
		"background": "",
		"color": "",
		"highlight": "",
		"border": ""
	}
}

type OnlineRankTop3

type OnlineRankTop3 struct {
	DmScore int `json:"dmscore"`
	List    []struct {
		Msg  string `json:"msg"`
		Rank int    `json:"rank"`
	} `json:"list"`
}
{
  "dmscore": 112,
  "list": [
	{
	  "msg": "恭喜 <%你们有多腐%> 成为高能榜",
	  "rank": 2
	}
  ]
}

type OnlineRankV2

type OnlineRankV2 struct {
	List []struct {
		GuardLevel int    `json:"guard_level"` // 3:舰长 2:提督 1:总督?
		UID        int64  `json:"uid"`
		Face       string `json:"face"`
		Score      string `json:"score"`
		Uname      string `json:"uname"`
		Rank       int    `json:"rank"`
	} `json:"list"`
	RankType string `json:"rank_type"`
}
{
  "list": [
	{
	  "guard_level": 2,
	  "uid": 277278853,
	  "face": "http://i1.hdslb.com/bfs/face/59839130848b8f8d99f8c649f7897ac7f406a052.jpg",
	  "score": "15980",
	  "uname": "勤俭持家的席撒",
	  "rank": 1
	},
	{
	  "uid": 12777723,
	  "face": "http://i0.hdslb.com/bfs/face/6badd87b9bf8c13c90fcb2c2b1b93b01e4b02664.jpg",
	  "score": "2500",
	  "uname": "卡纸哥我宣你",
	  "rank": 2,
	  "guard_level": 2
	},
	{
	  "uid": 19229891,
	  "face": "http://i2.hdslb.com/bfs/face/3925926f11983d7c2e1736e429aa171761493040.jpg",
	  "score": "1580",
	  "uname": "大象12183",
	  "rank": 3,
	  "guard_level": 3
	},
	{
	  "rank": 4,
	  "guard_level": 3,
	  "uid": 271376887,
	  "face": "http://i1.hdslb.com/bfs/face/84ef7024aef33ad5d790494130c4081e3a872169.jpg",
	  "score": "1380",
	  "uname": "w蓄意轰拳w"
	},
	{
	  "face": "http://i0.hdslb.com/bfs/face/b0d4640c49ef04f630b103edbec1a277b912fbe1.jpg",
	  "score": "1000",
	  "uname": "Dys莫的命",
	  "rank": 5,
	  "guard_level": 3,
	  "uid": 16495374
	},
	{
	  "uid": 601557387,
	  "face": "http://i0.hdslb.com/bfs/face/e5cb2f45e257f337c756521bd73c56814443c8c0.jpg",
	  "score": "1000",
	  "uname": "秃了送",
	  "rank": 6,
	  "guard_level": 3
	},
	{
	  "guard_level": 3,
	  "uid": 143379249,
	  "face": "http://i0.hdslb.com/bfs/face/1d581ce73feb42a6d73839047d781c434652195b.jpg",
	  "score": "1000",
	  "uname": "小泉水噗噗",
	  "rank": 7
	}
  ],
  "rank_type": "gold-rank"
}

type RoomBlockMsg

type RoomBlockMsg struct {
	Uname    string `json:"uname"`
	DmScore  int    `json:"dmscore"`
	Operator int    `json:"operator"`
	UID      int    `json:"uid"`
}
{
  "uname": "白绫彡",
  "dmscore": 30,
  "operator": 1,
  "uid": 53342046
}

type RoomChange

type RoomChange struct {
	ParentAreaID   int    `json:"parent_area_id"`
	AreaName       string `json:"area_name"`
	ParentAreaName string `json:"parent_area_name"`
	LiveKey        string `json:"live_key"`
	SubSessionKey  string `json:"sub_session_key"`
	Title          string `json:"title"`
	AreaID         int    `json:"area_id"`
}
{
  "parent_area_id": 3,
  "area_name": "原神",
  "parent_area_name": "手游",
  "live_key": "181443822587250220",
  "sub_session_key": "181443822587250220sub_time:1635846195",
  "title": "快来直播间抽胡桃!托马!烈火拔刀!",
  "area_id": 321
}

type SendGift

type SendGift struct {
	Action         string `json:"action"`
	BatchComboID   string `json:"batch_combo_id"`
	BatchComboSend struct {
		Action        string      `json:"action"`
		BatchComboID  string      `json:"batch_combo_id"`
		BatchComboNum int         `json:"batch_combo_num"`
		BlindGift     interface{} `json:"blind_gift"`
		GiftID        int64       `json:"gift_id"`
		GiftName      string      `json:"gift_name"`
		GiftNum       int         `json:"gift_num"`
		SendMaster    interface{} `json:"send_master"`
		Uid           int         `json:"uid"`
		Uname         string      `json:"uname"`
	} `json:"batch_combo_send"`
	BeatID           string      `json:"beatId"`
	BizSource        string      `json:"biz_source"`
	BlindGift        interface{} `json:"blind_gift"`
	BroadcastID      int64       `json:"broadcast_id"`
	CoinType         string      `json:"coin_type"`
	ComboResourcesID int64       `json:"combo_resources_id"`
	ComboSend        struct {
		Action     string      `json:"action"`
		ComboID    string      `json:"combo_id"`
		ComboNum   int         `json:"combo_num"`
		GiftID     int64       `json:"gift_id"`
		GiftName   string      `json:"gift_name"`
		GiftNum    int         `json:"gift_num"`
		SendMaster interface{} `json:"send_master"`
		UID        int64       `json:"uid"`
		Uname      string      `json:"uname"`
	} `json:"combo_send"`
	ComboStayTime     int64   `json:"combo_stay_time"`
	ComboTotalCoin    int     `json:"combo_total_coin"`
	CritProb          int     `json:"crit_prob"`
	Demarcation       int     `json:"demarcation"`
	DiscountPrice     int     `json:"discount_price"`
	Dmscore           int     `json:"dmscore"`
	Draw              int     `json:"draw"`
	Effect            int     `json:"effect"`
	EffectBlock       int     `json:"effect_block"`
	Face              string  `json:"face"`
	FloatScResourceID int64   `json:"float_sc_resource_id"`
	GiftID            int64   `json:"giftId"`
	GiftName          string  `json:"giftName"`
	GiftType          int     `json:"giftType"`
	Gold              int     `json:"gold"`
	GuardLevel        int     `json:"guard_level"`
	IsFirst           bool    `json:"is_first"`
	IsSpecialBatch    int     `json:"is_special_batch"`
	Magnification     float64 `json:"magnification"`
	MedalInfo         struct {
		AnchorRoomid     int    `json:"anchor_roomid"`
		AnchorUname      string `json:"anchor_uname"`
		GuardLevel       int    `json:"guard_level"`
		IconID           int64  `json:"icon_id"`
		IsLighted        int    `json:"is_lighted"`
		MedalColor       int    `json:"medal_color"`
		MedalColorBorder int64  `json:"medal_color_border"`
		MedalColorEnd    int64  `json:"medal_color_end"`
		MedalColorStart  int64  `json:"medal_color_start"`
		MedalLevel       int    `json:"medal_level"`
		MedalName        string `json:"medal_name"`
		Special          string `json:"special"`
		TargetID         int    `json:"target_id"`
	} `json:"medal_info"`
	NameColor         string      `json:"name_color"`
	Num               int         `json:"num"`
	OriginalGiftName  string      `json:"original_gift_name"`
	Price             int         `json:"price"`
	Rcost             int         `json:"rcost"`
	Remain            int         `json:"remain"`
	Rnd               string      `json:"rnd"`
	SendMaster        interface{} `json:"send_master"`
	Silver            int         `json:"silver"`
	Super             int         `json:"super"`
	SuperBatchGiftNum int         `json:"super_batch_gift_num"`
	SuperGiftNum      int         `json:"super_gift_num"`
	SvgaBlock         int         `json:"svga_block"`
	TagImage          string      `json:"tag_image"`
	TID               string      `json:"tid"`
	Timestamp         int64       `json:"timestamp"`
	TopList           interface{} `json:"top_list"`
	TotalCoin         int         `json:"total_coin"`
	UID               int64       `json:"uid"`
	Uname             string      `json:"uname"`
}

SendGift 部分interface{}抓取不到有效的信息,只能先留着

{
  "discount_price": 100,
  "giftName": "牛哇牛哇",
  "gold": 0,
  "guard_level": 0,
  "remain": 0,
  "silver": 0,
  "super_gift_num": 4,
  "top_list": null,
  "biz_source": "xlottery-anchor",
  "combo_total_coin": 400,
  "giftType": 0,
  "magnification": 1,
  "medal_info": {
	"medal_name": "吉祥草",
	"special": "",
	"anchor_roomid": 0,
	"anchor_uname": "",
	"medal_color_border": 6067854,
	"medal_color_end": 6067854,
	"medal_color_start": 6067854,
	"medal_level": 4,
	"target_id": 2920960,
	"guard_level": 0,
	"icon_id": 0,
	"is_lighted": 1,
	"medal_color": 6067854
  },
  "name_color": "",
  "price": 100,
  "super": 0,
  "tag_image": "",
  "total_coin": 100,
  "uname": "余烬的圆舞曲",
  "blind_gift": null,
  "rnd": "1635849011111500002",
  "action": "投喂",
  "broadcast_id": 0,
  "effect": 0,
  "giftId": 31039,
  "is_special_batch": 0,
  "tid": "1635849011111500002",
  "batch_combo_id": "batch:gift:combo_id:9184735:2920960:31039:1635849007.7560",
  "float_sc_resource_id": 0,
  "original_gift_name": "",
  "batch_combo_send": null,
  "is_first": false,
  "num": 1,
  "rcost": 189509940,
  "uid": 9184735,
  "beatId": "",
  "combo_send": null,
  "combo_stay_time": 3,
  "dmscore": 32,
  "svga_block": 0,
  "timestamp": 1635849011,
  "coin_type": "gold",
  "combo_resources_id": 1,
  "crit_prob": 0,
  "demarcation": 1,
  "draw": 0,
  "effect_block": 0,
  "face": "http://i1.hdslb.com/bfs/face/80cd97607e8ab30acc768047db37a17c9270ec76.jpg",
  "send_master": null,
  "super_batch_gift_num": 4
}

type SuperChatMessage

type SuperChatMessage struct {
	BackgroundBottomColor string `json:"background_bottom_color"`
	Token                 string `json:"token"`
	BackgroundColorEnd    string `json:"background_color_end"`
	BackgroundImage       string `json:"background_image"`
	BackgroundIcon        string `json:"background_icon"`
	BackgroundPriceColor  string `json:"background_price_color"`
	DmScore               int    `json:"dmscore"`
	ID                    int64  `json:"id"`
	UserInfo              struct {
		UserLevel  int    `json:"user_level"`
		FaceFrame  string `json:"face_frame"`
		GuardLevel int    `json:"guard_level"`
		LevelColor string `json:"level_color"`
		Manager    int    `json:"manager"`
		Uname      string `json:"uname"`
		Title      string `json:"title"`
		Face       string `json:"face"`
		IsMainVip  int    `json:"is_main_vip"`
		IsSvip     int    `json:"is_svip"`
		IsVip      int    `json:"is_vip"`
		NameColor  string `json:"name_color"`
	} `json:"user_info"`
	IsSendAudit     int     `json:"is_send_audit"`
	Price           int     `json:"price"`
	BackgroundColor string  `json:"background_color"`
	ColorPoint      float64 `json:"color_point"`
	Gift            struct {
		GiftID   int64  `json:"gift_id"`
		GiftName string `json:"gift_name"`
		Num      int    `json:"num"`
	} `json:"gift"`
	MedalInfo struct {
		TargetID         int64  `json:"target_id"`
		AnchorRoomid     int    `json:"anchor_roomid"`
		AnchorUname      string `json:"anchor_uname"`
		GuardLevel       int    `json:"guard_level"`
		MedalColor       string `json:"medal_color"`
		MedalColorEnd    int    `json:"medal_color_end"`
		MedalLevel       int    `json:"medal_level"`
		Special          string `json:"special"`
		IconID           int64  `json:"icon_id"`
		IsLighted        int    `json:"is_lighted"`
		MedalColorBorder int    `json:"medal_color_border"`
		MedalColorStart  int    `json:"medal_color_start"`
		MedalName        string `json:"medal_name"`
	} `json:"medal_info"`
	TransMark            int    `json:"trans_mark"`
	Ts                   int    `json:"ts"`
	BackgroundColorStart string `json:"background_color_start"`
	EndTime              int64  `json:"end_time"`
	MessageFontColor     string `json:"message_font_color"`
	Rate                 int    `json:"rate"`
	MessageTrans         string `json:"message_trans"`
	StartTime            int64  `json:"start_time"`
	IsRanked             int    `json:"is_ranked"`
	Message              string `json:"message"`
	Time                 int64  `json:"time"`
	UID                  int64  `json:"uid"`
}
{
  "background_bottom_color": "#427D9E",
  "token": "D22854F7",
  "background_color_end": "#29718B",
  "background_image": "https://i0.hdslb.com/bfs/live/a712efa5c6ebc67bafbe8352d3e74b820a00c13e.png",
  "background_icon": "",
  "background_price_color": "#7DA4BD",
  "dmscore": 128,
  "id": 2575658,
  "user_info": {
    "user_level": 20,
    "face_frame": "http://i0.hdslb.com/bfs/live/9b3cfee134611c61b71e38776c58ad67b253c40a.png",
    "guard_level": 2,
    "level_color": "#61c05a",
    "manager": 0,
    "uname": "卡纸哥我宣你",
    "title": "title-111-1",
    "face": "http://i0.hdslb.com/bfs/face/6badd87b9bf8c13c90fcb2c2b1b93b01e4b02664.jpg",
    "is_main_vip": 1,
    "is_svip": 0,
    "is_vip": 0,
    "name_color": "#E17AFF"
  },
  "is_send_audit": 1,
  "price": 50,
  "background_color": "#DBFFFD",
  "color_point": 0.7,
  "gift": {
    "gift_id": 12000,
    "gift_name": "醒目留言",
    "num": 1
  },
  "medal_info": {
    "target_id": 8739477,
    "anchor_roomid": 7777,
    "anchor_uname": "老实憨厚的笑笑",
    "guard_level": 2,
    "medal_color": "#6154c",
    "medal_color_end": 6850801,
    "medal_level": 27,
    "special": "",
    "icon_id": 0,
    "is_lighted": 1,
    "medal_color_border": 16771156,
    "medal_color_start": 398668,
    "medal_name": "德云色"
  },
  "trans_mark": 0,
  "ts": 1635749378,
  "background_color_start": "#4EA4C5",
  "end_time": 1635749498,
  "message_font_color": "#A3F6FF",
  "rate": 1000,
  "message_trans": "",
  "start_time": 1635749378,
  "is_ranked": 1,
  "message": "熊神可以打一拳旁边那个大胖子吗",
  "time": 120,
  "uid": 12777723
}

type SuperChatMessageJPN

type SuperChatMessageJPN struct {
	UID       string `json:"uid"`
	IsRanked  int    `json:"is_ranked"`
	MedalInfo struct {
		MedalColor   string `json:"medal_color"`
		IconID       int64  `json:"icon_id"`
		TargetID     int64  `json:"target_id"`
		Special      string `json:"special"`
		AnchorUname  string `json:"anchor_uname"`
		AnchorRoomid int    `json:"anchor_roomid"`
		MedalLevel   int    `json:"medal_level"`
		MedalName    string `json:"medal_name"`
	} `json:"medal_info"`
	UserInfo struct {
		UserLevel  int    `json:"user_level"`
		LevelColor string `json:"level_color"`
		IsVip      int    `json:"is_vip"`
		IsSvip     int    `json:"is_svip"`
		IsMainVip  int    `json:"is_main_vip"`
		Title      string `json:"title"`
		Uname      string `json:"uname"`
		Face       string `json:"face"`
		Manager    int    `json:"manager"`
		FaceFrame  string `json:"face_frame"`
		GuardLevel int    `json:"guard_level"`
	} `json:"user_info"`
	ID                   string `json:"id"`
	MessageJpn           string `json:"message_jpn"`
	Time                 int64  `json:"time"`
	Rate                 int    `json:"rate"`
	BackgroundImage      string `json:"background_image"`
	BackgroundIcon       string `json:"background_icon"`
	BackgroundPriceColor string `json:"background_price_color"`
	Token                string `json:"token"`
	Gift                 struct {
		Num      int    `json:"num"`
		GiftID   int64  `json:"gift_id"`
		GiftName string `json:"gift_name"`
	} `json:"gift"`
	Price                 int    `json:"price"`
	Message               string `json:"message"`
	BackgroundColor       string `json:"background_color"`
	BackgroundBottomColor string `json:"background_bottom_color"`
	TS                    int64  `json:"ts"`
	StartTime             int64  `json:"start_time"`
	EndTime               int64  `json:"end_time"`
}
{
  "uid": "179810804",
  "is_ranked": 1,
  "medal_info": {
	"medal_color": "#1a544b",
	"icon_id": 0,
	"target_id": 419220,
	"special": "",
	"anchor_uname": "神奇陆夫人",
	"anchor_roomid": 115,
	"medal_level": 22,
	"medal_name": "陆夫人"
  },
  "user_info": {
	"user_level": 20,
	"level_color": "#61c05a",
	"is_vip": 0,
	"is_svip": 0,
	"is_main_vip": 1,
	"title": "0",
	"uname": "悲剧携带者",
	"face": "http://i2.hdslb.com/bfs/face/350aebb461ca8215b70c4cb4c1e8061ccb6d7db1.jpg",
	"manager": 0,
	"face_frame": "http://i0.hdslb.com/bfs/live/78e8a800e97403f1137c0c1b5029648c390be390.png",
	"guard_level": 3
  },
  "id": "2576342",
  "message_jpn": "",
  "time": 60,
  "rate": 1000,
  "background_image": "https://i0.hdslb.com/bfs/live/a712efa5c6ebc67bafbe8352d3e74b820a00c13e.png",
  "background_icon": "",
  "background_price_color": "#7497CD",
  "token": "1B6E22FC",
  "gift": {
	"num": 1,
	"gift_id": 12000,
	"gift_name": "醒目留言"
  },
  "price": 30,
  "message": "夫人,看你航天伴着好运来刷牛场,出了基德的财运,但是为什么mf才22(上限40啊",
  "background_color": "#EDF5FF",
  "background_bottom_color": "#2A60B2",
  "ts": 1635766505,
  "start_time": 1635766505,
  "end_time": 1635766565
}

type Transport

type Transport struct {
	Msg   Msg
	Error error
}

type UserToastMsg

type UserToastMsg struct {
	GuardLevel       int    `json:"guard_level"`
	OpType           int    `json:"op_type"`
	PayflowID        string `json:"payflow_id"`
	Unit             string `json:"unit"`
	IsShow           int    `json:"is_show"`
	Num              int    `json:"num"`
	Price            int64  `json:"price"`
	StartTime        int64  `json:"start_time"`
	SvgaBlock        int    `json:"svga_block"`
	UserShow         bool   `json:"user_show"`
	Color            string `json:"color"`
	EndTime          int64  `json:"end_time"`
	RoleName         string `json:"role_name"`
	ToastMsg         string `json:"toast_msg"`
	UID              int64  `json:"uid"`
	AnchorShow       bool   `json:"anchor_show"`
	DmScore          int    `json:"dmscore"`
	TargetGuardCount int    `json:"target_guard_count"`
	Username         string `json:"username"`
}
{
  "guard_level": 2,
  "op_type": 1,
  "payflow_id": "2111011646287352179657661",
  "unit": "月",
  "is_show": 0,
  "num": 1,
  "price": 1998000,
  "start_time": 1635756388,
  "svga_block": 0,
  "user_show": true,
  "color": "#E17AFF",
  "end_time": 1635756388,
  "role_name": "提督",
  "toast_msg": "<%何图灵%> 开通了提督",
  "uid": 4497965,
  "anchor_show": true,
  "dmscore": 96,
  "target_guard_count": 12089,
  "username": "何图灵"
}

type VoiceJoinList

type VoiceJoinList struct {
	RoomID     int64 `json:"room_id"`
	Category   int   `json:"category"`
	ApplyCount int   `json:"apply_count"`
	RedPoint   int   `json:"red_point"`
	Refresh    int   `json:"refresh"`
}
{
  "room_id": 34348,
  "category": 1,
  "apply_count": 1,
  "red_point": 1,
  "refresh": 1
}

type VoiceJoinRoomCountInfo

type VoiceJoinRoomCountInfo struct {
	ApplyCount  int   `json:"apply_count"`
	NotifyCount int   `json:"notify_count"`
	RedPoint    int   `json:"red_point"`
	RoomID      int64 `json:"room_id"`
	RootStatus  int   `json:"root_status"`
	RoomStatus  int   `json:"room_status"`
}
{
  "apply_count": 1,
  "notify_count": 0,
  "red_point": 0,
  "room_id": 34348,
  "root_status": 1,
  "room_status": 1
}

type WatChed added in v0.1.3

type WatChed struct {
	Num       int    `json:"num"`        //144450
	TextLarge string `json:"text_large"` //14.4万人看过
	TextSmall string `json:"text_small"` //14.4万
}

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL