Documentation
¶
Overview ¶
Package auth provides cookie management for authenticated social media scraping.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChainSources ¶
func ChainSources(ctx context.Context, platform string, sources ...Source) (map[string]string, error)
ChainSources returns cookies from the first source that provides them.
func EnvVarsForPlatform ¶
EnvVarsForPlatform returns the environment variable names for a platform. This is useful for generating help messages.
Types ¶
type BrowserSource ¶
type BrowserSource struct {
// contains filtered or unexported fields
}
BrowserSource reads cookies from browser cookie stores.
func NewBrowserSource ¶
func NewBrowserSource(logger *slog.Logger) *BrowserSource
NewBrowserSource creates a new browser cookie source.
type Source ¶
type Source interface {
// Cookies returns cookies for the given platform, or nil if unavailable.
Cookies(ctx context.Context, platform string) (map[string]string, error)
}
Source represents a source of authentication cookies.
type StaticSource ¶
type StaticSource struct {
// contains filtered or unexported fields
}
StaticSource provides cookies from a static map. This is useful for testing or when cookies are provided via options.
func NewStaticSource ¶
func NewStaticSource(cookies map[string]string) *StaticSource
NewStaticSource creates a cookie source from a static map.
Click to show internal directories.
Click to hide internal directories.