scraper

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ScrapedData

type ScrapedData struct {
	URL         string
	Title       string
	Text        []string
	Links       []string
	StatusCode  int
	ContentType string
}

ScrapedData represents the structured data extracted from a webpage

type Scraper

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

Scraper provides web scraping functionality

func NewScraper

func NewScraper() *Scraper

NewScraper creates a new scraper instance with default configuration

func (*Scraper) AllowedDomains

func (s *Scraper) AllowedDomains(domains ...string)

AllowedDomains sets the allowed domains for scraping

func (*Scraper) Scrape

func (s *Scraper) Scrape(url string) (*ScrapedData, error)

Scrape performs web scraping on the given URL and returns structured data

func (*Scraper) SetCustomHeaders

func (s *Scraper) SetCustomHeaders(headers map[string]string)

SetCustomHeaders allows setting custom headers for the scraper

Jump to

Keyboard shortcuts

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