youtube

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToVideoId

func ToVideoId(urlOrId string) (string, error)

func ToVideoIds

func ToVideoIds(urlsOrIds []string) ([]string, error)

Types

type Playlist

type Playlist struct {
	ID          string
	Title       string
	Description string
	Visibility  string
	Videos      []PlaylistItem
}

type PlaylistDiffResult

type PlaylistDiffResult struct {
	Inserts []PlaylistInsert
	Deletes []PlaylistItemDelete
}

type PlaylistInsert

type PlaylistInsert struct {
	VideoId  string
	Position int64
}

type PlaylistItem

type PlaylistItem struct {
	ID      string
	VideoID string
	Title   string
}

type PlaylistItemDelete

type PlaylistItemDelete struct {
	ItemId string
}

type YouTube

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

func New

func New(ctx context.Context, endpoint, refreshToken string) (*YouTube, error)

func (*YouTube) CreatePlaylist

func (y *YouTube) CreatePlaylist(ctx context.Context, title, desc, visibility string) (*youtube.Playlist, error)

func (*YouTube) DeletePlaylist

func (y *YouTube) DeletePlaylist(ctx context.Context, id string) error

func (*YouTube) DiffPlaylist

func (y *YouTube) DiffPlaylist(wantIds []string, gotItems []*youtube.PlaylistItem) PlaylistDiffResult

func (*YouTube) GetPlaylist

func (y *YouTube) GetPlaylist(ctx context.Context, id string) (*youtube.Playlist, error)

func (*YouTube) GetPlaylistItems

func (y *YouTube) GetPlaylistItems(ctx context.Context, playlistId string) ([]*youtube.PlaylistItem, error)

func (*YouTube) GetPlaylists

func (y *YouTube) GetPlaylists(ctx context.Context) ([]*youtube.Playlist, error)

func (*YouTube) SyncPlaylist

func (y *YouTube) SyncPlaylist(ctx context.Context, playlistId string, wantIds []string) (*PlaylistDiffResult, error)

func (*YouTube) UpdatePlaylist

func (y *YouTube) UpdatePlaylist(ctx context.Context, id, title, desc, visibility string) (*youtube.Playlist, error)

Jump to

Keyboard shortcuts

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