blob: 49e82983fc3b2b92654c3d04a7c63a4f5ea05c1b (
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
29
30
31
32
33
34
|
package bilibili
import (
"fmt"
)
type RoomUrlInfoResponse = BaseResponse[roomUrlInfo]
type roomUrlInfo struct {
CurrentQuality int `json:"current_quality"`
AcceptQuality []string `json:"accept_quality"`
CurrentQualityNumber int `json:"current_qn"`
QualityDescription []qualityDescription `json:"quality_description"`
URLs []StreamingUrlInfo `json:"durl"`
}
type qualityDescription struct {
QualityNumber int `json:"qn"`
Description string `json:"desc"`
}
type StreamingUrlInfo struct {
URL string `json:"url"`
Length int `json:"length"`
Order int `json:"order"`
StreamType int `json:"stream_type"`
P2pType int `json:"p2p_type"`
}
func (b Bilibili) GetStreamingInfo(roomId RoomId) (resp RoomUrlInfoResponse, err error) {
url := fmt.Sprintf("https://api.live.bilibili.com/room/v1/Room/playUrl?"+
"cid=%d&otype=json&qn=10000&platform=web", roomId)
return callGet[RoomUrlInfoResponse](b, url)
}
|