ytmusic

package
v1.60.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const CallbackPort = 19873

CallbackPort is the fixed port for the OAuth2 callback server. Must match the redirect URI registered in the Google Cloud console.

Variables

This section is empty.

Functions

func FallbackCredentials

func FallbackCredentials() (clientID, clientSecret string)

FallbackCredentials returns a random credential pair from the built-in pool, or empty strings if the pool is empty.

Types

type Providers

type Providers struct {
	Music *YouTubeMusicProvider
	Video *YouTubeProvider
	All   *YouTubeAllProvider
}

Providers holds the YouTube Music, YouTube, and YouTube All providers, sharing a single OAuth session.

func New

func New(session *Session, clientID, clientSecret string, hasCookies bool) Providers

New creates all three YouTube providers with a shared session.

type Session

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

Session manages a YouTube Data API v3 service for YouTube Music integration.

func NewSession

func NewSession(ctx context.Context, clientID, clientSecret string) (*Session, error)

NewSession creates a YouTube API session, using stored credentials if available, otherwise starting an interactive OAuth2 flow.

func NewSessionSilent

func NewSessionSilent(ctx context.Context, clientID, clientSecret string) (*Session, error)

NewSessionSilent is like NewSession but only uses stored credentials. Returns an error if interactive auth is required.

func (*Session) Close

func (s *Session) Close()

Close is a no-op for YouTube Music sessions (no persistent connections).

func (*Session) Service

func (s *Session) Service() *youtube.Service

Service returns the YouTube API service, holding the lock briefly.

type YouTubeAllProvider

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

YouTubeAllProvider shows all playlists regardless of classification.

func (*YouTubeAllProvider) Authenticate

func (p *YouTubeAllProvider) Authenticate() error

func (*YouTubeAllProvider) Close

func (p *YouTubeAllProvider) Close()

func (*YouTubeAllProvider) Name

func (p *YouTubeAllProvider) Name() string

func (*YouTubeAllProvider) Playlists

func (p *YouTubeAllProvider) Playlists() ([]playlist.PlaylistInfo, error)

func (*YouTubeAllProvider) Refresh

func (p *YouTubeAllProvider) Refresh()

func (*YouTubeAllProvider) Tracks

func (p *YouTubeAllProvider) Tracks(id string) ([]playlist.Track, error)

type YouTubeMusicProvider

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

YouTubeMusicProvider shows playlists classified as music content.

func (*YouTubeMusicProvider) Authenticate

func (p *YouTubeMusicProvider) Authenticate() error

func (*YouTubeMusicProvider) Close

func (p *YouTubeMusicProvider) Close()

func (*YouTubeMusicProvider) Name

func (p *YouTubeMusicProvider) Name() string

func (*YouTubeMusicProvider) Playlists

func (p *YouTubeMusicProvider) Playlists() ([]playlist.PlaylistInfo, error)

func (*YouTubeMusicProvider) Refresh

func (p *YouTubeMusicProvider) Refresh()

func (*YouTubeMusicProvider) Tracks

func (p *YouTubeMusicProvider) Tracks(id string) ([]playlist.Track, error)

type YouTubeProvider

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

YouTubeProvider shows playlists classified as non-music (video) content.

func (*YouTubeProvider) Authenticate

func (p *YouTubeProvider) Authenticate() error

func (*YouTubeProvider) Close

func (p *YouTubeProvider) Close()

func (*YouTubeProvider) Name

func (p *YouTubeProvider) Name() string

func (*YouTubeProvider) Playlists

func (p *YouTubeProvider) Playlists() ([]playlist.PlaylistInfo, error)

func (*YouTubeProvider) Refresh

func (p *YouTubeProvider) Refresh()

func (*YouTubeProvider) Tracks

func (p *YouTubeProvider) Tracks(id string) ([]playlist.Track, error)

Jump to

Keyboard shortcuts

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