ytube

package
v0.2.1-beta Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Name string `fig:"name" yaml:"name"`
	ID   string `fig:"id" yaml:"id"`
}

type Service

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

func NewService

func NewService(ctx context.Context, cfg config.YouTube) (Service, error)

func (Service) LastVideos

func (s Service) LastVideos(ctx context.Context, channelID string, maxResults int) ([]Video, error)

type Video

type Video struct {
	VideoID VideoID      `json:"id"`
	Snippet VideoSnippet `json:"snippet"`
}

func FromSearchResult

func FromSearchResult(raw *youtube.SearchResult) (Video, error)

func (Video) ToBotContent

func (v Video) ToBotContent() (interface{}, error)

func (Video) URL

func (v Video) URL() string

type VideoID

type VideoID struct {
	VideoID string `json:"videoId"`
}

type VideoSnippet

type VideoSnippet struct {
	Title        string                     `json:"title"`
	ChannelTitle string                     `json:"channelTitle"`
	PublishedAt  time.Time                  `json:"publishedAt"`
	Description  time.Time                  `json:"description"`
	Thumbnails   map[string]VideoThumbnails `json:"thumbnails"`
}

type VideoThumbnails

type VideoThumbnails struct {
	Height int    `json:"height"`
	Width  int    `json:"width"`
	URL    string `json:"url"`
}

Jump to

Keyboard shortcuts

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