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

scan

package
v0.0.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AIAnalysisResult

type AIAnalysisResult struct {
	TOCSelector     string  `json:"toc_selector"`
	ContentSelector string  `json:"content_selector"`
	Confidence      float64 `json:"confidence"`
	Reasoning       string  `json:"reasoning"`
}

AIAnalysisResult AI分析结果

type CatalogConfig

type CatalogConfig struct {
	Site        string         `json:"site"`
	URL         string         `json:"url"`
	Selectors   Selectors      `json:"selectors"`
	Items       []*CatalogItem `json:"items"`
	AIGenerated bool           `json:"ai_generated"`
	Confidence  float64        `json:"confidence"`
	ScannedAt   string         `json:"scanned_at"`
}

CatalogConfig 目录配置

type CatalogItem

type CatalogItem struct {
	Title    string         `json:"title"`
	URL      string         `json:"url"`
	Children []*CatalogItem `json:"children,omitempty"`
	// contains filtered or unexported fields
}

CatalogItem 目录项

type Config

type Config struct {
	URL         string // 目标URL
	Output      string // 输出目录
	AIEnabled   bool   // 是否启用AI辅助
	Headless    bool   // 是否无头模式
	Timeout     int    // 超时时间
	ExpandTOC   bool   // 是否展开目录
	Interactive bool   // 交互模式
	AppConfig   *models.AppConfig
}

Config scan命令配置

type Processor

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

Processor scan处理器

func NewProcessor

func NewProcessor(config *Config, logger *zap.Logger) (*Processor, error)

NewProcessor 创建scan处理器

func (*Processor) AnalyzeWithAI

func (p *Processor) AnalyzeWithAI(ctx context.Context, html string) (*AIAnalysisResult, error)

AnalyzeWithAI 使用AI分析页面结构(可选)

func (*Processor) Execute

func (p *Processor) Execute(ctx context.Context) (*CatalogConfig, error)

Execute 执行扫描

func (*Processor) ExecuteInteractive

func (p *Processor) ExecuteInteractive(ctx context.Context, continueSignal <-chan struct{}) (*CatalogConfig, error)

ExecuteInteractive 交互模式执行扫描

func (*Processor) InteractiveScan

func (p *Processor) InteractiveScan(ctx context.Context, continueSignal <-chan struct{}, htmlContent *string) error

InteractiveScan 交互模式扫描(带外部等待) 这个版本会保持浏览器打开,等待调用者通知继续

type Selectors

type Selectors struct {
	TOC         string `json:"toc"`                    // 目录选择器
	Content     string `json:"content"`                // 内容选择器
	TOCType     string `json:"toc_type,omitempty"`     // 目录选择器类型: css/xpath
	ContentType string `json:"content_type,omitempty"` // 内容选择器类型: css/xpath
}

Selectors 选择器配置

Jump to

Keyboard shortcuts

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