youtube

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Video concern_type.Type = "news"
	Live  concern_type.Type = "live"
)
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",
	}
	VideoStatus_value = map[string]int32{
		"Waiting": 0,
		"Living":  1,
		"Upload":  2,
	}
)

Enum value maps for VideoStatus.

View Source
var (
	VideoType_name = map[int32]string{
		0: "FirstLive",
		1: "Live",
		2: "Video",
	}
	VideoType_value = map[string]int32{
		"FirstLive": 0,
		"Live":      1,
		"Video":     2,
	}
)

Enum value maps for VideoType.

View Source
var File_lsp_youtube_youtube_proto protoreflect.FileDescriptor

Functions

func NewExtraKey

func NewExtraKey() *extraKey

func VideoViewUrl

func VideoViewUrl(videoId string) string

Types

type Concern

type Concern struct {
	*StateManager
}

func NewConcern

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

func (*Concern) Add

func (c *Concern) Add(ctx mmsg.IMsgCtx, groupCode int64, _id interface{}, ctype concern_type.Type) (concern.IdentityInfo, error)

func (*Concern) FindInfo

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

func (*Concern) FindOrLoad

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

func (*Concern) Get

func (c *Concern) Get(id interface{}) (concern.IdentityInfo, error)

func (*Concern) GetStateManager

func (c *Concern) GetStateManager() concern.IStateManager

func (Concern) InfoKey

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

func (*Concern) ParseId

func (c *Concern) ParseId(s string) (interface{}, error)

func (*Concern) Remove

func (c *Concern) Remove(ctx mmsg.IMsgCtx, groupCode int64, _id interface{}, ctype concern_type.Type) (concern.IdentityInfo, error)

func (*Concern) Site

func (c *Concern) Site() string

func (*Concern) Start

func (c *Concern) Start() error

func (*Concern) Stop

func (c *Concern) Stop()

func (*Concern) Types

func (c *Concern) Types() []concern_type.Type

func (Concern) UserInfoKey

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

func (Concern) VideoKey

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

type ConcernNotify

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

func NewConcernNotify

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

func (*ConcernNotify) GetGroupCode

func (notify *ConcernNotify) GetGroupCode() int64

func (*ConcernNotify) Logger

func (notify *ConcernNotify) Logger() *logrus.Entry

func (*ConcernNotify) ToMessage

func (notify *ConcernNotify) ToMessage() (m *mmsg.MSG)

type GroupConcernConfig

type GroupConcernConfig struct {
	concern.IConfig
}

func NewGroupConcernConfig

func NewGroupConcernConfig(g concern.IConfig) *GroupConcernConfig

func (*GroupConcernConfig) ShouldSendHook

func (g *GroupConcernConfig) ShouldSendHook(notify concern.Notify) *concern.HookResult

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

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

func (*KeySet) GroupConcernConfigKey

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
	// contains filtered or unexported fields
}

type StateManager

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

func NewStateManager

func NewStateManager(notify chan<- concern.Notify) *StateManager

func (*StateManager) AddInfo

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

func (*StateManager) AddVideo

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

func (*StateManager) GetGroupConcernConfig

func (s *StateManager) GetGroupConcernConfig(groupCode int64, id interface{}) (concernConfig concern.IConfig)

func (*StateManager) GetInfo

func (s *StateManager) GetInfo(channelId string) (*Info, 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) 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

func NewUserInfo(channelId, channelName string) *UserInfo

func (*UserInfo) GetChannelName

func (ui *UserInfo) GetChannelName() string

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"`
	// contains filtered or unexported fields
}

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

func XFetchInfo

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

XFetchInfo very sb

func (*VideoInfo) GetMSG

func (v *VideoInfo) GetMSG() *mmsg.MSG

func (*VideoInfo) GetUid

func (v *VideoInfo) GetUid() interface{}

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) LiveStatusChanged

func (v *VideoInfo) LiveStatusChanged() bool

func (*VideoInfo) Living

func (v *VideoInfo) Living() bool

func (*VideoInfo) Logger

func (v *VideoInfo) Logger() *logrus.Entry

func (*VideoInfo) Site

func (v *VideoInfo) Site() string

func (*VideoInfo) TitleChanged

func (v *VideoInfo) TitleChanged() bool

func (*VideoInfo) Type

func (v *VideoInfo) Type() concern_type.Type

type VideoStatus

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

func (VideoStatus) Descriptor

func (VideoStatus) Enum

func (x VideoStatus) Enum() *VideoStatus

func (VideoStatus) EnumDescriptor deprecated

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

Deprecated: Use VideoStatus.Descriptor instead.

func (VideoStatus) Number

func (x VideoStatus) Number() protoreflect.EnumNumber

func (VideoStatus) String

func (x VideoStatus) String() string

func (VideoStatus) Type

type VideoType

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

func (VideoType) Descriptor

func (VideoType) Descriptor() protoreflect.EnumDescriptor

func (VideoType) Enum

func (x VideoType) Enum() *VideoType

func (VideoType) EnumDescriptor deprecated

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

Deprecated: Use VideoType.Descriptor instead.

func (VideoType) Number

func (x VideoType) Number() protoreflect.EnumNumber

func (VideoType) String

func (x VideoType) String() string

func (VideoType) Type

Jump to

Keyboard shortcuts

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