summaryrefslogtreecommitdiff
path: root/bilibili/danmaku_server_info.go
blob: 1a91b1476ff59214b51d46ce20f93c521e581f93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package bilibili

import (
	"fmt"
	"github.com/keuin/slbr/common"
)

type DanmakuServerInfoResponse = BaseResponse[danmakuInfo]

type danmakuInfo 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"`
}

func (b Bilibili) GetDanmakuServerInfo(roomId common.RoomId) (resp DanmakuServerInfoResponse, err error) {
	url := fmt.Sprintf("https://api.live.bilibili.com/xlive/web-room/v1/index/getDanmuInfo?id=%d&type=0", roomId)
	return callGet[DanmakuServerInfoResponse](b, url)
}