Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Global GlobalConfig `yaml:"global"`
	Tasks  []TaskConfig `yaml:"tasks"`
}

Config represents the root configuration structure

func Load

func Load(filepath string) (*Config, error)

Load parses a YAML file into a Config struct

type FieldConfig

type FieldConfig struct {
	Name      string `yaml:"name"`
	Selector  string `yaml:"selector"`
	Attr      string `yaml:"attr,omitempty"`       // HTML attribute to extract (e.g., "src", "href")
	CleanHTML bool   `yaml:"clean_html,omitempty"` // Whether to strip HTML tags from the result
	BaseURL   string `yaml:"base_url,omitempty"`   // Base URL to prepend to the result
}

FieldConfig defines how a specific field should be extracted

type GlobalConfig

type GlobalConfig struct {
	MaxConcurrency int               `yaml:"max_concurrency"`
	Headers        map[string]string `yaml:"headers"`
}

GlobalConfig holds global settings applied to all tasks

type TaskConfig

type TaskConfig struct {
	TaskID       string            `yaml:"task_id"`
	URL          string            `yaml:"url"`
	ListSelector string            `yaml:"list_selector,omitempty"` // Selector for the container of each item in a list
	ParserType   string            `yaml:"parser_type"`
	Concurrency  int               `yaml:"concurrency"`
	Delay        int               `yaml:"delay,omitempty"` // Delay in milliseconds before executing the task
	Headers      map[string]string `yaml:"headers"`
	Fields       []FieldConfig     `yaml:"fields"`
	Model        string            `yaml:"model,omitempty"`  // Used for parser_type: "llm"
	Prompt       string            `yaml:"prompt,omitempty"` // Used for parser_type: "llm"
}

TaskConfig represents a single scraping task

Jump to

Keyboard shortcuts

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