netease

package
v1.60.0 Latest Latest
Warning

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

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

Documentation

Overview

Package netease implements a playlist.Provider for NetEase Cloud Music.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotAuthenticated = errors.New("netease: browser session is not signed in")

ErrNotAuthenticated is returned when browser cookies do not contain a signed-in NetEase Cloud Music account.

Functions

This section is empty.

Types

type Account

type Account struct {
	UserID   string
	Nickname string
	VIPType  int
}

Account describes the signed-in NetEase account visible through cookies.

func CheckLogin

func CheckLogin(ctx context.Context, browser string) (Account, error)

CheckLogin verifies that the given browser has a signed-in NetEase account.

type Config

type Config struct {
	Enabled     bool
	CookiesFrom string
	UserID      string
}

Config holds settings for the NetEase provider.

func (Config) IsSet

func (c Config) IsSet() bool

IsSet reports whether the provider should be exposed.

type Provider

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

Provider implements playlist.Provider and provider.Searcher.

func New

func New(cfg Config) *Provider

New creates a NetEase provider.

func NewFromConfig

func NewFromConfig(cfg Config) *Provider

NewFromConfig returns a provider, or nil when NetEase is not enabled. Sets resolve's yt-dlp cookies as a side effect when CookiesFrom is non-empty so URL resolution uses the same signed-in browser session.

func (*Provider) Account

func (p *Provider) Account(ctx context.Context) (Account, error)

Account returns the signed-in account from browser cookies.

func (*Provider) Name

func (p *Provider) Name() string

func (*Provider) Playlists

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

Playlists returns account playlists followed by public chart playlists.

func (*Provider) Refresh

func (p *Provider) Refresh()

Refresh clears cached account and playlist state.

func (*Provider) SearchTracks

func (p *Provider) SearchTracks(ctx context.Context, query string, limit int) ([]playlist.Track, error)

SearchTracks searches NetEase songs.

func (*Provider) Tracks

func (p *Provider) Tracks(playlistID string) ([]playlist.Track, error)

Tracks returns tracks for a user playlist or built-in chart playlist.

Jump to

Keyboard shortcuts

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