bilibili

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

This file defines the Bilibili client struct. This struct is a facade of all necessary Bilibili HTTP API wrappers.

This file defines the common struct of logger pointers used in modules of this package.

Get live room basic status. This is used to check initially if it is streaming or not.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseResponse

type BaseResponse[T any] struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	TTL     int    `json:"ttl"`
	Data    T      `json:"data"`
}

type Bilibili

type Bilibili struct {
	// contains filtered or unexported fields
}

func NewBilibili

func NewBilibili(logger logging.Logger) Bilibili

func NewBilibiliWithContext

func NewBilibiliWithContext(ctx context.Context, netTypes []IpNetType, logger logging.Logger) Bilibili

func NewBilibiliWithNetType

func NewBilibiliWithNetType(netTypes []IpNetType, logger logging.Logger) Bilibili

func (Bilibili) CopyLiveStream

func (b Bilibili) CopyLiveStream(
	ctx context.Context,
	roomId common.RoomId,
	stream StreamingUrlInfo,
	out *os.File,
	buffer []byte,
	readChunkSize int,
) (err error)

CopyLiveStream read data from a livestream video stream, copy them to a writer.

func (Bilibili) Do

func (b Bilibili) Do(req *http.Request) (resp *http.Response, err error)

func (Bilibili) GetDanmakuServerInfo

func (b Bilibili) GetDanmakuServerInfo(roomId common.RoomId) (resp DanmakuServerInfoResponse, err error)

func (Bilibili) GetRoomPlayInfo

func (b Bilibili) GetRoomPlayInfo(roomId common.RoomId) (resp RoomPlayInfoResponse, err error)

func (Bilibili) GetRoomProfile

func (b Bilibili) GetRoomProfile(roomId common.RoomId) (resp RoomProfileResponse, err error)

func (Bilibili) GetStreamingInfo

func (b Bilibili) GetStreamingInfo(roomId common.RoomId) (resp RoomUrlInfoResponse, err error)

type DanmakuServerInfoResponse

type DanmakuServerInfoResponse = BaseResponse[danmakuInfo]

type IpNetType

type IpNetType string
var (
	IPv6Net IpNetType = "ipv6"
	IPv4Net IpNetType = "ipv4"
	IP64    IpNetType = "any"
)

func (IpNetType) GetDialNetString added in v0.3.0

func (t IpNetType) GetDialNetString() string

GetDialNetString returns the string accepted by net.Dialer::DialContext

func (IpNetType) String added in v0.3.0

func (t IpNetType) String() string

type LiveStatus

type LiveStatus int
const (
	Inactive  LiveStatus = 0
	Streaming LiveStatus = 1
	Playback  LiveStatus = 2
)

func (LiveStatus) IsStreaming

func (s LiveStatus) IsStreaming() bool

func (LiveStatus) String

func (s LiveStatus) String() string

type RoomPlayInfoResponse

type RoomPlayInfoResponse = BaseResponse[roomPlayInfo]

type RoomProfileResponse

type RoomProfileResponse = BaseResponse[roomProfile]

type RoomUrlInfoResponse

type RoomUrlInfoResponse = BaseResponse[roomUrlInfo]

type StreamingUrlInfo

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

Jump to

Keyboard shortcuts

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