api

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetJson

func GetJson(url string, result interface{}) error

func GetJsonWithHeader added in v1.5.0

func GetJsonWithHeader(url string, headers *http.Header, result interface{}) error

func GetRoomRealID

func GetRoomRealID(roomID int) (string, error)

func GetUid added in v1.5.0

func GetUid(cookie string) (int, error)

func HttpGet added in v1.5.1

func HttpGet(url string, headers *http.Header) ([]byte, error)

Types

type BiliVerify

type BiliVerify struct {
	Csrf     string
	SessData string
}

type DanmakuRequest

type DanmakuRequest struct {
	Msg      string
	RoomID   string
	Bubble   string
	Color    string
	FontSize string
	Mode     string
	DmType   string
}

type DanmuInfo

type DanmuInfo struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Ttl     int    `json:"ttl"`
	Data    struct {
		Group            string  `json:"group"`
		BusinessId       int     `json:"business_id"`
		RefreshRowFactor float64 `json:"refresh_row_factor"`
		RefreshRate      int     `json:"refresh_rate"`
		MaxDelay         int     `json:"max_delay"`
		Token            string  `json:"token"`
		HostList         []struct {
			Host    string `json:"host"`
			Port    int    `json:"port"`
			WssPort int    `json:"wss_port"`
			WsPort  int    `json:"ws_port"`
		} `json:"host_list"`
	} `json:"data"`
}

DanmuInfo api https://api.live.bilibili.com/xlive/web-room/v1/index/getDanmuInfo?id={}&type=0 response

func GetDanmuInfo

func GetDanmuInfo(roomID int, cookie string) (*DanmuInfo, error)

type RoomInfo

type RoomInfo struct {
	Code    int    `json:"code"`
	Msg     string `json:"msg"`
	Message string `json:"message"`
	Data    struct {
		RoomId      int   `json:"room_id"`
		ShortId     int   `json:"short_id"`
		Uid         int   `json:"uid"`
		NeedP2P     int   `json:"need_p2p"`
		IsHidden    bool  `json:"is_hidden"`
		IsLocked    bool  `json:"is_locked"`
		IsPortrait  bool  `json:"is_portrait"`
		LiveStatus  int   `json:"live_status"`
		HiddenTill  int   `json:"hidden_till"`
		LockTill    int   `json:"lock_till"`
		Encrypted   bool  `json:"encrypted"`
		PwdVerified bool  `json:"pwd_verified"`
		LiveTime    int64 `json:"live_time"`
		RoomShield  int   `json:"room_shield"`
		IsSp        int   `json:"is_sp"`
		SpecialType int   `json:"special_type"`
	} `json:"data"`
}

RoomInfo api https://api.live.bilibili.com/room/v1/Room/room_init?id={} response

func GetRoomInfo

func GetRoomInfo(roomID int) (*RoomInfo, error)

type SendDanmakuResp

type SendDanmakuResp struct {
	Code int `json:"code"`
	Data struct {
		ModeInfo struct {
			Mode           int    `json:"mode"`
			ShowPlayerType int    `json:"show_player_type"`
			Extra          string `json:"extra"`
		} `json:"mode_info"`
	} `json:"data"`
	Message string `json:"message"`
	Msg     string `json:"msg"`
}

func SendDefaultDanmaku

func SendDefaultDanmaku(roomID string, message string, verify *BiliVerify) (*SendDanmakuResp, error)

Jump to

Keyboard shortcuts

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