mgstage

package
v0.2.0-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPClient

func NewHTTPClient(cfg *config.ScraperSettings, globalProxy *config.ProxyConfig, globalFlareSolverr config.FlareSolverrConfig) (*resty.Client, error)

NewHTTPClient creates a new HTTP client for the MGStage scraper. HTTP-01: Per-scraper HTTP client ownership.

Types

type MGStageConfig

type MGStageConfig struct {
	Enabled       bool                      `yaml:"enabled" json:"enabled"`
	RequestDelay  int                       `yaml:"request_delay" json:"request_delay"`
	MaxRetries    int                       `yaml:"max_retries" json:"max_retries"`
	UserAgent     string                    `yaml:"user_agent" json:"user_agent"`
	Proxy         *config.ProxyConfig       `yaml:"proxy,omitempty" json:"proxy,omitempty"`
	DownloadProxy *config.ProxyConfig       `yaml:"download_proxy,omitempty" json:"download_proxy,omitempty"`
	Priority      int                       `yaml:"priority" json:"priority"` // Scraper's priority (higher = higher priority)
	FlareSolverr  config.FlareSolverrConfig `yaml:"flaresolverr" json:"flaresolverr"`
}

Config holds MGStage scraper configuration. YAML tags are defined here for unmarshaling via config.ScrapersConfig.

func (*MGStageConfig) GetDownloadProxy

func (c *MGStageConfig) GetDownloadProxy() any

GetDownloadProxy implements scraperutil.ScraperConfigInterface.

func (*MGStageConfig) GetMaxRetries

func (c *MGStageConfig) GetMaxRetries() int

GetMaxRetries implements scraperutil.ScraperConfigInterface.

func (*MGStageConfig) GetProxy

func (c *MGStageConfig) GetProxy() any

GetProxy implements scraperutil.ScraperConfigInterface.

func (*MGStageConfig) GetRequestDelay

func (c *MGStageConfig) GetRequestDelay() int

GetRequestDelay implements scraperutil.ScraperConfigInterface.

func (*MGStageConfig) GetUserAgent

func (c *MGStageConfig) GetUserAgent() string

GetUserAgent implements scraperutil.ScraperConfigInterface.

func (*MGStageConfig) IsEnabled

func (c *MGStageConfig) IsEnabled() bool

IsEnabled implements scraperutil.ScraperConfigInterface.

func (*MGStageConfig) ValidateConfig

func (c *MGStageConfig) ValidateConfig(sc *config.ScraperSettings) error

ValidateConfig implements config.ConfigValidator for MGStageConfig.

type Scraper

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

Scraper implements the MGStage scraper

func New

func New(settings config.ScraperSettings, globalProxy *config.ProxyConfig, globalFlareSolverr config.FlareSolverrConfig) *Scraper

New creates a new MGStage scraper

func (*Scraper) Close

func (s *Scraper) Close() error

Close cleans up resources held by the scraper

func (*Scraper) Config

func (s *Scraper) Config() *config.ScraperSettings

Config returns the scraper's configuration

func (*Scraper) GetURL

func (s *Scraper) GetURL(id string) (string, error)

GetURL attempts to find the URL for a given movie ID using MGStage search

func (*Scraper) IsEnabled

func (s *Scraper) IsEnabled() bool

IsEnabled returns whether the scraper is enabled

func (*Scraper) Name

func (s *Scraper) Name() string

Name returns the scraper identifier

func (*Scraper) ResolveDownloadProxyForHost

func (s *Scraper) ResolveDownloadProxyForHost(host string) (*config.ProxyConfig, *config.ProxyConfig, bool)

ResolveDownloadProxyForHost declares MGStage-owned media hosts for downloader proxy routing.

func (*Scraper) ResolveSearchQuery

func (s *Scraper) ResolveSearchQuery(input string) (string, bool)

ResolveSearchQuery normalizes MGStage-specific IDs from free-form input. This is primarily used by batch scraping to preserve 3-digit numeric prefixes (e.g., "259LUXU-1806"), which generic filename matching can strip to "LUXU-1806".

func (*Scraper) Search

func (s *Scraper) Search(id string) (*models.ScraperResult, error)

Search searches for and scrapes metadata for a given movie ID

func (*Scraper) ValidateConfig

func (s *Scraper) ValidateConfig(cfg *config.ScraperSettings) error

ValidateConfig validates the scraper configuration. Returns error if config is invalid, nil if valid.

Jump to

Keyboard shortcuts

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