summaryrefslogtreecommitdiff
path: root/bilibili/play_url.go
diff options
context:
space:
mode:
authorKeuin <[email protected]>2023-07-11 22:56:07 +0800
committerKeuin <[email protected]>2023-07-11 22:56:07 +0800
commitf5c63cde56eb35c0125a0545f084441cdd4340ab (patch)
treecf24779daaa3067902bef91d21bcdee7a78fd059 /bilibili/play_url.go
parent7fd817f6d1ead3de85294c1893a6e1572a1d12e3 (diff)
Refactor: move data structures to a separate package to avoid circular dependency.
Diffstat (limited to 'bilibili/play_url.go')
-rw-r--r--bilibili/play_url.go28
1 files changed, 3 insertions, 25 deletions
diff --git a/bilibili/play_url.go b/bilibili/play_url.go
index 49e8298..c2c6709 100644
--- a/bilibili/play_url.go
+++ b/bilibili/play_url.go
@@ -2,33 +2,11 @@ package bilibili
import (
"fmt"
+ "github.com/keuin/slbr/types"
)
-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) {
+func (b Bilibili) GetStreamingInfo(roomId types.RoomId) (resp types.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)
+ return callGet[types.RoomUrlInfoResponse](b, url)
}