summaryrefslogtreecommitdiff
path: root/bilibili/danmaku_server_info.go
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-09-07 02:48:46 +0800
committerKeuin <[email protected]>2022-09-07 02:48:46 +0800
commit8e15d802865ed57db0018c15ea5559c8bd44c01f (patch)
tree48f4632a1ad044bd7f7f8da3ebe2bb03ab4ca6fe /bilibili/danmaku_server_info.go
parent88234ca8fffc4e120adbe0d38071b625ad2f43c7 (diff)
First working version. Just a POC.
Diffstat (limited to 'bilibili/danmaku_server_info.go')
-rw-r--r--bilibili/danmaku_server_info.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/bilibili/danmaku_server_info.go b/bilibili/danmaku_server_info.go
new file mode 100644
index 0000000..dbdf6bb
--- /dev/null
+++ b/bilibili/danmaku_server_info.go
@@ -0,0 +1,28 @@
+package bilibili
+
+import (
+ "bilibili-livestream-archiver/common"
+ "fmt"
+)
+
+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)
+}