api

package
v0.0.3-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderLen   = 16
	ProtocolVer = 1
	SequenceID  = 1
)

bilibili websocket protocol

View Source
const (
	OperationTypeHeart   = 2
	OperationTypeMessage = 5
	OperationTypeEnter   = 7
)

websocket operation protocol

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseAPI

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

BaseAPI live info

func (*BaseAPI) GetAuthor

func (b *BaseAPI) GetAuthor() string

GetAuthor return live author

func (*BaseAPI) GetLiveID

func (b *BaseAPI) GetLiveID() string

GetLiveID return live id

func (*BaseAPI) GetLiveStatus

func (b *BaseAPI) GetLiveStatus() bool

GetLiveStatus get live status

func (*BaseAPI) GetLiveURL

func (b *BaseAPI) GetLiveURL() string

GetLiveURL get live url

func (*BaseAPI) GetPlatformName

func (b *BaseAPI) GetPlatformName() string

GetPlatformName return a name for live platform

func (*BaseAPI) GetTitle

func (b *BaseAPI) GetTitle() string

GetTitle return live title

type BilibiliLive

type BilibiliLive struct {
	BaseAPI
	// contains filtered or unexported fields
}

BilibiliLive bilibili live api

func NewBilibiliLive

func NewBilibiliLive(base *BaseAPI) *BilibiliLive

NewBilibiliLive return a bilibililive struct

func (*BilibiliLive) GetDanmaku

func (b *BilibiliLive) GetDanmaku(done chan struct{}) (<-chan *DanmakuMessage, error)

GetDanmaku push danmaku in chan

func (*BilibiliLive) GetStreamURLs

func (b *BilibiliLive) GetStreamURLs() ([]StreamURL, error)

GetStreamURLs return live stream url map

func (*BilibiliLive) RefreshLiveInfo

func (b *BilibiliLive) RefreshLiveInfo() error

RefreshLiveInfo refresh live info

type DanmakuMessage

type DanmakuMessage struct {
	Content  string
	SendTime int64
	Type     uint8
	UserName string
}

DanmakuMessage store danmaku msg

type LiveAPI

type LiveAPI interface {
	GetLiveURL() string
	RefreshLiveInfo() error
	GetLiveStatus() bool
	GetPlatformName() string
	GetTitle() string
	GetAuthor() string
	GetLiveID() string
	GetStreamURLs() ([]StreamURL, error)
	GetDanmaku(chan struct{}) (<-chan *DanmakuMessage, error)
}

LiveAPI interface

func Check

func Check(url *url.URL) LiveAPI

Check select api

type StreamURL

type StreamURL struct {
	PlayURL  url.URL
	FileType string
}

StreamURL store stream info

type YouTubeLive

type YouTubeLive struct {
	BaseAPI
	// contains filtered or unexported fields
}

YouTubeLive youtube live api

func NewYouTubeLive

func NewYouTubeLive(base *BaseAPI) *YouTubeLive

NewYouTubeLive return a youtubeLive struct

func (*YouTubeLive) GetDanmaku

func (y *YouTubeLive) GetDanmaku(done chan struct{}) (<-chan *DanmakuMessage, error)

GetDanmaku push danmaku in chan

func (*YouTubeLive) GetStreamURLs

func (y *YouTubeLive) GetStreamURLs() ([]StreamURL, error)

GetStreamURLs return live stream url map

func (*YouTubeLive) RefreshLiveInfo

func (y *YouTubeLive) RefreshLiveInfo() error

RefreshLiveInfo refresh live info

Jump to

Keyboard shortcuts

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