Documentation
¶
Overview ¶
Package preprocessor is the stage of the pipeline that :
1. Checks that the received seed is consistent and has the correct status 2. Normalizes the seed's lowest level URLs 3. Checks if the URLs should be excluded 4. Removes any false-positive assets 5. Deduplicate the items 6. Seencheck the items 7. Builds the requests before handling them to the archiver
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrPreprocessorAlreadyInitialized is the error returned when the preprocessor is already initialized ErrPreprocessorAlreadyInitialized = errors.New("preprocessor already initialized") // ErrSchemeIsInvalid is the error returned when the scheme of a URL is not http or http ErrUnsupportedScheme = errors.New("URL scheme is unsupported") // ErrUnsupportedHost is the error returned when the host of a URL is unsupported ErrUnsupportedHost = errors.New("unsupported host") // ErrPathLoopDetected is the error returned when a URL path contains repeating segments indicating a crawler trap ErrPathLoopDetected = errors.New("URL path or query loop detected") // ErrURLTooLong is the error returned when a URL exceeds the maximum allowed length ErrURLTooLong = errors.New("URL exceeds maximum allowed length") )
var (
GlobalPreprocessor *preprocessor
)
Functions ¶
func NormalizeURL ¶
Normalize the URL by removing fragments, attempting to add URL scheme if missing, and converting relative URLs into absolute URLs. An error is returned if the URL cannot be normalized.
func SetSeenchecker ¶
func SetSeenchecker(seenchecker SeencheckerFunc)
SetSeenchecker sets the seenchecker function to be used by the preprocessor. It should be called only once, and it will panic if called more than once or if the preprocessor is not initialized.