extract

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionConfig

type ActionConfig struct {
	TurnstileRetryTimeout  time.Duration `yaml:"turnstile_retry_timeout" validate:"required"`
	NavigateIframeTimeout  time.Duration `yaml:"navigate_iframe_timeout" validate:"required"`
	NavigateIframeMaxDepth int           `yaml:"navigate_iframe_max_depth" validate:"required,min=1"`
	BypassTurnstileTimeout time.Duration `yaml:"bypass_turnstile_timeout" validate:"required"`
}

type BrowserConfig

type BrowserConfig struct {
	Timeout    time.Duration `yaml:"timeout" validate:"required"`
	Headless   bool          `yaml:"headless"`
	NoSandbox  bool          `yaml:"no_sandbox"`
	ChromePath string        `yaml:"chrome_path"`
}

type CaptureConfig

type CaptureConfig struct {
	Patterns          []string      `yaml:"patterns" validate:"required,min=1"`
	MaxCandidates     int           `yaml:"max_candidates" validate:"required,min=1"`
	MaxConcurrency    int           `yaml:"max_concurrency" validate:"required,min=1"`
	CollectionWindow  time.Duration `yaml:"collection_window" validate:"required"`
	GraceAfterActions time.Duration `yaml:"grace_after_actions" validate:"required"`
}

type Config

type Config struct {
	Browser BrowserConfig
	Capture CaptureConfig
	Actions ActionConfig
}

Config is everything an Extractor needs. It is defined here — not in an application-level package — so the dependency arrow points the right way: the app config composes this type, never the reverse.

type Extractor

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

Extractor captures video stream URLs from a page using headless Chrome. It holds only capture and action config (patterns, timing) — no proxies or templates.

func New

func New(cfg Config) (*Extractor, error)

func (*Extractor) ExtractAll

func (e *Extractor) ExtractAll(ctx context.Context, urls []string) ([]*media.Stream, error)

ExtractAll runs Extract concurrently on all given URLs (bounded by the extractor's MaxConcurrency) and returns deduplicated streams.

type Profile

type Profile struct {
	UserAgent           string
	Brands              [][2]string // [brand, majorVersion]
	FullVersionList     [][2]string // [brand, fullVersion]
	Platform            string      // Client Hints platform (e.g. "Windows")
	PlatformVersion     string      // Client Hints platform version
	Architecture        string
	Bitness             string
	NavigatorPlatform   string // navigator.platform value
	AcceptLanguage      string
	Languages           []string
	HardwareConcurrency int64
	DeviceMemory        int
	ScreenWidth         int
	ScreenHeight        int
	CenterX             float64 // ScreenWidth/2, pre-computed for MouseClickXY
	CenterY             float64 // ScreenHeight/2, pre-computed for MouseClickXY
	ColorDepth          int
	WebGLVendor         string
	WebGLRenderer       string
	TimezoneID          string
	NoiseSeed           uint32  // per-session PRNG seed for canvas/audio/rect/font noise
	FontNoisePx         float64 // sub-pixel offset for measureText [0.001, 0.099]
	RectNoisePx         float64 // sub-pixel offset for getClientRects [0.001, 0.099]
	AudioNoiseMag       float64 // noise magnitude for AudioContext [0.00001, 0.0001]
}

Profile holds a coherent set of browser fingerprint values for a single extraction session. Every field is internally consistent — UA, platform, WebGL, locale, Client Hints, etc. all match the same virtual identity.

func NewProfile

func NewProfile() *Profile

NewProfile builds a randomized but internally-consistent browser fingerprint.

Jump to

Keyboard shortcuts

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