youtube

package
v0.0.0-...-bbc3de6 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(ctx context.Context, cfg *ucfg.Config) error

NewService must be called before the youtube package is going to be used. It receives a context and a configuration which contains the api token which can be found (or can be created) here: https://console.developers.google.com/apis/credentials

Types

type Channel

type Channel struct {
	Title            string
	URL              string
	ID               string
	UploadPlaylistID string
}

Channel contains information about a YouTube channel

func NewChannel

func NewChannel(url string) (*Channel, error)

NewChannel receive an url and based on it, creates a new Channel instance. In case of failure, an error is returned in second parameter, otherwise this parameter is nil

type Playlist

type Playlist struct {
	ID string
	// contains filtered or unexported fields
}

Playlist is used to identify uploaded videos for a channel

func NewPlaylist

func NewPlaylist(channel Channel) (*Playlist, error)

NewPlaylist receives a Channel struct and creates a new Playlist instance based on its parameter

func (*Playlist) GetNextVideos

func (p *Playlist) GetNextVideos() ([]Video, error)

GetNextVideos obtains the list of videos from the current page

func (*Playlist) HasNextPage

func (p *Playlist) HasNextPage() bool

HasNextPage indicate if a playlist has more videos or not

type Video

type Video struct {
	PublishedAt string
	Title       string
	Description string
	Position    int
	VideoID     string
	ChannelID   string
}

func NewVideo

func NewVideo(
	PublishedAt, Title, Description, VideoID, ChannelID string,
	Position int,
) (Video, error)

func (Video) Download

func (v Video) Download() (string, error)

Jump to

Keyboard shortcuts

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