Documentation
¶
Index ¶
- Constants
- func ConfigDir() (string, error)
- func ConfigPath() (string, error)
- func DefaultDownloadDir() string
- func Exists() bool
- func Init() error
- func IsRunningInDocker() bool
- func Save(cfg *Config) error
- func SavePath() string
- func SaveSites(cfg *SitesConfig) error
- func SitesExist() bool
- type BilibiliConfig
- type Config
- func (c *Config) DeleteExpressConfig(provider, key string)
- func (c *Config) DeleteWebDAVServer(name string)
- func (c *Config) GetExpressConfig(provider string) map[string]string
- func (c *Config) GetWebDAVServer(name string) *WebDAVServer
- func (c *Config) SetExpressConfig(provider, key, value string)
- func (c *Config) SetWebDAVServer(name string, server WebDAVServer)
- type ServerConfig
- type Site
- type SitesConfig
- type TelegramConfig
- type TorrentConfig
- type TwitterConfig
- type WebDAVServer
Constants ¶
const ( ConfigFileName = "config.yml" AppDirName = "vget" )
const SitesFileName = "sites.yml"
Variables ¶
This section is empty.
Functions ¶
func ConfigDir ¶
ConfigDir returns the standard config directory for vget. Windows: %APPDATA%\vget\ macOS/Linux: ~/.config/vget/
func ConfigPath ¶
ConfigPath returns the path to the config file. e.g., ~/.config/vget/config.yml
func DefaultDownloadDir ¶
func DefaultDownloadDir() string
DefaultDownloadDir returns the default download directory Windows: ~/Downloads/vget macOS: ~/Downloads/vget Linux: ~/downloads
func IsRunningInDocker ¶
func IsRunningInDocker() bool
IsRunningInDocker detects if we're running inside a Docker container
func SaveSites ¶
func SaveSites(cfg *SitesConfig) error
SaveSites writes sites.yml to the current directory
Types ¶
type BilibiliConfig ¶ added in v0.11.0
type BilibiliConfig struct {
// Cookie is the full cookie string (SESSDATA, bili_jct, DedeUserID)
Cookie string `yaml:"cookie,omitempty"`
}
BilibiliConfig holds Bilibili authentication settings
type Config ¶
type Config struct {
// Language for metadata (e.g., "en", "zh", "ja")
Language string `yaml:"language,omitempty"`
// Default output directory
OutputDir string `yaml:"output_dir,omitempty"`
// Preferred format (e.g., "mp4", "webm", "best")
Format string `yaml:"format,omitempty"`
// Default quality preference (e.g., "1080p", "720p", "best")
Quality string `yaml:"quality,omitempty"`
// WebDAV servers configuration
WebDAVServers map[string]WebDAVServer `yaml:"webdavServers,omitempty"`
// Twitter/X configuration
Twitter TwitterConfig `yaml:"twitter,omitempty"`
// Server configuration for `vget serve`
Server ServerConfig `yaml:"server,omitempty"`
// Express tracking providers configuration
// Each provider has its own config structure stored as map[string]string
// Example YAML:
// express:
// kuaidi100:
// key: "xxx"
// customer: "yyy"
// fedex:
// api_key: "zzz"
Express map[string]map[string]string `yaml:"express,omitempty"`
// Torrent client configuration for dispatching magnet links
Torrent TorrentConfig `yaml:"torrent,omitempty"`
// Bilibili configuration
Bilibili BilibiliConfig `yaml:"bilibili,omitempty"`
// Telegram configuration
Telegram TelegramConfig `yaml:"telegram,omitempty"`
}
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a config with sensible defaults
func LoadOrDefault ¶
func LoadOrDefault() *Config
LoadOrDefault loads config if it exists, otherwise returns defaults. It also applies defaults for any empty fields in the loaded config.
func RunInitWizard ¶
RunInitWizard runs an interactive TUI wizard to configure vget
func (*Config) DeleteExpressConfig ¶
DeleteExpressConfig removes a config value for an express provider
func (*Config) DeleteWebDAVServer ¶
DeleteWebDAVServer removes a WebDAV server by name
func (*Config) GetExpressConfig ¶
GetExpressConfig returns the config for a specific express provider
func (*Config) GetWebDAVServer ¶
func (c *Config) GetWebDAVServer(name string) *WebDAVServer
GetWebDAVServer returns a WebDAV server by name, or nil if not found
func (*Config) SetExpressConfig ¶
SetExpressConfig sets a config value for an express provider
func (*Config) SetWebDAVServer ¶
func (c *Config) SetWebDAVServer(name string, server WebDAVServer)
SetWebDAVServer adds or updates a WebDAV server
type ServerConfig ¶
type ServerConfig struct {
// Port is the HTTP listen port (default: 8080)
Port int `yaml:"port,omitempty"`
// MaxConcurrent is the max number of concurrent downloads (default: 10)
MaxConcurrent int `yaml:"max_concurrent,omitempty"`
// APIKey for authentication (optional, if set all requests must include X-API-Key header)
APIKey string `yaml:"api_key,omitempty"`
}
ServerConfig holds HTTP server settings for `vget serve`
type Site ¶
type Site struct {
// Match is a substring to match against the URL (e.g., "kanav.ad")
Match string `yaml:"match"`
// Type is the media type to extract (e.g., "m3u8", "mp4")
Type string `yaml:"type"`
}
Site represents a site configuration for browser-based extraction
type SitesConfig ¶
type SitesConfig struct {
Sites []Site `yaml:"sites"`
}
SitesConfig holds the sites configuration
func LoadSites ¶
func LoadSites() (*SitesConfig, error)
LoadSites reads sites.yml from the current directory
func (*SitesConfig) AddSite ¶
func (c *SitesConfig) AddSite(match, mediaType string)
AddSite adds a new site configuration
func (*SitesConfig) MatchSite ¶
func (c *SitesConfig) MatchSite(url string) *Site
MatchSite finds a matching site for the given URL
func (*SitesConfig) RemoveSite ¶
func (c *SitesConfig) RemoveSite(match string) bool
RemoveSite removes a site by match string
type TelegramConfig ¶ added in v0.13.3
type TelegramConfig struct {
// TDataPath is the custom path to Telegram Desktop tdata directory
TDataPath string `yaml:"tdata_path,omitempty"`
}
TelegramConfig holds Telegram authentication settings
type TorrentConfig ¶ added in v0.10.0
type TorrentConfig struct {
// Enabled determines if torrent dispatch feature is active
Enabled bool `yaml:"enabled,omitempty"`
// Client type: "transmission", "qbittorrent", "synology"
Client string `yaml:"client,omitempty"`
// Host is the torrent client address (e.g., "192.168.1.100:9091")
Host string `yaml:"host,omitempty"`
// Username for authentication
Username string `yaml:"username,omitempty"`
// Password for authentication
Password string `yaml:"password,omitempty"`
// UseHTTPS enables HTTPS connection to torrent client
UseHTTPS bool `yaml:"use_https,omitempty"`
// DefaultSavePath overrides the client's default download directory
DefaultSavePath string `yaml:"default_save_path,omitempty"`
}
TorrentConfig holds configuration for remote torrent client integration
type TwitterConfig ¶
type TwitterConfig struct {
// AuthToken is the auth_token cookie value from browser (for NSFW content)
AuthToken string `yaml:"auth_token,omitempty"`
}
TwitterConfig holds Twitter/X authentication settings
type WebDAVServer ¶
type WebDAVServer struct {
// URL is the WebDAV server URL (e.g., "https://pikpak.com/dav")
URL string `yaml:"url"`
// Username for authentication
Username string `yaml:"username,omitempty"`
// Password for authentication
Password string `yaml:"password,omitempty"`
}
WebDAVServer represents a WebDAV server configuration