Documentation ¶
Index ¶
- Variables
- type ChannelData
- type ChannelDataGiftList
- type Comment
- type CommentArguments
- type ControlDisconnectionArguments
- type ControlToken
- type FC2
- type Fc2Channel
- type GetControlServerResponse
- type GetMetaData
- type GetMetaOptions
- type GetMetaResponse
- type HLSInformation
- type Latency
- type LiveStream
- func (ls *LiveStream) GetMeta(ctx context.Context, options ...GetMetaOptions) (*GetMetaData, error)
- func (ls *LiveStream) GetWebSocketURL(ctx context.Context) (string, error)
- func (ls *LiveStream) IsOnline(ctx context.Context, options ...GetMetaOptions) (bool, error)
- func (ls *LiveStream) WaitForOnline(ctx context.Context, interval time.Duration) error
- type OptionalParams
- type Params
- type Playlist
- type ProfileData
- type Quality
- type Stamina
- type UserData
- type UserDataGiftList
- type WSResponse
- type WebSocket
- func (w *WebSocket) Dial(ctx context.Context) (*websocket.Conn, error)
- func (w *WebSocket) GetHLSInformation(ctx context.Context, conn *websocket.Conn, msgChan <-chan *WSResponse) (*HLSInformation, error)
- func (w *WebSocket) HealthCheckLoop(ctx context.Context, conn *websocket.Conn) error
- func (w *WebSocket) Listen(ctx context.Context, conn *websocket.Conn, msgChan chan<- *WSResponse, ...) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrWebSocketServerDisconnection = errors.New("server disconnected") ErrWebSocketPaidProgram = errors.New("paid program") ErrWebSocketLoginRequired = errors.New("login required") ErrWebSocketMultipleConnection = errors.New("multiple connection error") ErrWebSocketStreamEnded = errors.New("stream ended") ErrWebSocketEmptyPlaylist = errors.New("server did not return a valid playlist") )
View Source
var ErrLiveStreamNotOnline = errors.New("live stream is not online")
View Source
var ErrUnknownLatency = errors.New("unknown latency")
View Source
var ErrUnknownQuality = errors.New("unknown quality")
Functions ¶
This section is empty.
Types ¶
type ChannelData ¶
type ChannelData struct { ChannelID string `json:"channelid"` UserID string `json:"userid"` Adult int `json:"adult"` Twoshot int `json:"twoshot"` Title string `json:"title"` Info string `json:"info"` Image string `json:"image"` LoginOnly int `json:"login_only"` GiftLimit int `json:"gift_limit"` GiftList []ChannelDataGiftList `json:"gift_list"` CommentLimit string `json:"comment_limit"` Tfollow int `json:"tfollow"` Tname string `json:"tname"` Fee int `json:"fee"` Amount int `json:"amount"` Interval int `json:"interval"` Category string `json:"category"` CategoryName string `json:"category_name"` IsOfficial int `json:"is_official"` IsPremiumPublisher int `json:"is_premium_publisher"` Ticketid int `json:"ticketid"` IsPremium int `json:"is_premium"` TicketPrice int `json:"ticket_price"` TicketOnly int `json:"ticket_only"` IsApp int `json:"is_app"` IsVideo int `json:"is_video"` IsREST int `json:"is_rest"` Count int `json:"count"` IsPublish int `json:"is_publish"` IsLimited int `json:"is_limited"` Start int `json:"start"` Version string `json:"version"` Fc2Channel Fc2Channel `json:"fc2_channel"` ControlTag string `json:"control_tag"` PublishMethod string `json:"publish_method"` VideoStereo3D interface{} `json:"video_stereo3d"` VideoMapping interface{} `json:"video_mapping"` VideoHorizontalView interface{} `json:"video_horizontal_view"` }
type ChannelDataGiftList ¶
type Comment ¶
type Comment struct { UserName string `json:"user_name"` Comment string `json:"comment"` Timestamp int `json:"timestamp"` EncryptedUserID string `json:"encrypted_user_id"` OrzToken string `json:"orz_token"` Hash string `json:"hash"` Color string `json:"color"` Size string `json:"size"` Lang string `json:"lang"` Anonymous int `json:"anonymous"` History int `json:"history"` }
type CommentArguments ¶
type CommentArguments struct {
Comments []Comment `json:"comments"`
}
type ControlDisconnectionArguments ¶
type ControlDisconnectionArguments struct {
Code int `json:"code"`
}
type ControlToken ¶
type ControlToken struct { ChannelID string `json:"channel_id"` UserID string `json:"user_id"` Fc2ID string `json:"fc2_id"` OrzToken string `json:"orz_token"` SessionToken string `json:"session_token"` Premium int `json:"premium"` Mode string `json:"mode"` Language string `json:"language"` ClientType string `json:"client_type"` ClientApp string `json:"client_app"` ClientVersion string `json:"client_version"` AppInstallKey string `json:"app_install_key"` ChannelVersion string `json:"channel_version"` ControlTag string `json:"control_tag"` Ipv6 string `json:"ipv6"` Commentable bool `json:"commentable"` jwt.RegisteredClaims }
type FC2 ¶
func (*FC2) FetchPlaylist ¶
type Fc2Channel ¶
type GetMetaData ¶
type GetMetaData struct { ChannelData ChannelData `json:"channel_data"` ProfileData ProfileData `json:"profile_data"` UserData UserData `json:"user_data"` }
type GetMetaOptions ¶
type GetMetaOptions struct {
Refetch bool
}
type GetMetaResponse ¶
type GetMetaResponse struct { Status int `json:"status"` Data GetMetaData `json:"data"` }
type HLSInformation ¶
type Latency ¶
type Latency int
func LatencyFromMode ¶
func LatencyParseString ¶
func (*Latency) UnmarshalText ¶
type LiveStream ¶
func NewLiveStream ¶
func NewLiveStream(client *http.Client, channelID string) *LiveStream
func (*LiveStream) GetMeta ¶
func (ls *LiveStream) GetMeta(ctx context.Context, options ...GetMetaOptions) (*GetMetaData, error)
func (*LiveStream) GetWebSocketURL ¶
func (ls *LiveStream) GetWebSocketURL(ctx context.Context) (string, error)
func (*LiveStream) IsOnline ¶
func (ls *LiveStream) IsOnline(ctx context.Context, options ...GetMetaOptions) (bool, error)
func (*LiveStream) WaitForOnline ¶
type OptionalParams ¶
type OptionalParams struct { Quality *Quality `yaml:"quality"` Latency *Latency `yaml:"latency"` PacketLossMax *int `yaml:"packetLossMax"` OutFormat *string `yaml:"outFormat"` WriteChat *bool `yaml:"writeChat"` WriteInfoJSON *bool `yaml:"writeInfoJson"` WriteThumbnail *bool `yaml:"writeThumbnail"` WaitForLive *bool `yaml:"waitForLive"` WaitForQualityMaxTries *int `yaml:"waitForQualityMaxTries"` WaitPollInterval *time.Duration `yaml:"waitPollInterval"` CookiesFile *string `yaml:"cookiesFile"` Remux *bool `yaml:"remux"` KeepIntermediates *bool `yaml:"keepIntermediates"` ExtractAudio *bool `yaml:"extractAudio"` Labels map[string]string `yaml:"labels"` }
func (*OptionalParams) Override ¶
func (override *OptionalParams) Override(params *Params)
type Params ¶
type Params struct { Quality Quality `yaml:"quality"` Latency Latency `yaml:"latency"` PacketLossMax int `yaml:"packetLossMax"` OutFormat string `yaml:"outFormat"` WriteChat bool `yaml:"writeChat"` WriteInfoJSON bool `yaml:"writeInfoJson"` WriteThumbnail bool `yaml:"writeThumbnail"` WaitForLive bool `yaml:"waitForLive"` WaitForQualityMaxTries int `yaml:"waitForQualityMaxTries"` WaitPollInterval time.Duration `yaml:"waitPollInterval"` CookiesFile string `yaml:"cookiesFile"` Remux bool `yaml:"remux"` KeepIntermediates bool `yaml:"keepIntermediates"` ExtractAudio bool `yaml:"extractAudio"` Labels map[string]string `yaml:"labels"` }
var DefaultParams Params = Params{ Quality: Quality1_2MBps, Latency: LatencyMid, PacketLossMax: 200, OutFormat: "{{ .Date }} {{ .Title }} ({{ .ChannelName }}).{{ .Ext }}", WriteChat: false, WriteInfoJSON: false, WriteThumbnail: false, WaitForLive: true, WaitForQualityMaxTries: 10, WaitPollInterval: 5 * time.Second, CookiesFile: "", Remux: true, KeepIntermediates: false, ExtractAudio: false, Labels: nil, }
type Playlist ¶
func ExtractAndMergePlaylists ¶
func ExtractAndMergePlaylists(hlsInfo *HLSInformation) []Playlist
func GetPlaylistOrBest ¶
func SortPlaylists ¶
type ProfileData ¶
type Quality ¶
type Quality int
func QualityFromMode ¶
func QualityParseString ¶
func (*Quality) UnmarshalText ¶
type Stamina ¶
type Stamina struct { Timestamp int `json:"timestamp"` Stamina [][]interface{} `json:"stamina"` }
type UserData ¶
type UserData struct { IsLogin int `json:"is_login"` UserID int `json:"userid"` Fc2ID int `json:"fc2id"` Icon string `json:"icon"` Name string `json:"name"` Point int `json:"point"` AdultAccess int `json:"adult_access"` Recauth int `json:"recauth"` IsPremiumUser int `json:"is_premium_user"` GiftList []UserDataGiftList `json:"gift_list"` Stamina Stamina `json:"stamina"` }
type UserDataGiftList ¶
type WSResponse ¶
type WSResponse struct { ID int `json:"id,omitempty"` Name string `json:"name"` Arguments json.RawMessage `json:"arguments"` }
type WebSocket ¶
func NewWebSocket ¶
func (*WebSocket) GetHLSInformation ¶
func (w *WebSocket) GetHLSInformation( ctx context.Context, conn *websocket.Conn, msgChan <-chan *WSResponse, ) (*HLSInformation, error)
func (*WebSocket) HealthCheckLoop ¶
Click to show internal directories.
Click to hide internal directories.