htmlparser

package
v0.0.0-...-75c2cb5 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(doc *goquery.Document, substring string) bool

func GetText

func GetText(doc *goquery.Document) string

Types

type HtmlDocument

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

Repräsentiert ein HTML-Dokument. Enthält den Wurzelknoten des geparsten HMTL-Dokuments und eine Liste der Links aus diesem Dokument.

func FromBytes

func FromBytes(data []byte) (*HtmlDocument, error)

Erzeugt ein neues Dokument aus einem String. Die Links werden noch nicht initialisiert, sondern erst bei Bedarf.

func FromFile

func FromFile(path string) (*HtmlDocument, error)

Erzeugt ein neues Dokument aus einer Datei. Die Links werden noch nicht initialisiert, sondern erst bei Bedarf.

func FromString

func FromString(data string) (*HtmlDocument, error)

Erzeugt ein neues Dokument aus einem String. Die Links werden noch nicht initialisiert, sondern erst bei Bedarf.

func FromUrl

func FromUrl(url string) (*HtmlDocument, error)

Erzeugt ein neues Dokument aus einer URL.

func (*HtmlDocument) Contains

func (doc *HtmlDocument) Contains(substring string) bool
func (doc *HtmlDocument) Links() LinkList

Liefert die Links, auf die das Dokument verweist. Erzeugt die Liste, falls sie noch nicht existiert.

func (*HtmlDocument) Text

func (doc *HtmlDocument) Text() string
type Hyperlink struct {
	Url  *url.URL
	Text string
}

Repräsentiert einen Hyperlink bestehend aus der Url und dem Link-Text.

func NewHyperlink(rawUrl, text string) Hyperlink

func (Hyperlink) IsValid

func (link Hyperlink) IsValid() bool

func (Hyperlink) String

func (link Hyperlink) String() string
type LinkList []Hyperlink
func GetLinks(doc *goquery.Document) LinkList

Liefert eine Liste der URLs, die im HTML-Baum von node als Links vorkommen.

func (LinkList) Each

func (list LinkList) Each(function func(link *Hyperlink)) LinkList

func (LinkList) Filter

func (list LinkList) Filter(pred func(link Hyperlink) bool) LinkList

func (LinkList) PrintAll

func (list LinkList) PrintAll() LinkList

Jump to

Keyboard shortcuts

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