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

classifier

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package classifier labels each fetch result with how the site treated it.

Index

Constants

View Source
const (
	Error          = "error"
	Challenged     = "challenged"
	RateLimited    = "rate-limited"
	Blocked        = "blocked"
	Cloaked        = "cloaked"
	RobotsDisallow = "robots-disallowed"
	Allowed        = "allowed"
)

Classifications, from most to least severe.

View Source
const DefaultCloakThreshold = 0.5

DefaultCloakThreshold is the visible-text similarity below which an allowed response is reported as cloaked.

Variables

This section is empty.

Functions

func BaselineIndex

func BaselineIndex(results []types.FetchResult) int

BaselineIndex returns the index of the browser baseline result, or -1. Profiles marked browser win; otherwise a profile named like Chrome is used.

func Classify

func Classify(r types.FetchResult) string

Classify returns the classification for a single result.

func ClassifyAll

func ClassifyAll(results []types.FetchResult, threshold float64)

ClassifyAll sets Classification on every result in place. When a browser baseline was fetched successfully, every other allowed result is compared with it and marked cloaked if its visible text similarity is below threshold. A threshold <= 0 disables cloaking detection.

func CompareProducts added in v0.3.0

func CompareProducts(results []types.FetchResult)

CompareProducts flags agents that were shown different product data than the browser baseline: missing structured data, or a different price or availability. It only looks at allowed results.

func Summarize

func Summarize(results []types.FetchResult) types.Summary

Summarize counts results per classification.

Types

This section is empty.

Jump to

Keyboard shortcuts

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