kick

package module
v0.0.0-...-08b85b5 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: MIT Imports: 14 Imported by: 0

README

🔦🟢 crawly-live-kick

A Kick.com channel (livestream) tracker.

Depends on rubpy/crawly.

Example

An interactive example can be found here: example/example.go.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NilConfig = errors.New("config is nil")
	NilClient = errors.New("client is nil")
)
View Source
var (
	InvalidChannelSlug    = errors.New("invalid channel slug")
	InvalidPlaybackURL    = errors.New("invalid playback URL")
	UnexpectedIVSResponse = errors.New("unexpected IVS response")
)
View Source
var DefaultSettings = CrawlerSettings{
	CrawlerSettings: crawly.DefaultCrawlerSettings,

	MaximumChannelPlaybackURLAge: 50 * time.Minute,
	MinimumFetchChannelDelay:     5 * time.Minute,
}

Functions

func ExtractChannelSlug

func ExtractChannelSlug(channelURL string) (slug string, ok bool)

func IsValidChannelSlug

func IsValidChannelSlug(channelSlug string) bool

Types

type ConfigOption

type ConfigOption func(cfg *config)

func WithAPIClient

func WithAPIClient(apiClient cclient.APIClient) ConfigOption

func WithClient

func WithClient(client cclient.Client) ConfigOption

func WithLogger

func WithLogger(logger *slog.Logger) ConfigOption

func WithSettings

func WithSettings(settings CrawlerSettings) ConfigOption

type Crawler

type Crawler struct {
	crawly.Crawler
	// contains filtered or unexported fields
}

func NewCrawler

func NewCrawler(opts ...ConfigOption) (*Crawler, error)

func (*Crawler) CheckIVS

func (cr *Crawler) CheckIVS(ctx context.Context, playbackURL string) (available bool, tokenValid bool, err error)

func (*Crawler) FetchChannel

func (cr *Crawler) FetchChannel(ctx context.Context, channelSlug string) (channel *api.Channel, err error)

func (*Crawler) SetSettings

func (cr *Crawler) SetSettings(settings CrawlerSettings)

func (*Crawler) Settings

func (cr *Crawler) Settings() CrawlerSettings

type CrawlerSettings

type CrawlerSettings struct {
	crawly.CrawlerSettings

	MaximumChannelPlaybackURLAge time.Duration
	MinimumFetchChannelDelay     time.Duration
}

type EntityData

type EntityData struct {
	Live bool `json:"live"`

	Channel     *api.Channel `json:"channel"`
	PlaybackURL string       `json:"playback_url"`
	FetchedAt   time.Time    `json:"fetched_at"`
}

type Handle

type Handle struct {
	Type  HandleType
	Value string
}

func ChannelSlug

func ChannelSlug(channelSlug string) Handle

func (Handle) Equal

func (h Handle) Equal(handle crawly.Handle) bool

func (Handle) String

func (h Handle) String() string

func (Handle) Valid

func (h Handle) Valid() bool

type HandleType

type HandleType uint
const (
	HandleChannelSlug HandleType = (iota + 1)
)

func (HandleType) String

func (ht HandleType) String() string

type OrderData

type OrderData struct{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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