visitor

package module
v0.0.0-...-c4c3f3e Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLoader

func CreateLoader()

func ExtractStrings

func ExtractStrings(source []byte) ([]string, error)

func ResolveURL

func ResolveURL(stringURL string, baseURL *url.URL) (absoluteURL *url.URL, err error)

Types

type AstWalker

type AstWalker struct {
	Strings *[]string
}

func (AstWalker) Enter

func (w AstWalker) Enter(node ast.Node) ast.Visitor

func (AstWalker) Exit

func (w AstWalker) Exit(node ast.Node)

type ExternalScriptsExtractor

type ExternalScriptsExtractor interface {
	ExtractRefs(htmlBody []byte) (refs []string, err error)
}

ExternalScriptsExtractor represents an interface to extract external scripts from an HTML page

type FastHTTPPageLoader

type FastHTTPPageLoader struct {
	Timeout      time.Duration
	MaxRedirects int
	UserAgent    string
	Buf          []byte
}

FastHTTPPageLoader represents a way to load HTML by URL via fasthttp package

func (FastHTTPPageLoader) LoadPage

func (l FastHTTPPageLoader) LoadPage(url string) (statusCode int, finalUrl string, body []byte, error error)

type GoqueryParser

type GoqueryParser struct{}

GoqueryParser represetns an entity to parse HTML with goquery

func (GoqueryParser) ExtractInlineScripts

func (g GoqueryParser) ExtractInlineScripts(htmlBody []byte) ([]string, error)

ExtractInlineScripts extracts an array of inline scripts from HTML document

func (GoqueryParser) ExtractRefs

func (g GoqueryParser) ExtractRefs(htmlBody []byte) ([]string, error)

ExtractRefs extracts an array of external scripts from HTML document

type InlineScriptsExtractor

type InlineScriptsExtractor interface {
	ExtractInlineScripts(htmlBody []byte) (refs []string, err error)
}

InlineScriptsExtractor represents an interface to extract inline scripts from an HTML page

type PageLoader

type PageLoader interface {
	LoadPage(url string) (statusCode int, finalURL string, body []byte, err error)
}

PageLoader represents an interface to load HTML by URL

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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