robots

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package robots provides robots.txt parsing and compliance checking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

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

Parser handles robots.txt parsing and URL compliance checking

func New

func New(userAgent string) *Parser

New creates a new robots.txt parser

func (*Parser) FetchAndParse

func (p *Parser) FetchAndParse(ctx context.Context, baseURL string) error

FetchAndParse fetches and parses robots.txt from the given base URL

func (*Parser) GetCrawlDelay

func (p *Parser) GetCrawlDelay() time.Duration

GetCrawlDelay returns the crawl delay specified in robots.txt

func (*Parser) IsAllowed

func (p *Parser) IsAllowed(urlPath string) bool

IsAllowed checks if the given URL path is allowed by robots.txt

func (*Parser) Parse

func (p *Parser) Parse(reader io.Reader) error

Parse parses robots.txt content from a reader

func (*Parser) RobotsTxtFound

func (p *Parser) RobotsTxtFound() bool

RobotsTxtFound returns whether robots.txt was found and parsed

Jump to

Keyboard shortcuts

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