gocheerio

package
v0.0.0-...-e2980ae Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document interface {
	// Find returns a Selection matching the given selector
	Find(selector string) Selection

	// Html returns the HTML content of the document
	Html() (string, error)

	// Text returns the text content of the document
	Text() string
}

Document represents an HTML document

func Load

func Load(html string) (Document, error)

Load creates a new Document from HTML content

type Selection

type Selection interface {
	// Find returns a new Selection filtered by the given selector
	Find(selector string) Selection

	// Html returns the HTML contents of the first element in the selection
	Html() (string, error)

	// Text returns the combined text contents of all matched elements
	Text() string

	// Attr returns the value of the specified attribute for the first element
	Attr(name string) (string, bool)

	// Each runs the given function on each element in the selection
	Each(func(int, Selection))

	// Length returns the number of elements in the selection
	Length() int
}

Selection represents a set of matched nodes

Jump to

Keyboard shortcuts

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