youtube

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const Site = "youtube"
View Source
const VideoPath = "https://www.youtube.com/channel/%s/videos?view=57&flow=grid"
View Source
const VideoView = "https://www.youtube.com/watch?v="

Variables

View Source
var VideoStatus_name = map[int32]string{
	0: "Waiting",
	1: "Living",
	2: "Upload",
}
View Source
var VideoStatus_value = map[string]int32{
	"Waiting": 0,
	"Living":  1,
	"Upload":  2,
}
View Source
var VideoType_name = map[int32]string{
	0: "FirstLive",
	1: "Live",
	2: "Video",
}
View Source
var VideoType_value = map[string]int32{
	"FirstLive": 0,
	"Live":      1,
	"Video":     2,
}

Functions

func NewExtraKey

func NewExtraKey() *extraKey

func VideoViewUrl

func VideoViewUrl(videoId string) string

Types

type Concern

type Concern struct {
	*StateManager
	// contains filtered or unexported fields
}

func NewConcern

func NewConcern(notify chan<- concern.Notify) *Concern

func (*Concern) Add

func (c *Concern) Add(groupCode int64, id string, ctype concern.Type) (info *Info, err error)

func (*Concern) FindInfo added in v0.0.9

func (c *Concern) FindInfo(channelId string, load bool) (*Info, error)

func (*Concern) FindOrLoad added in v0.0.9

func (c *Concern) FindOrLoad(channelId string) (*Info, error)

func (Concern) InfoKey

func (e Concern) InfoKey(keys ...interface{}) string

func (*Concern) ListWatching added in v0.0.7

func (c *Concern) ListWatching(groupCode int64, ctype concern.Type) ([]*UserInfo, []concern.Type, error)

func (*Concern) Start

func (c *Concern) Start()

func (Concern) UserInfoKey

func (e Concern) UserInfoKey(keys ...interface{}) string

func (Concern) VideoKey

func (e Concern) VideoKey(keys ...interface{}) string

type ConcernEvent

type ConcernEvent interface {
	Type() EventType
}

type ConcernNotify

type ConcernNotify struct {
	VideoInfo
	GroupCode int64 `json:"group_code"`
}

func NewConcernNotify

func NewConcernNotify(groupCode int64, info *VideoInfo) *ConcernNotify

func (*ConcernNotify) GetGroupCode added in v0.0.10

func (notify *ConcernNotify) GetGroupCode() int64

func (*ConcernNotify) GetUid added in v0.0.10

func (notify *ConcernNotify) GetUid() interface{}

func (*ConcernNotify) ShouldSend added in v0.0.10

func (notify *ConcernNotify) ShouldSend() bool

func (*ConcernNotify) ToMessage added in v0.0.10

func (notify *ConcernNotify) ToMessage() []message.IMessageElement

func (*ConcernNotify) Type

func (notify *ConcernNotify) Type() concern.Type

type EventType

type EventType int64
const (
	Video EventType = iota
	Live
)

type Info

type Info struct {
	VideoInfo []*VideoInfo `json:"video_info"`
	UserInfo
}

func NewInfo

func NewInfo(vinfo []*VideoInfo) *Info

func (*Info) ToString

func (i *Info) ToString() string

type KeySet

type KeySet struct {
}

func NewKeySet

func NewKeySet() *KeySet

func (*KeySet) FreshKey

func (k *KeySet) FreshKey(keys ...interface{}) string

func (*KeySet) GroupAtAllMarkKey added in v0.0.10

func (k *KeySet) GroupAtAllMarkKey(keys ...interface{}) string

func (*KeySet) GroupConcernConfigKey added in v0.0.10

func (k *KeySet) GroupConcernConfigKey(keys ...interface{}) string

func (*KeySet) GroupConcernStateKey

func (k *KeySet) GroupConcernStateKey(keys ...interface{}) string

func (*KeySet) ParseGroupConcernStateKey

func (k *KeySet) ParseGroupConcernStateKey(key string) (int64, interface{}, error)

type Searcher

type Searcher struct {
	Sub []*gabs.Container
}

type StateManager

type StateManager struct {
	*concern_manager.StateManager
	// contains filtered or unexported fields
}

func NewStateManager

func NewStateManager() *StateManager

func (*StateManager) AddInfo

func (s *StateManager) AddInfo(info *Info) error

func (*StateManager) AddVideo

func (s *StateManager) AddVideo(v *VideoInfo) error

func (*StateManager) GetInfo

func (s *StateManager) GetInfo(channelId string) (info *Info, err error)

func (*StateManager) GetVideo

func (s *StateManager) GetVideo(channelId string, videoId string) (*VideoInfo, error)

func (StateManager) InfoKey

func (e StateManager) InfoKey(keys ...interface{}) string

func (*StateManager) Start

func (s *StateManager) Start() error

func (StateManager) UserInfoKey

func (e StateManager) UserInfoKey(keys ...interface{}) string

func (StateManager) VideoKey

func (e StateManager) VideoKey(keys ...interface{}) string

type UserInfo

type UserInfo struct {
	ChannelId   string `json:"channel_id"`
	ChannelName string `json:"channel_name"`
}

func NewUserInfo added in v0.0.7

func NewUserInfo(channelId, channelName string) *UserInfo

type VideoInfo

type VideoInfo struct {
	UserInfo
	Cover          string      `json:"cover"`
	VideoId        string      `json:"video_id"`
	VideoTitle     string      `json:"video_title"`
	VideoType      VideoType   `json:"video_type"`
	VideoStatus    VideoStatus `json:"video_status"`
	VideoTimestamp int64       `json:"video_timestamp"`
}

VideoInfo may be a video or a live, depend on the VideoType

func XFetchInfo

func XFetchInfo(channelID string) ([]*VideoInfo, error)

very sb

func (*VideoInfo) IsLive

func (v *VideoInfo) IsLive() bool

func (*VideoInfo) IsLiving

func (v *VideoInfo) IsLiving() bool

func (*VideoInfo) IsVideo

func (v *VideoInfo) IsVideo() bool

func (*VideoInfo) IsWaiting

func (v *VideoInfo) IsWaiting() bool

func (*VideoInfo) Type

func (v *VideoInfo) Type() EventType

type VideoStatus

type VideoStatus int32
const (
	VideoStatus_Waiting VideoStatus = 0
	VideoStatus_Living  VideoStatus = 1
	VideoStatus_Upload  VideoStatus = 2
)

func (VideoStatus) EnumDescriptor

func (VideoStatus) EnumDescriptor() ([]byte, []int)

func (VideoStatus) String

func (x VideoStatus) String() string

type VideoType

type VideoType int32
const (
	VideoType_FirstLive VideoType = 0
	VideoType_Live      VideoType = 1
	VideoType_Video     VideoType = 2
)

func (VideoType) EnumDescriptor

func (VideoType) EnumDescriptor() ([]byte, []int)

func (VideoType) String

func (x VideoType) String() string

Jump to

Keyboard shortcuts

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